qmk_firmware

QMK firmware for my keyboards (Corne, Sweep Ferris) and trackball (Ploopy Adept)
Log | Files | Refs | Submodules | LICENSE

ci_build_major_branch.yml (4759B)


      1 name: CI Build Major Branch
      2 
      3 permissions:
      4   contents: read
      5   actions: write
      6 
      7 on:
      8   push:
      9     branches: [master, develop, xap]
     10   workflow_dispatch:
     11     inputs:
     12       branch:
     13         type: choice
     14         description: "Branch to build"
     15         options: [master, develop, xap]
     16 
     17 env:
     18   # https://docs.github.com/en/actions/learn-github-actions/usage-limits-billing-and-administration#usage-limits
     19   # We've decreased it from 20 to 15 to allow for other GHA to run unimpeded
     20   CONCURRENT_JOBS: 15
     21 
     22 # Ensure we only have one build running at a time, cancelling any active builds if a new commit is pushed to the respective branch
     23 concurrency:
     24   group: ci_build-${{ github.event.inputs.branch || github.ref_name }}
     25   cancel-in-progress: true
     26 
     27 jobs:
     28   determine_concurrency:
     29     name: "Determine concurrency"
     30     if: github.repository == 'qmk/qmk_firmware'
     31     runs-on: ubuntu-latest
     32     container: ghcr.io/qmk/qmk_cli
     33 
     34     outputs:
     35       slice_length: ${{ steps.generate_slice_length.outputs.slice_length }}
     36 
     37     steps:
     38       - name: Disable safe.directory check
     39         run: |
     40           git config --global --add safe.directory '*'
     41 
     42       - name: Checkout QMK Firmware
     43         uses: actions/checkout@v6
     44 
     45       - name: Install dependencies
     46         run: pip3 install -r requirements-dev.txt
     47 
     48       - name: Determine concurrency
     49         id: generate_slice_length
     50         run: |
     51           target_count=$( {
     52             qmk find -km default 2>/dev/null
     53             qmk find -km xap 2>/dev/null
     54           } | sort | uniq | wc -l)
     55           slice_length=$((target_count / ($CONCURRENT_JOBS - 1))) # Err on the side of caution
     56           echo "slice_length=$slice_length" >> $GITHUB_OUTPUT
     57 
     58   build_targets:
     59     name: "Compile keymap ${{ matrix.keymap }}"
     60     needs: determine_concurrency
     61     strategy:
     62       fail-fast: false
     63       matrix:
     64         keymap: [default, xap]
     65     uses: ./.github/workflows/ci_build_major_branch_keymap.yml
     66     with:
     67       branch: ${{ inputs.branch || github.ref_name }}
     68       keymap: ${{ matrix.keymap }}
     69       slice_length: ${{ needs.determine_concurrency.outputs.slice_length }}
     70     secrets: inherit
     71 
     72   rollup_tasks:
     73     name: "Consolidation"
     74     needs: build_targets
     75     runs-on: ubuntu-latest
     76 
     77     steps:
     78       - name: Disable safe.directory check
     79         run: |
     80           git config --global --add safe.directory '*'
     81 
     82       - name: Checkout QMK Firmware
     83         uses: actions/checkout@v6
     84         with:
     85           fetch-depth: 0
     86 
     87       - name: Download firmwares
     88         uses: actions/download-artifact@v7
     89         with:
     90           pattern: firmware-*
     91           path: .
     92           merge-multiple: true
     93 
     94       - name: Generate index page
     95         run: |
     96           python3 -m pip install -r ./util/ci/requirements.txt
     97           ./util/ci/index_generator.py > index.html
     98           ./util/ci/firmware_list_generator.py > firmware_list.json
     99 
    100       - name: Upload to https://ci.qmk.fm/${{ inputs.branch || github.ref_name }}/${{ github.sha }}
    101         uses: jakejarvis/s3-sync-action@master
    102         with:
    103           args: --acl public-read --follow-symlinks --delete --exclude '*' --include 'index.html' --include 'firmware_list.json' --include '*.hex' --include '*.bin' --include '*.uf2'
    104         env:
    105           AWS_S3_BUCKET: ${{ vars.CI_QMK_FM_SPACES_BUCKET }}
    106           AWS_ACCESS_KEY_ID: ${{ secrets.CI_QMK_FM_SPACES_KEY }}
    107           AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_QMK_FM_SPACES_SECRET }}
    108           AWS_REGION: ${{ vars.CI_QMK_FM_SPACES_REGION }}
    109           AWS_S3_ENDPOINT: ${{ vars.CI_QMK_FM_SPACES_ENDPOINT }}
    110           SOURCE_DIR: .
    111           DEST_DIR: ${{ inputs.branch || github.ref_name }}/${{ github.sha }}
    112 
    113       - name: Upload to https://ci.qmk.fm/${{ inputs.branch || github.ref_name }}/latest
    114         uses: jakejarvis/s3-sync-action@master
    115         with:
    116           args: --acl public-read --follow-symlinks --delete --exclude '*' --include 'index.html' --include 'firmware_list.json' --include '*.hex' --include '*.bin' --include '*.uf2'
    117         env:
    118           AWS_S3_BUCKET: ${{ vars.CI_QMK_FM_SPACES_BUCKET }}
    119           AWS_ACCESS_KEY_ID: ${{ secrets.CI_QMK_FM_SPACES_KEY }}
    120           AWS_SECRET_ACCESS_KEY: ${{ secrets.CI_QMK_FM_SPACES_SECRET }}
    121           AWS_REGION: ${{ vars.CI_QMK_FM_SPACES_REGION }}
    122           AWS_S3_ENDPOINT: ${{ vars.CI_QMK_FM_SPACES_ENDPOINT }}
    123           SOURCE_DIR: .
    124           DEST_DIR: ${{ inputs.branch || github.ref_name }}/latest
    125 
    126       - name: Check if failure marker file exists
    127         id: check_failure_marker
    128         uses: andstor/file-existence-action@v3
    129         with:
    130           files: ./.failed
    131 
    132       - name: Fail build if needed
    133         if: steps.check_failure_marker.outputs.files_exists == 'true'
    134         run: |
    135           # Exit with failure if the compilation stage failed
    136           exit 1