From a4eeb1f1c10a9cca3de4c3ce427ed1d9f64188ce Mon Sep 17 00:00:00 2001 From: per1234 Date: Tue, 23 Aug 2022 20:56:41 -0700 Subject: [PATCH] Install Arduino CLI build dependencies in all dependent workflows Arduino CLI is a tool dependency of Arduino IDE. For this reason, the necessary Arduino CLI build is acquired whenever running the `yarn` command in the repository. The way the Arduino CLI build is acquired depends on the type of version specified as dependency in the `arduino.cli.version` field of the arduino-ide-extension package metadata: - Release/nightly: download pre-built standard distribution - Git ref: build from source This means that, in the latter case, all build dependencies of Arduino CLI must be present. While the Go module dependencies are automatically installed during the build, the build tool dependencies must be installed in advance: - Go programming language - Task task runner Arduino IDE's infrastructure was recently changed to use the Task tool to build Arduino CLI in the supported manner. A step to install Task was not added to some of the workflows that run `yarn`, which caused them to fail when a non-release version of Arduino CLI was used as a dependency: arduino-ide-extension: >>> Building the CLI... arduino-ide-extension: /bin/sh: 1: task: not found arduino-ide-extension: error Command failed with exit code 1. A step for the missing tool dependency is hereby added to those workflows. The lack of an explicit installation of the other dependency, Go did not result in an error because Go is pre-installed on the GitHub Actions runner. However, the installed version may not match the version Arduino CLI is intended to be built with and validated for, and the version provided by the runner may change at any time. For this reason, it will be safest to explicitly set up the appropriate version of Go in the workflows. --- .github/workflows/build.yml | 7 +++++++ .github/workflows/check-i18n-task.yml | 9 +++++++++ .github/workflows/i18n-nightly-push.yml | 15 +++++++++++++++ .github/workflows/i18n-weekly-pull.yml | 15 +++++++++++++++ .github/workflows/themes-weekly-pull.yml | 13 +++++++++++++ 5 files changed, 59 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 9db90ff52..e88645443 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -28,6 +28,8 @@ on: - cron: '0 3 * * *' # run every day at 3AM (https://docs.github.com/en/actions/reference/events-that-trigger-workflows#scheduled-events-schedule) env: + # See vars.GO_VERSION field of https://github.com/arduino/arduino-cli/blob/master/DistTasks.yml + GO_VERSION: "1.17" JOB_TRANSFER_ARTIFACT: build-artifacts CHANGELOG_ARTIFACTS: changelog @@ -66,6 +68,11 @@ jobs: with: python-version: '3.x' + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: ${{ env.GO_VERSION }} + - name: Install Taskfile uses: arduino/setup-task@v1 with: diff --git a/.github/workflows/check-i18n-task.yml b/.github/workflows/check-i18n-task.yml index 1ba1aca5c..36a290ed9 100644 --- a/.github/workflows/check-i18n-task.yml +++ b/.github/workflows/check-i18n-task.yml @@ -1,5 +1,9 @@ name: Check Internationalization +env: + # See vars.GO_VERSION field of https://github.com/arduino/arduino-cli/blob/master/DistTasks.yml + GO_VERSION: "1.17" + # See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows on: push: @@ -31,6 +35,11 @@ jobs: node-version: '14.x' registry-url: 'https://registry.npmjs.org' + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: ${{ env.GO_VERSION }} + - name: Install Taskfile uses: arduino/setup-task@v1 with: diff --git a/.github/workflows/i18n-nightly-push.yml b/.github/workflows/i18n-nightly-push.yml index 670cf3184..53e552674 100644 --- a/.github/workflows/i18n-nightly-push.yml +++ b/.github/workflows/i18n-nightly-push.yml @@ -1,5 +1,9 @@ name: i18n-nightly-push +env: + # See vars.GO_VERSION field of https://github.com/arduino/arduino-cli/blob/master/DistTasks.yml + GO_VERSION: "1.17" + on: schedule: # run every day at 1AM @@ -18,6 +22,17 @@ jobs: node-version: '14.x' registry-url: 'https://registry.npmjs.org' + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Install Task + uses: arduino/setup-task@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + - name: Install dependencies run: yarn diff --git a/.github/workflows/i18n-weekly-pull.yml b/.github/workflows/i18n-weekly-pull.yml index d6db2312c..b91bc2bca 100644 --- a/.github/workflows/i18n-weekly-pull.yml +++ b/.github/workflows/i18n-weekly-pull.yml @@ -1,5 +1,9 @@ name: i18n-weekly-pull +env: + # See vars.GO_VERSION field of https://github.com/arduino/arduino-cli/blob/master/DistTasks.yml + GO_VERSION: "1.17" + on: schedule: # run every monday at 2AM @@ -18,6 +22,17 @@ jobs: node-version: '14.x' registry-url: 'https://registry.npmjs.org' + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Install Task + uses: arduino/setup-task@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + - name: Install dependencies run: yarn diff --git a/.github/workflows/themes-weekly-pull.yml b/.github/workflows/themes-weekly-pull.yml index 8eb579674..41c159ea7 100644 --- a/.github/workflows/themes-weekly-pull.yml +++ b/.github/workflows/themes-weekly-pull.yml @@ -7,6 +7,8 @@ on: workflow_dispatch: env: + # See vars.GO_VERSION field of https://github.com/arduino/arduino-cli/blob/master/DistTasks.yml + GO_VERSION: "1.17" NODE_VERSION: 14.x jobs: @@ -22,6 +24,17 @@ jobs: node-version: ${{ env.NODE_VERSION }} registry-url: 'https://registry.npmjs.org' + - name: Install Go + uses: actions/setup-go@v3 + with: + go-version: ${{ env.GO_VERSION }} + + - name: Install Task + uses: arduino/setup-task@v1 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + version: 3.x + - name: Install dependencies run: yarn