Skip to content

Move non-build tasks to dedicated GitHub Actions workflows #2569

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Nov 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 1 addition & 10 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -372,11 +372,6 @@ jobs:
IS_NIGHTLY: ${{ needs.build-type-determination.outputs.is-nightly }}
IS_RELEASE: ${{ needs.build-type-determination.outputs.is-release }}
CAN_SIGN: ${{ secrets[matrix.config.certificate-secret] != '' }}
# The CREATE_* environment vars are only used to run tests. These secrets are optional. Dependent tests will
# be skipped if not available.
CREATE_USERNAME: ${{ secrets.CREATE_USERNAME }}
CREATE_PASSWORD: ${{ secrets.CREATE_PASSWORD }}
CREATE_CLIENT_SECRET: ${{ secrets.CREATE_CLIENT_SECRET }}
working-directory: ${{ matrix.config.working-directory || './' }}
run: |
# See: https://www.electron.build/code-signing
Expand All @@ -390,13 +385,9 @@ jobs:
fi

npx node-gyp install
yarn install --immutable
yarn install

yarn --cwd arduino-ide-extension build
yarn test
yarn --cwd arduino-ide-extension test:slow
yarn --cwd arduino-ide-extension lint

yarn --cwd electron-app rebuild
yarn --cwd electron-app build
yarn --cwd electron-app package
Expand Down
88 changes: 88 additions & 0 deletions .github/workflows/check-javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# Source: https://github.com/arduino/tooling-project-assets/blob/main/workflow-templates/check-javascript-task.md
name: Check JavaScript

env:
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 18.17

# See: https://docs.github.com/actions/writing-workflows/choosing-when-your-workflow-runs/events-that-trigger-workflows
on:
create:
push:
paths:
- '.github/workflows/check-javascript.ya?ml'
- '**/.eslintignore'
- '**/.eslintrc*'
- '**/.npmrc'
- '**/package.json'
- '**/package-lock.json'
- '**/yarn.lock'
- '**.jsx?'
pull_request:
paths:
- '.github/workflows/check-javascript.ya?ml'
- '**/.eslintignore'
- '**/.eslintrc*'
- '**/.npmrc'
- '**/package.json'
- '**/package-lock.json'
- '**/yarn.lock'
- '**.jsx?'
workflow_dispatch:
repository_dispatch:

jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
- name: Determine if the rest of the workflow should run
id: determination
run: |
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
if [[
"${{ github.event_name }}" != "create" ||
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
]]; then
# Run the other jobs.
RESULT="true"
else
# There is no need to run the other jobs.
RESULT="false"
fi

echo "result=$RESULT" >> $GITHUB_OUTPUT

check:
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: yarn
node-version: ${{ env.NODE_VERSION }}

- name: Install npm package dependencies
env:
# Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn install

- name: Lint
run: |
yarn \
--cwd arduino-ide-extension \
lint
91 changes: 91 additions & 0 deletions .github/workflows/check-yarn.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
name: Check Yarn

# See: https://docs.github.com/en/actions/reference/events-that-trigger-workflows
on:
create:
push:
paths:
- ".github/workflows/check-yarn.ya?ml"
- "**/.yarnrc"
- "**/package.json"
- "**/package-lock.json"
- "**/yarn.lock"
pull_request:
paths:
- ".github/workflows/check-yarn.ya?ml"
- "**/.yarnrc"
- "**/package.json"
- "**/package-lock.json"
- "**/yarn.lock"
schedule:
# Run every Tuesday at 8 AM UTC to catch breakage resulting from changes to the JSON schema.
- cron: "0 8 * * TUE"
workflow_dispatch:
repository_dispatch:

jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
- name: Determine if the rest of the workflow should run
id: determination
run: |
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
if [[
"${{ github.event_name }}" != "create" ||
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
]]; then
# Run the other jobs.
RESULT="true"
else
# There is no need to run the other jobs.
RESULT="false"
fi

echo "result=$RESULT" >> $GITHUB_OUTPUT

check-sync:
name: check-sync (${{ matrix.project.path }})
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ubuntu-latest
permissions:
contents: read

strategy:
fail-fast: false
matrix:
project:
- path: .

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: yarn
node-version: ${{ env.NODE_VERSION }}

- name: Install npm package dependencies
env:
# Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn \
install \
--ignore-scripts

- name: Check yarn.lock
run: |
git \
diff \
--color \
--exit-code \
"${{ matrix.project.path }}/yarn.lock"
134 changes: 134 additions & 0 deletions .github/workflows/test-javascript.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,134 @@
name: Test JavaScript

