| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138 |
- name: CI Build Major Branch
- permissions:
- contents: read
- actions: write
- on:
- push:
- branches: [master, develop, xap]
- workflow_dispatch:
- inputs:
- branch:
- type: choice
- description: "Branch to build"
- options: [master, develop, xap]
- env:
- # https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits
- # We've decreased it from 20 to 15 to allow for other GHA to run unimpeded
- CONCURRENT_JOBS: 15
- # Ensure we only have one build running at a time, cancelling any active builds if a new commit is pushed to the respective branch
- concurrency:
- group: ci_build-${{ github.event.inputs.branch || github.ref_name }}
- cancel-in-progress: true
- jobs:
- determine_concurrency:
- name: "Determine concurrency"
- if: github.repository == 'qmk/qmk_firmware'
- runs-on: ubuntu-latest
- container: ghcr.io/qmk/qmk_cli
- outputs:
- keymaps: ${{ steps.generate_slice_length.outputs.keymaps }}
- slice_length: ${{ steps.generate_slice_length.outputs.slice_length }}
- steps:
- - name: Disable safe.directory check
- run: |
- git config --global --add safe.directory '*'
- - name: Checkout QMK Firmware
- uses: actions/checkout@v7
- - name: Install dependencies
- run: pip3 install -r requirements-dev.txt
- - name: Determine concurrency
- id: generate_slice_length
- shell: 'bash {0}'
- run: |
- targets=()
- target_count=0
- for target in "default" "xap"; do
- count=$(qmk find -km $target 2>/dev/null | wc -l)
- if [ $count -gt 0 ]; then
- target_count=$(($target_count + $count))
- targets+=($target)
- fi
- done
- keymaps=$(jq -c -n '$ARGS.positional' --args "${targets[@]}")
- slice_length=$((target_count / ($CONCURRENT_JOBS - 1))) # Err on the side of caution
- echo "keymaps=$keymaps" >> $GITHUB_OUTPUT
- echo "slice_length=$slice_length" >> $GITHUB_OUTPUT
- build_targets:
- name: "Compile keymap ${{ matrix.keymap }}"
- needs: determine_concurrency
- strategy:
- fail-fast: false
- matrix:
- keymap: ${{ fromJson(needs.determine_concurrency.outputs.keymaps) }}
- uses: ./.github/workflows/ci_build_major_branch_keymap.yml
- with:
- branch: ${{ inputs.branch || github.ref_name }}
- keymap: ${{ matrix.keymap }}
- slice_length: ${{ needs.determine_concurrency.outputs.slice_length }}
- secrets: inherit
- rollup_tasks:
- name: "Consolidation"
- needs: build_targets
- runs-on: ubuntu-latest
- steps:
- - name: Disable safe.directory check
- run: |
- git config --global --add safe.directory '*'
- - name: Checkout QMK Firmware
- uses: actions/checkout@v7
- with:
- fetch-depth: 0
- - name: Download firmwares
- uses: actions/download-artifact@v8
- with:
- pattern: firmware-*
- path: .
- merge-multiple: true
- - name: Generate index page
- run: |
- python3 -m pip install -r ./util/ci/requirements.txt
- ./util/ci/index_generator.py > index.html
- ./util/ci/firmware_list_generator.py > firmware_list.json
- - name: Upload to https://ci.qmk.fm/${{ inputs.branch || github.ref_name }}/${{ github.sha }}
- uses: jakejarvis/s3-sync-action@master
- with:
- args: --acl public-read --follow-symlinks --delete --exclude '*' --include 'index.html' --include 'firmware_list.json' --include '*.hex' --include '*.bin' --include '*.uf2'
- env:
- AWS_S3_BUCKET: ${{ vars.CI_QMK_FM_SPACES_BUCKET }}
- AWS_ACCESS_KEY_ID: ${{ secrets.CI_QMK_FM_SPACES_KEY }}
- AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_QMK_FM_SPACES_SECRET }}
- AWS_REGION: ${{ vars.CI_QMK_FM_SPACES_REGION }}
- AWS_S3_ENDPOINT: ${{ vars.CI_QMK_FM_SPACES_ENDPOINT }}
- SOURCE_DIR: .
- DEST_DIR: ${{ inputs.branch || github.ref_name }}/${{ github.sha }}
- - name: Upload to https://ci.qmk.fm/${{ inputs.branch || github.ref_name }}/latest
- uses: jakejarvis/s3-sync-action@master
- with:
- args: --acl public-read --follow-symlinks --delete --exclude '*' --include 'index.html' --include 'firmware_list.json' --include '*.hex' --include '*.bin' --include '*.uf2'
- env:
- AWS_S3_BUCKET: ${{ vars.CI_QMK_FM_SPACES_BUCKET }}
- AWS_ACCESS_KEY_ID: ${{ secrets.CI_QMK_FM_SPACES_KEY }}
- AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_QMK_FM_SPACES_SECRET }}
- AWS_REGION: ${{ vars.CI_QMK_FM_SPACES_REGION }}
- AWS_S3_ENDPOINT: ${{ vars.CI_QMK_FM_SPACES_ENDPOINT }}
- SOURCE_DIR: .
- DEST_DIR: ${{ inputs.branch || github.ref_name }}/latest
- - name: Fail build if needed
- run: |
- # Exit with failure if the compilation stage failed
- [ ! -e .failed ] || exit 1
|