From a76159e91fc126fb160a8532e762c872a75e8e50 Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 7 May 2021 14:19:30 -0700 Subject: [PATCH 01/11] Use more meaningful name for the test workflow "setup-taskflile" was an artifact of the project's previous home in the `arduino/actions` repo, which hosts multiple actions. In that case, it made some sense to have a single monolithic workflow for each project, named after the project. Now that the action has a dedicated repository. It is more useful to name the workflows according to their intended purpose. --- .../workflows/{setup-taskflile.yml => test-typescript-task.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{setup-taskflile.yml => test-typescript-task.yml} (97%) diff --git a/.github/workflows/setup-taskflile.yml b/.github/workflows/test-typescript-task.yml similarity index 97% rename from .github/workflows/setup-taskflile.yml rename to .github/workflows/test-typescript-task.yml index f55983a5..6eba40f0 100644 --- a/.github/workflows/setup-taskflile.yml +++ b/.github/workflows/test-typescript-task.yml @@ -1,4 +1,4 @@ -name: setup-taskfile workflow +name: Test TypeScript on: pull_request: From f7a19c992fe659b0d7507dde859c236325a0ce5d Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 7 May 2021 14:24:24 -0700 Subject: [PATCH 02/11] Add badge to readme for "Test TypeScript" workflow --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index d3b92e22..af1315e5 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,6 @@ # `arduino/setup-task` +[![Test TypeScript status](https://github.com/arduino/setup-task/actions/workflows/test-typescript-task.yml/badge.svg)](https://github.com/arduino/setup-task/actions/workflows/test-typescript-task.yml) [![Check TypeScript status](https://github.com/arduino/setup-task/actions/workflows/check-typescript-task.yml/badge.svg)](https://github.com/arduino/setup-task/actions/workflows/check-typescript-task.yml) [![Check TypeScript Configuration status](https://github.com/arduino/setup-task/actions/workflows/check-tsconfig.yml/badge.svg)](https://github.com/arduino/setup-task/actions/workflows/check-tsconfig.yml) [![Check npm status](https://github.com/arduino/setup-task/actions/workflows/check-npm.yml/badge.svg)](https://github.com/arduino/setup-task/actions/workflows/check-npm.yml) From d195d5f4f0d5780b527cfcca1a6b22f7bc3fc3cc Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 7 May 2021 14:25:36 -0700 Subject: [PATCH 03/11] Configure CI workflow to tun tests for macOS Previously, tests were only run on Ubuntu and Windows. --- .github/workflows/test-typescript-task.yml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-typescript-task.yml b/.github/workflows/test-typescript-task.yml index 6eba40f0..851877aa 100644 --- a/.github/workflows/test-typescript-task.yml +++ b/.github/workflows/test-typescript-task.yml @@ -10,7 +10,10 @@ jobs: strategy: matrix: - operating-system: [ubuntu-latest, windows-latest] + operating-system: + - macos-latest + - ubuntu-latest + - windows-latest steps: - name: Checkout From 5047717152501bf38e597d7c39e278787860705e Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 7 May 2021 14:27:58 -0700 Subject: [PATCH 04/11] Use major version refs of GitHub Actions actions Use of the major version ref will cause the workflow to use stable release versions of the utility actions while automatically benefiting from ongoing development to those actions up until such time as a new major release of an action is made. At that time we would need to evaluate whether any changes to the workflow are required by the breaking change that triggered the major release before updating the major ref (e.g., `uses: actions/checkout@v2` -> `uses: actions/checkout@v3`). --- .github/workflows/test-typescript-task.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/test-typescript-task.yml b/.github/workflows/test-typescript-task.yml index 851877aa..38ba5150 100644 --- a/.github/workflows/test-typescript-task.yml +++ b/.github/workflows/test-typescript-task.yml @@ -17,10 +17,10 @@ jobs: steps: - name: Checkout - uses: actions/checkout@master + uses: actions/checkout@v2 - name: Set Node.js 10.x - uses: actions/setup-node@master + uses: actions/setup-node@v2 with: version: 10.x From 8d2f9435e63db4bb08c1d55d21749846072ab557 Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 7 May 2021 14:31:36 -0700 Subject: [PATCH 05/11] Use supported actions/setup-node input name The `version` input name previously in use has been deprecated in favor of `node-version` and is no longer supported: https://github.com/actions/setup-node/blob/v2.1.5/action.yml#L27 --- .github/workflows/test-typescript-task.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-typescript-task.yml b/.github/workflows/test-typescript-task.yml index 38ba5150..644fe80e 100644 --- a/.github/workflows/test-typescript-task.yml +++ b/.github/workflows/test-typescript-task.yml @@ -22,7 +22,7 @@ jobs: - name: Set Node.js 10.x uses: actions/setup-node@v2 with: - version: 10.x + node-version: 10.x - name: Install Task uses: arduino/actions/setup-taskfile@master From 1d0268d14962d37781c7119b7c231df9262ad8f7 Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 7 May 2021 14:33:15 -0700 Subject: [PATCH 06/11] Use same Node.js version as the action environment for tests Node.js 12 is the newest version available for the JavaScript GitHub Actions actions, and is the one in use, as specified in action.yml's `runs.using` key. So it is best to use the same when running the tests in the CI workflow. --- .github/workflows/test-typescript-task.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/test-typescript-task.yml b/.github/workflows/test-typescript-task.yml index 644fe80e..232f979e 100644 --- a/.github/workflows/test-typescript-task.yml +++ b/.github/workflows/test-typescript-task.yml @@ -22,7 +22,7 @@ jobs: - name: Set Node.js 10.x uses: actions/setup-node@v2 with: - node-version: 10.x + node-version: 12.x - name: Install Task uses: arduino/actions/setup-taskfile@master From a4480827595f8ace2af37e2f3301b15cc91ddb11 Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 7 May 2021 14:40:27 -0700 Subject: [PATCH 07/11] Set up path filters for test workflow trigger The "Test TypeScript" workflow should only run when relevant files are modified. --- .github/workflows/test-typescript-task.yml | 26 +++++++++++++++++++++- 1 file changed, 25 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test-typescript-task.yml b/.github/workflows/test-typescript-task.yml index 232f979e..20a4a86c 100644 --- a/.github/workflows/test-typescript-task.yml +++ b/.github/workflows/test-typescript-task.yml @@ -1,8 +1,32 @@ name: Test TypeScript on: - pull_request: push: + paths: + - ".github/workflows/test-typescript-task.yml" + - "jest.config.js" + - "package.json" + - "package-lock.json" + - "Taskfile.yml" + - "tsconfig.json" + - "__tests__/**" + - "**.js" + - "**.jsx" + - "**.ts" + - "**.tsx" + pull_request: + paths: + - ".github/workflows/test-typescript-task.yml" + - "jest.config.js" + - "package.json" + - "package-lock.json" + - "Taskfile.yml" + - "tsconfig.json" + - "__tests__/**" + - "**.js" + - "**.jsx" + - "**.ts" + - "**.tsx" jobs: test: From a8f1259974959ecd7d9207707a8eac970f0fae1e Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 7 May 2021 14:41:11 -0700 Subject: [PATCH 08/11] Add additional trigger events to test workflow The `workflow_dispatch` event trigger allows the workflow to be run manually via the GitHub web interface. This can be useful to trigger the workflow run in cases where the standard triggers won't, such as testing how external changes (e.g., actions used in the workflow) affected it. The `repository_dispatch` event serves a similar purpose, except triggered via the GitHub API. --- .github/workflows/test-typescript-task.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-typescript-task.yml b/.github/workflows/test-typescript-task.yml index 20a4a86c..9c00f872 100644 --- a/.github/workflows/test-typescript-task.yml +++ b/.github/workflows/test-typescript-task.yml @@ -27,6 +27,8 @@ on: - "**.jsx" - "**.ts" - "**.tsx" + workflow_dispatch: + repository_dispatch: jobs: test: From 74e3fe1ed79fa987a284f44aad19af33a1ac42f0 Mon Sep 17 00:00:00 2001 From: per1234 Date: Fri, 7 May 2021 14:44:21 -0700 Subject: [PATCH 09/11] Configure test workflow to run all matrix jobs before failing The default behavior is to cancel all the other matrix jobs if one fails. However, it can often be valuable to see what the results are of the other jobs. In this case where the matrix is operating systems, it can be useful to see whether the problem is specific to one OS, or if it affects all. --- .github/workflows/test-typescript-task.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/test-typescript-task.yml b/.github/workflows/test-typescript-task.yml index 9c00f872..4d92c220 100644 --- a/.github/workflows/test-typescript-task.yml +++ b/.github/workflows/test-typescript-task.yml @@ -35,6 +35,8 @@ jobs: runs-on: ${{ matrix.operating-system }} strategy: + fail-fast: false + matrix: operating-system: - macos-latest From 29fafc759d43c58c84f5d92967fdf9d925ada70e Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 8 May 2021 03:57:05 -0700 Subject: [PATCH 10/11] Correct typo in workflow step name Copy/paste error. --- .github/workflows/check-npm.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check-npm.yml b/.github/workflows/check-npm.yml index 71671689..0cd4a2ce 100644 --- a/.github/workflows/check-npm.yml +++ b/.github/workflows/check-npm.yml @@ -41,7 +41,7 @@ jobs: # package.json schema is draft-04, which is not supported by ajv-cli >=4. run: sudo npm install --global ajv-cli@3.x - - name: Validate GitHub Actions workflows + - name: Validate package.json run: | # See: https://github.com/ajv-validator/ajv-cli#readme ajv validate \ From 0ede12fdecb877d882ae9f1426ab18ff9789c4d2 Mon Sep 17 00:00:00 2001 From: per1234 Date: Sat, 8 May 2021 13:32:36 -0700 Subject: [PATCH 11/11] Correct ts:install-deps description --- Taskfile.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Taskfile.yml b/Taskfile.yml index 42f9ac8e..d73dafeb 100644 --- a/Taskfile.yml +++ b/Taskfile.yml @@ -20,7 +20,7 @@ tasks: - task: general:check-spelling ts:install-deps: - desc: Install TypeScript development dependencies + desc: Install TypeScript dependencies cmds: - npm install