env:
# See vars.GO_VERSION field of https://github.com/arduino/arduino-cli/blob/master/DistTasks.yml
GO_VERSION: '1.21'
# See: https://github.com/actions/setup-node/#readme
NODE_VERSION: 18.17

on:
push:
paths:
- ".github/workflows/test-javascript.ya?ml"
- "**/.mocharc.js"
- "**/.mocharc.jsonc?"
- "**/.mocharc.ya?ml"
- "**/package.json"
- "**/package-lock.json"
- "**/yarn.lock"
- "tests/testdata/**"
- "**/tsconfig.json"
- "**.[jt]sx?"
pull_request:
paths:
- ".github/workflows/test-javascript.ya?ml"
- "**/.mocharc.js"
- "**/.mocharc.jsonc?"
- "**/.mocharc.ya?ml"
- "**/package.json"
- "**/package-lock.json"
- "**/yarn.lock"
- "tests/testdata/**"
- "**/tsconfig.json"
- "**.[jt]sx?"
workflow_dispatch:
repository_dispatch:

jobs:
run-determination:
runs-on: ubuntu-latest
permissions: {}
outputs:
result: ${{ steps.determination.outputs.result }}
steps:
- name: Determine if the rest of the workflow should run
id: determination
run: |
RELEASE_BRANCH_REGEX="refs/heads/[0-9]+.[0-9]+.x"
# The `create` event trigger doesn't support `branches` filters, so it's necessary to use Bash instead.
if [[
"${{ github.event_name }}" != "create" ||
"${{ github.ref }}" =~ $RELEASE_BRANCH_REGEX
]]; then
# Run the other jobs.
RESULT="true"
else
# There is no need to run the other jobs.
RESULT="false"
fi

echo "result=$RESULT" >> $GITHUB_OUTPUT

test:
name: test (${{ matrix.project.path }}, ${{ matrix.operating-system }})
needs: run-determination
if: needs.run-determination.outputs.result == 'true'
runs-on: ${{ matrix.operating-system }}
defaults:
run:
shell: bash
permissions:
contents: read

strategy:
fail-fast: false
matrix:
project:
- path: .
operating-system:
- macos-latest
- ubuntu-latest
- windows-latest

steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Node.js
uses: actions/setup-node@v4
with:
cache: yarn
node-version: ${{ env.NODE_VERSION }}

# See: https://github.com/eclipse-theia/theia/blob/master/doc/Developing.md#prerequisites
- name: Install Python
uses: actions/setup-python@v5
with:
python-version: '3.11.x'

- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}

- name: Install Taskfile
uses: arduino/setup-task@v2
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
version: 3.x

- name: Install npm package dependencies
env:
# Avoid failure of @vscode/ripgrep installation due to GitHub API rate limiting:
# https://github.com/microsoft/vscode-ripgrep#github-api-limit-note
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
yarn install

- name: Compile TypeScript
run: |
yarn \
--cwd arduino-ide-extension \
build

- name: Run tests
env:
# These secrets are optional. Dependent tests will be skipped if not available.
CREATE_USERNAME: ${{ secrets.CREATE_USERNAME }}
CREATE_PASSWORD: ${{ secrets.CREATE_PASSWORD }}
CREATE_CLIENT_SECRET: ${{ secrets.CREATE_CLIENT_SECRET }}
run: |
yarn test
yarn \
--cwd arduino-ide-extension \
test:slow
4 changes: 3 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

# Arduino IDE 2.x

[![Arduino IDE](https://github.com/arduino/arduino-ide/workflows/Arduino%20IDE/badge.svg)](https://github.com/arduino/arduino-ide/actions?query=workflow%3A%22Arduino+IDE%22)
[![Build status](https://github.com/arduino/arduino-ide/actions/workflows/build.yml/badge.svg)](https://github.com/arduino/arduino-ide/actions/workflows/build.yml)
[![Check JavaScript status](https://github.com/arduino/arduino-ide/actions/workflows/check-javascript.yml/badge.svg)](https://github.com/arduino/arduino-ide/actions/workflows/check-javascript.yml)
[![Test JavaScript status](https://github.com/arduino/arduino-ide/actions/workflows/test-javascript.yml/badge.svg)](https://github.com/arduino/arduino-ide/actions/workflows/test-javascript.yml)

This repository contains the source code of the Arduino IDE 2.x. If you're looking for the old IDE, go to the [repository of the 1.x version](https://github.com/arduino/Arduino).

Expand Down
Loading