Skip to content

Nightly Build

Nightly Build #156

Workflow file for this run

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-natives:
name: Build native images
runs-on: ${{ matrix.os }}
needs: verify_commit
if: ${{ needs.verify_commit.outputs.RUN_BUILD == 'true' }}
strategy:
matrix:
os: [ windows-latest, ubuntu-latest, macos-latest, macos-13 ]
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: Build native images with nativ maven plugin and extract in tar.gz
shell: bash
run: |
cd cli
mvn -B -ntp -Pnative -P!include-docs -DskipTests=true package
- uses: actions/upload-artifact@v3
with:
name: natives
path: cli/target/*.tar.gz
build:
name: Build Project and Deploy
needs: [ build-natives, 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'
- uses: actions/download-artifact@v3
- name: Make natives available and build project
run: |
mvn -B -ntp -Dstyle.color=always install
mv ./natives/* ./cli/target/
- 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 -P deploy 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