Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Migration to building with Gradle, remove UI and documentation bundles/build #11

Merged
merged 14 commits into from
Aug 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
The diff you're trying to view is too large. We only load the first 3000 changed files.
17 changes: 17 additions & 0 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
# EditorConfig is awesome: http://EditorConfig.org

root = true

[*]
end_of_line = lf
trim_trailing_whitespace = true
charset = utf-8
insert_final_newline = true

[*.gradle]
indent_style = space
indent_size = 2

[{*.groovy,*.java}]
indent_style = tab
indent_size = 4
172 changes: 19 additions & 153 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
@@ -1,168 +1,34 @@
---
name: Check

on:
pull_request:
branches:
- '*' # Trigger on all branches for pull requests

# also run workflow to refresh cache
workflow_dispatch: {}
schedule:
# roughly every 6 days
- cron: '0 0 2,6,10,16,22,28 * *'


# env:
# instead of embedded Maven use local Maven CLI
# HALE_BUILD_MAVEN_EMBEDDED: 'false'
- master

jobs:
check:
runs-on: ubuntu-latest

steps:
- name: Setup Maven
uses: s4u/setup-maven-action@2f53a7669c7543a045d0bb6c92436df0c5a726f8 # v1.14.0
with:
java-version: 17
java-distribution: temurin
maven-version: 3.9.6

- name: Clean
run: ./build.sh clean
working-directory: ./build

- name: Test
run: ./build.sh commitStage
working-directory: ./build

- name: Publish Test Report
uses: mikepenz/action-junit-report@db71d41eb79864e25ab0337e395c352e84523afe # v4.3.1
if: always() # always run even if the previous step fails
with:
# fail if there are no test results
require_tests: true

# Workaround for check that is additionally created being associated
# to the wrong workflow/run. Instead no additional check is created.
# See https://github.com/mikepenz/action-junit-report/issues/40
annotate_only: true
detailed_summary: true
report_paths: 'build/target/testReports/*.xml'

# TODO archive logs?
# build/target/testReports/*.out,build/target/testReports/*.err

build:
spotless:
runs-on: ubuntu-latest

permissions:
contents: read
pull-requests: write # Note: Write permissions cannot be granted from forks (only works for private repos requiring enabling a related setting)

concurrency:
group: artifacts-${{ github.ref }}
cancel-in-progress: true

steps:
- name: Setup Maven
uses: s4u/setup-maven-action@2f53a7669c7543a045d0bb6c92436df0c5a726f8 # v1.14.0
- uses: actions/setup-java@99b8673ff64fbf99d8d325f52d9a5bdedb8483e9 # v4.2.1
with:
distribution: temurin
java-version: 17
java-distribution: temurin
maven-version: 3.9.6

- name: Install genisoimage # required for Mac build
run: sudo apt-get install -y genisoimage

- name: Clean
run: ./build.sh clean
working-directory: ./build

- name: Product
run: |
./build.sh product --arch x86_64 --os linux HALE
./build.sh product --arch x86_64 --os windows HALE
./build.sh product --arch x86_64 --os macosx HALE
working-directory: ./build

- name: Upload hale studio build (Linux)
id: upload-linux
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: hale studio (Linux)
path: build/target/hale-studio-*linux*.tar.gz
retention-days: 14

- name: Upload hale studio build (Windows)
id: upload-windows
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: hale studio (Windows)
path: build/target/hale-studio-*win32*.zip
retention-days: 14

- name: Upload hale studio build (macos)
id: upload-macos
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: hale studio (macos)
path: build/target/hale-studio-*macosx*.dmg
retention-days: 14

- name: Find artifact comment if it exists
if: "! github.event.pull_request.head.repo.fork " # Only run with write permissions
uses: peter-evans/find-comment@3eae4d37986fb5a8592848f6a574fdf654e61f9e # v3.1.0
id: find-comment
with:
token: ${{ github.token }}
issue-number: ${{github.event.pull_request.number}}
comment-author: github-actions[bot]
body-includes: "hale studio builds for this pull request:"

- name: Comment with links to artifacts
if: "! github.event.pull_request.head.repo.fork " # Only run with write permissions
id: comment-plan
uses: peter-evans/create-or-update-comment@71345be0265236311c031f5c7866368bd1eff043 # v4.0.0
with:
token: ${{ github.token }}
edit-mode: replace
comment-id: ${{ steps.find-comment.outputs.comment-id }}
issue-number: ${{github.event.pull_request.number}}
body: |
hale studio builds for this pull request:

- [Linux x64](${{ steps.upload-linux.outputs.artifact-url }})
- [Windows x64](${{ steps.upload-windows.outputs.artifact-url }})
- [macos x64](${{ steps.upload-macos.outputs.artifact-url }})

Build triggered for commit *${{ github.sha }}*.
Artifacts are retained for 14 days.

trivy:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download hale studio build (Linux)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: hale studio (Linux)
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Extract the archive file
- name: Check formatting
run: |
mkdir -p hale-studio-linux-trivy
tar -xzf hale-studio-*linux*.tar.gz -C hale-studio-linux-trivy

- name: Run Trivy vulnerability scanner in rootfs mode
uses: aquasecurity/trivy-action@master
with:
scan-type: 'rootfs'
scan-ref: 'hale-studio-linux-trivy'
format: 'sarif'
severity: 'CRITICAL,HIGH'
output: 'trivy-results.sarif'
./gradlew spotlessCheck

- name: Upload Trivy SARIF report
uses: github/codeql-action/upload-sarif@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
with:
sarif_file: trivy-results.sarif
check:
uses: wetransform/gha-workflows/.github/workflows/gradle-library-check.yml@feat/multi-module-improvements
with:
java-version: 17
multi-module: true
skip-scan: true
gradle-tasks: '--continue clean check' # perform all tasks even if tests of one project fail
secrets:
WETF_ARTIFACTORY_USER: ${{ secrets.WETF_ARTIFACTORY_USER }}
WETF_ARTIFACTORY_PASSWORD: ${{ secrets.WETF_ARTIFACTORY_PASSWORD }}
161 changes: 12 additions & 149 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Publish

on:
Expand All @@ -10,153 +11,15 @@ concurrency:
# only run one publishing at a time to avoid conflicts
group: publish-${{ github.ref }}

# env:
# instead of embedded Maven use local Maven CLI
# HALE_BUILD_MAVEN_EMBEDDED: 'false'

jobs:
build:
# Only on main repository (don't publish on forks)
if: github.repository_owner == 'halestudio'

runs-on: ubuntu-latest

steps:
- name: Setup Maven
uses: s4u/setup-maven-action@2f53a7669c7543a045d0bb6c92436df0c5a726f8 # v1.14.0
# uses: stempler/setup-maven-action@feat/cache-save-always
with:
java-version: 17
java-distribution: temurin
maven-version: 3.9.6
# Note: currently not working because of https://github.com/actions/cache/issues/1315
# Fix in https://github.com/actions/cache/pull/1325 not merged yet
# cache-save-always: true

- name: Install genisoimage # required for Mac build
run: sudo apt-get install -y genisoimage

- name: Login to Docker Hub
uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 # v3.3.0
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}

- name: Clean
run: ./build.sh clean
working-directory: ./build

- name: Create hale-docker.conf file
run: |
mkdir -p ~/.hale
cat <<EOF > ~/.hale/hale-docker.conf
global {
dockerHost="unix:///var/run/docker.sock"
}
EOF

- name: Test
run: ./build.sh integrationStage
working-directory: ./build

- name: Product
run: |
./build.sh product --arch x86_64 --os linux HALE
./build.sh product --arch x86_64 --os windows HALE
./build.sh product --arch x86_64 --os macosx HALE
./build.sh product --arch x86_64 --os linux --publish Infocenter
working-directory: ./build

