summaryrefslogtreecommitdiffstats
path: root/.github/workflows/ci_builds.yml
blob: 366b5e0ddee8f06c6d83f0741ed61f2dc26c72f2 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
name: CI Builds

permissions:
  contents: read

on:
  workflow_dispatch:
  schedule:
    - cron: '0 0,12 * * *'

jobs:
  ci_builds:
    if: github.repository == 'qmk/qmk_firmware'
    name: "CI Build"
    runs-on: self-hosted
    timeout-minutes: 1380

    strategy:
      fail-fast: false
      matrix:
        branch: [master, develop]
        keymap: [default, via]

    container: qmkfm/qmk_cli

    steps:
    - name: Disable safe.directory check
      run : git config --global --add safe.directory '*'

    - uses: actions/checkout@v3
      with:
        submodules: recursive
        ref: ${{ matrix.branch }}

    - name: Install dependencies
      run: pip3 install -r requirements.txt

    - name: Run `qmk mass-compile` (keymap ${{ matrix.keymap }})
      run: |
        export NCPUS=$(nproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || getconf _NPROCESSORS_ONLN 2>/dev/null)
        qmk mass-compile -t -j $NCPUS -km ${{ matrix.keymap }} -e DUMP_CI_METADATA=yes || touch .failed
        # Generate the step summary markdown
        ./util/ci/generate_failure_markdown.sh > $GITHUB_STEP_SUMMARY || true
        # Truncate to a maximum of 1MB to deal with GitHub workflow limit
        truncate --size='<960K' $GITHUB_STEP_SUMMARY || true
        # Exit with failure if the compilation stage failed
        [ ! -f .failed ] || exit 1

    - name: 'Upload artifacts'
      uses: actions/upload-artifact@v3
      if: always()
      with:
        name: artifacts-${{ matrix.branch }}-${{ matrix.keymap }}
        if-no-files-found: ignore
        path: |
          *.bin
          *.hex
          *.uf2
          .build/failed.*

    - name: 'CI Discord Notification'
      if: always()
      working-directory: util/ci/
      env:
        DISCORD_WEBHOOK: ${{ secrets.CI_DISCORD_WEBHOOK }}
      run: |
        python3 -m pip install -r requirements.txt
        python3 ./discord-results.py --branch ${{ matrix.branch }} --keymap ${{ matrix.keymap }} --url ${{ env.GITHUB_SERVER_URL }}/${{ env.GITHUB_REPOSITORY }}/actions/runs/${{ env.GITHUB_RUN_ID }}