Nightly Build #26
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Nightly Build | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 2 * * *' | |
jobs: | |
verify_commit: | |
runs-on: ubuntu-latest | |
name: Verify latest commit | |
outputs: | |
RUN_BUILD: ${{ steps.verify_commit.outputs.RUN_BUILD }} | |
steps: | |
- uses: actions/checkout@v3 | |
- id: verify_commit | |
name: Verify latest commit is less than 24 hours | |
if: ${{ (github.event_name == 'schedule') || (github.event_name == 'workflow_dispatch') }} | |
run: echo '::set-output name=RUN_BUILD::'$(test -n "$(git log --format=%H --since='24 hours ago')" && echo 'true' || echo 'false') | |
build-documentation: | |
name: Build documentation | |
needs: [ verify_commit ] | |
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '17' | |
- name: Make documentation available | |
run: | | |
mvn -B -Pbuild-documentation -Dstyle.color=always -DskipTests=true package | |
- name: Upload documentation | |
uses: actions/upload-artifact@v4 | |
with: | |
name: docs | |
path: cli/target/package/*.pdf | |
build-natives: | |
name: Build native images | |
needs: [ verify_commit, build-documentation ] | |
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'true' }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
#os: [ windows-latest, ubuntu-latest, macos-latest, macos-13 ] | |
os: [ windows-latest ] | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- uses: graalvm/setup-graalvm@v1 | |
with: | |
java-version: '21.0.2' | |
distribution: 'graalvm' | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
native-image-job-reports: 'true' | |
- name: Download documentation | |
uses: actions/download-artifact@v4 | |
with: | |
name: docs | |
path: ./cli/target/package | |
- name: Build native image | |
shell: bash | |
run: | | |
cd cli | |
mvn -B -ntp -P${{ matrix.os }} '-P!build-documentation' -DskipTests=true package | |
- name: Upload natives | |
uses: actions/upload-artifact@v4 | |
with: | |
name: natives-${{ matrix.os }} | |
path: cli/target/*.tar.gz | |
deploy: | |
name: Build Project and Deploy | |
needs: [ verify_commit, build-documentation, build-natives ] | |
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'true' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
with: | |
submodules: recursive | |
- name: Set up JDK | |
uses: actions/setup-java@v1 | |
with: | |
java-version: '17' | |
- name: Download natives and build project | |
uses: actions/download-artifact@v4 | |
with: | |
pattern: natives-* | |
path: ./cli/target/ | |
merge-multiple: true | |
- run: | | |
mvn -B -ntp -Dstyle.color=always '-P!build-documentation' install | |
- name: Deploy to OSSRH nexus | |
env: | |
SONATYPE_USERNAME: ${{ secrets.SONATYPE_USERNAME }} | |
SONATYPE_PASSWORD: ${{ secrets.SONATYPE_PASSWORD }} | |
run: mvn --settings .mvn/settings.xml -DskipTests=true -Darchetype.test.skip=true -Dmaven.install.skip=true -Dgpg.skip=true -Dstyle.color=always -B -ntp -Pdeploy deploy | |
check_status: | |
runs-on: ubuntu-latest | |
needs: verify_commit | |
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'false' }} | |
steps: | |
- name: Check last workflow status | |
id: check_status | |
run: | | |
workflow_filename="nightly-build.yml" | |
last_workflow=$(curl -s -H "Authorization: token ${{ secrets.GITHUB_TOKEN }}" \ | |
"https://api.github.com/repos/${{ github.repository }}/actions/workflows/$workflow_filename/runs?per_page=1" | jq -r '.workflow_runs[0]') | |
conclusion=$(echo $last_workflow | jq -r '.conclusion') | |
echo "conclusion=$conclusion" >> $GITHUB_ENV | |
- name: Print and handle the status | |
run: | | |
echo "The status of the last workflow run is: ${{ env.conclusion }}" | |
if [ "${{ env.conclusion }}" != "success" ]; then | |
echo "The last workflow did not succeed. Failing this workflow." | |
exit 1 | |
else | |
echo "The last workflow succeeded. This workflow will succeed." | |
fi |