workflows: Add nightly builds

CI build time has doubled due to GitHub Actions being limited to 20 parallel workflow runs, so only build the firmware for Release on a "nightly" schedule in order to halve the number of runs.

Also ignore markdown documentation changes and allow manual dispatch.
This commit is contained in:
Mario Bălănică
2023-06-25 01:15:06 +03:00
parent 7083c37b9c
commit a4b551c603
3 changed files with 62 additions and 10 deletions

View File

@@ -1,12 +1,21 @@
name: Build
on:
push:
paths-ignore:
- '**.md'
branches:
- master
pull_request:
paths-ignore:
- '**.md'
branches:
- master
workflow_call:
inputs:
build-configs:
type: string
required: true
workflow_dispatch:
jobs:
build:
@@ -26,13 +35,13 @@ jobs:
- edge2
- nanopc-t6
# - rk3588-evb is currently failing
CONFIGURATION: [Debug, Release]
CONFIGURATION: ${{ fromJSON(format('[{0}]', inputs.build-configs || '"Debug"')) }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install dependencies
shell: bash
run: |
@@ -48,18 +57,18 @@ jobs:
libc6-dev-arm64-cross \
python3 \
python3-pyelftools
- name: Get version tag
id: get_version_tag
shell: bash
run: echo "version=$(git describe --tags --always)" >> $GITHUB_OUTPUT
- name: Build platform
shell: bash
run: |
run: |
./build.sh --device ${{matrix.PLATFORM}} --release ${{matrix.CONFIGURATION}}
mv RK3588_NOR_FLASH.img ${{matrix.PLATFORM}}_UEFI_${{matrix.CONFIGURATION}}_${{steps.get_version_tag.outputs.version}}.img
- name: Upload artifact
uses: actions/upload-artifact@v3
with:

41
.github/workflows/nightly.yml vendored Normal file
View File

@@ -0,0 +1,41 @@
name: Nightly
run-name: Nightly build
on:
schedule:
- cron: "0 0 * * *"
jobs:
prepare:
runs-on: ubuntu-latest
permissions:
actions: write
steps:
- name: Delete previous cancelled runs
uses: Mattraks/delete-workflow-runs@v2
with:
retain_days: 0
keep_minimum_runs: 0
delete_workflow_pattern: ${{ github.workflow }}
delete_run_by_conclusion_pattern: cancelled
- name: Check for new commits
id: check-new-commits
uses: adriangl/check-new-commits-action@v1
with:
seconds: 86400 # One day in seconds
branch: 'master'
- name: Cancel action if no new commits
if: ${{ steps.check-new-commits.outputs.has-new-commits != 'true' }}
uses: andymckay/cancel-action@0.3
- name: Wait for cancellation
if: ${{ steps.check-new-commits.outputs.has-new-commits != 'true' }}
shell: bash
run: while true; do echo "Waiting for job to be cancelled"; sleep 5; done
build_for_nightly:
needs: prepare
uses: ./.github/workflows/build.yml
with:
build-configs: '"Debug", "Release"'

View File

@@ -1,13 +1,15 @@
name: Release
on:
on:
push:
tags:
- '*'
jobs:
build_for_release:
uses: ./.github/workflows/build.yml
with:
build-configs: '"Debug", "Release"'
release:
runs-on: ubuntu-latest
needs: build_for_release
@@ -16,7 +18,7 @@ jobs:
steps:
- name: Download all workflow run artifacts
uses: actions/download-artifact@v3
- name: Create release
uses: softprops/action-gh-release@v1
with: