From 4708bae9abf83a3be017ed0eaa94f2bd373cef60 Mon Sep 17 00:00:00 2001 From: per1234 Date: Mon, 2 Oct 2023 18:10:37 -0700 Subject: [PATCH] Use separate attributes for human identifier and runner identifier in build job matrix The "Arduino IDE" GitHub Actions workflow uses a job matrix to make the builds for each host target in parallel. The same steps are used for each job, but some configuration adjustments must be made on a per-target basis. This is done through various attributes in the matrix configuration. Previously the `os` attribute was used for two distinct things: - The machine identifier of the GitHub Actions runner machine of the job. - The differentiator in the human-targeted job name. The attribute name "os" (for "operating system") was misleading because runners are differentiated by more than only the operating system on the machine. The use of a machine identifier as a differentiator in the human-targeted job name was a bad idea because these identifiers would only effectively communicate the nature of a build to humans who are quite knowledgeable about the GitHub Actions workflow syntax. The impact of these poor decisions has not been too severe previously due to there only being a single job for each operating system. However, there is a need for multiple jobs per operating system in order to support multiple host architectures (e.g., macOS x86 and ARM). The solution is to: - Use an appropriate name for the runner identifier attribute. - Use a dedicated attribute for the human friendly job name differentiator. --- .github/workflows/build.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index a444f83c..57266d1e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -61,24 +61,27 @@ jobs: echo "result=$RESULT" >> $GITHUB_OUTPUT build: - name: build (${{ matrix.config.os }}) + name: build (${{ matrix.config.name }}) needs: run-determination if: needs.run-determination.outputs.result == 'true' strategy: matrix: config: - - os: windows-2019 + - name: Windows # Human identifier for the job. + runs-on: windows-2019 certificate-secret: WINDOWS_SIGNING_CERTIFICATE_PFX # Name of the secret that contains the certificate. certificate-password-secret: WINDOWS_SIGNING_CERTIFICATE_PASSWORD # Name of the secret that contains the certificate password. certificate-extension: pfx # File extension for the certificate. - - os: ubuntu-20.04 - - os: macos-latest + - name: Linux + runs-on: ubuntu-20.04 + - name: macOS x86 + runs-on: macos-latest # APPLE_SIGNING_CERTIFICATE_P12 secret was produced by following the procedure from: # https://www.kencochrane.com/2020/08/01/build-and-sign-golang-binaries-for-macos-with-github-actions/#exporting-the-developer-certificate certificate-secret: APPLE_SIGNING_CERTIFICATE_P12 certificate-password-secret: KEYCHAIN_PASSWORD certificate-extension: p12 - runs-on: ${{ matrix.config.os }} + runs-on: ${{ matrix.config.runs-on }} timeout-minutes: 90 steps: