summaryrefslogtreecommitdiff
path: root/.github/workflows/ci.yml
blob: 43f4c6cc31e786ffab1e7d33b29ba4cb363fdba1 (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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
name: CI
on: [ pull_request, push, workflow_dispatch ]

concurrency:
  group: ${{ github.workflow }}-${{ github.ref }}
  cancel-in-progress: true

env:
  REGEX_ANSI_COLOR: 's/\x1b\[[0-9;]*[mGKHF]//g'
  REGEX_MAKE_OUTPUT: '/^g*make\[1]: \(Enter\|Leav\)ing directory ''/d'

permissions: {}

jobs:
  check-uid:
    name: Check Vial UIDs
    runs-on: ubuntu-latest

    steps:
    - name: (actions) Checkout Vial repo
      uses: actions/checkout@v4
      with:
        persist-credentials: false

    - name: Verify Vial UID is unique per-keyboard
      run: python3 util/ci_vial_verify_uid.py

  build-default:
    name: Build default keymaps for Vial
    runs-on: ubuntu-latest
    container: ghcr.io/qmk/qmk_cli@sha256:16c4916e95b99bf88d27b15aec8db409ee17265d1710287fde248c6666508966
    env:
      KEYMAP: default

    steps:
    - name: (actions) Checkout Vial repo
      uses: actions/checkout@v4
      with:
        persist-credentials: false
        submodules: recursive

    - name: Build
      id: build
      run: |
        git config --global --add safe.directory $(pwd)
        if ! qmk mass-compile -j $(nproc) $(qmk find -km vial | sed "s/:vial$/:${KEYMAP}/");
          then
          echo "::error::$(ls -1 .build/failed.log.* | wc -l) keymaps failed to build. See logs and/or job summary for details."
          exit 1
        fi

    - name: Dump failure logs
      if: ${{ failure() && steps.build.conclusion == 'failure' }}
      run: |
        echo '### Failure logs' | tee -a "${GITHUB_STEP_SUMMARY}"

        cd .build || exit 1
        for log in failed.log.*; do
          pretty_logname="$(echo "${log}" | sed "s/^failed\.log\.[0-9]\+\.// ; s/\.${KEYMAP}$//")"

          printf '\n::group::%s\n%s\n::endgroup::\n' "${pretty_logname}" "$(sed "${REGEX_MAKE_OUTPUT}" < "${log}")"
          printf '\n<details>\n<summary>%s</summary>\n\n```\n%s\n```\n\n</details>\n' \
             "${pretty_logname}" "$(sed "${REGEX_MAKE_OUTPUT} ; ${REGEX_ANSI_COLOR}" < "${log}")" >> "${GITHUB_STEP_SUMMARY}"
        done

  build-vial:
    name: Build Vial keymaps
    runs-on: ubuntu-latest
    container: ghcr.io/qmk/qmk_cli@sha256:16c4916e95b99bf88d27b15aec8db409ee17265d1710287fde248c6666508966
    env:
      KEYMAP: vial

    steps:
    - name: (actions) Checkout Vial repo
      uses: actions/checkout@v4
      with:
        persist-credentials: false
        submodules: recursive

    - name: Build
      id: build
      run: |
        git config --global --add safe.directory $(pwd)
        if ! qmk mass-compile -km "${KEYMAP}" -j $(nproc);
          then
          echo "::error::$(ls -1 .build/failed.log.* | wc -l) keymaps failed to build. See logs and/or job summary for details."
          exit 1
        fi

    - name: Dump failure logs
      if: ${{ failure() && steps.build.conclusion == 'failure' }}
      run: |
        echo '### Failure logs' | tee -a "${GITHUB_STEP_SUMMARY}"

        cd .build || exit 1
        for log in failed.log.*; do
          pretty_logname="$(echo "${log}" | sed "s/^failed\.log\.[0-9]\+\.// ; s/\.${KEYMAP}$//")"

          printf '\n::group::%s\n%s\n::endgroup::\n' "${pretty_logname}" "$(sed "${REGEX_MAKE_OUTPUT}" < "${log}")"
          printf '\n<details>\n<summary>%s</summary>\n\n```\n%s\n```\n\n</details>\n' \
            "${pretty_logname}" "$(sed "${REGEX_MAKE_OUTPUT} ; ${REGEX_ANSI_COLOR}" < "${log}")" >> "${GITHUB_STEP_SUMMARY}"
        done