- name: Upload hale studio build (Linux)
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: hale studio (Linux)
path: build/target/hale-studio-*linux*.tar.gz
retention-days: 90

- name: Upload hale studio build (Windows)
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: hale studio (Windows)
path: build/target/hale-studio-*win32*.zip
retention-days: 90

- name: Upload hale studio build (macos)
uses: actions/upload-artifact@0b2256b8c012f0828dc542b3febcab082c67f72b # v4.3.4
with:
name: hale studio (macos)
path: build/target/hale-studio-*macosx*.dmg
retention-days: 90

- name: Install AWS CLI
uses: unfor19/install-aws-cli-action@e8b481e524a99f37fbd39fdc1dcb3341ab091367 # v1.0.7
with:
version: 1

- name: Update site
env:
AWS_ACCESS_KEY_ID: ${{ secrets.BUILD_ARCHIVE_ACCESS_KEY }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.BUILD_ARCHIVE_SECRET_KEY }}
run: ./upload-site.sh
working-directory: ./build

- name: Deploy Artifacts
env:
WETF_ARTIFACTORY_USER: ${{ secrets.WETF_ARTIFACTORY_USER }}
WETF_ARTIFACTORY_PASSWORD: ${{ secrets.WETF_ARTIFACTORY_PASSWORD }}
JAVA_TOOL_OPTIONS: '-Dmaven.wagon.httpconnectionManager.ttlSeconds=120'
run: ./build.sh deployArtifacts
working-directory: ./build

- name: Publish Test Report
uses: mikepenz/action-junit-report@db71d41eb79864e25ab0337e395c352e84523afe # v4.3.1
if: always() # always run even if the previous step fails
with:
# fail if there are no test results
require_tests: true

# Workaround for check that is additionally created being associated
# to the wrong workflow/run. Instead no additional check is created.
# See https://github.com/mikepenz/action-junit-report/issues/40
annotate_only: true
detailed_summary: true
report_paths: 'build/target/testReports/*.xml'

# https://github.com/marketplace/actions/slack-notify-build
- name: Notify failure to Slack
if: failure()
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
uses: voxmedia/github-action-slack-notify-build@3665186a8c1a022b28a1dbe0954e73aa9081ea9e # v1.6.0
with:
channel: build-failures
status: FAILED
color: danger

trivy:
needs: [build]
runs-on: ubuntu-latest
steps:
- name: Download hale studio build (Linux)
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: hale studio (Linux)

- name: Extract the archive file
run: |
mkdir -p hale-studio-linux-trivy
tar -xzf hale-studio-*linux*.tar.gz -C hale-studio-linux-trivy

- name: Run Trivy vulnerability scanner in rootfs mode
uses: aquasecurity/trivy-action@master
with:
scan-type: 'rootfs'
scan-ref: 'hale-studio-linux-trivy'
format: 'sarif'
severity: 'CRITICAL,HIGH'
output: 'trivy-results.sarif'

- name: Upload Trivy SARIF report
uses: github/codeql-action/upload-sarif@eb055d739abdc2e8de2e5f4ba1a8b246daa779aa # v3.26.0
with:
sarif_file: trivy-results.sarif
publish:
uses: wetransform/gha-workflows/.github/workflows/gradle-library-publish.yml@feat/multi-module-improvements
with:
java-version: 17
multi-module: true
skip-scan: true
build-tasks: 'clean spotlessCheck check'
secrets:
WETF_ARTIFACTORY_USER: ${{ secrets.WETF_ARTIFACTORY_USER }}
WETF_ARTIFACTORY_PASSWORD: ${{ secrets.WETF_ARTIFACTORY_PASSWORD }}
SLACK_NOTIFICATIONS_BOT_TOKEN: ${{ secrets.SLACK_NOTIFICATIONS_BOT_TOKEN }}
Loading
Loading