From f8501cb3280be56f772205d1b03197239c6ff6cd Mon Sep 17 00:00:00 2001 From: Matthew Horan Date: Sun, 18 Feb 2024 20:34:41 -0500 Subject: [PATCH 01/20] Add lint and test workflow --- .github/workflows/check.yml | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 .github/workflows/check.yml diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml new file mode 100644 index 0000000..bec339f --- /dev/null +++ b/.github/workflows/check.yml @@ -0,0 +1,23 @@ +name: Lint and test + +on: + push: + branches: + - "main" + pull_request: + +jobs: + check: + name: Lint and test + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Node + uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn + - run: yarn install + - run: yarn lint + - run: yarn test + - run: yarn prettier --check From ebadb1cb8ff6a7f35cbcacffaf76815d03560633 Mon Sep 17 00:00:00 2001 From: Matthew Horan Date: Sun, 18 Feb 2024 20:40:55 -0500 Subject: [PATCH 02/20] Fix up the steps --- .github/workflows/check.yml | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index bec339f..a3f1910 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - check: + checkout-app: name: Lint and test runs-on: ubuntu-latest steps: @@ -18,6 +18,15 @@ jobs: node-version: 18 cache: yarn - run: yarn install + lint: + needs: checkout-app + steps: - run: yarn lint + test: + needs: checkout-app + steps: - run: yarn test + prettier: + needs: checkout-app + steps: - run: yarn prettier --check From e8c43bf515666595a0ec0394c3bf2be2f14865a2 Mon Sep 17 00:00:00 2001 From: Matthew Horan Date: Sun, 18 Feb 2024 20:42:29 -0500 Subject: [PATCH 03/20] More fixes --- .github/workflows/check.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index a3f1910..2c4ffb7 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -20,13 +20,16 @@ jobs: - run: yarn install lint: needs: checkout-app + runs-on: ubuntu-latest steps: - run: yarn lint test: needs: checkout-app + runs-on: ubuntu-latest steps: - run: yarn test prettier: needs: checkout-app + runs-on: ubuntu-latest steps: - run: yarn prettier --check From ebeb9bb7f214cd37c115e6e682121cc3cb66ddd6 Mon Sep 17 00:00:00 2001 From: Melissa Xie Date: Mon, 19 Feb 2024 11:16:49 -0500 Subject: [PATCH 04/20] Consolidate jobs into a single one --- .github/workflows/check.yml | 14 +------------- 1 file changed, 1 insertion(+), 13 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2c4ffb7..b9c121b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -18,18 +18,6 @@ jobs: node-version: 18 cache: yarn - run: yarn install - lint: - needs: checkout-app - runs-on: ubuntu-latest - steps: - run: yarn lint - test: - needs: checkout-app - runs-on: ubuntu-latest - steps: - - run: yarn test - prettier: - needs: checkout-app - runs-on: ubuntu-latest - steps: - run: yarn prettier --check + - run: yarn test From 6dc5a3085aa1f4d8664df7b97ac3220ffd80ae57 Mon Sep 17 00:00:00 2001 From: Melissa Xie Date: Mon, 19 Feb 2024 11:28:30 -0500 Subject: [PATCH 05/20] Keep going even if linters fail --- .github/workflows/check.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b9c121b..2f88c5f 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -19,5 +19,7 @@ jobs: cache: yarn - run: yarn install - run: yarn lint + continue-on-error: true - run: yarn prettier --check + continue-on-error: true - run: yarn test From ff57c68bbce8be45c0425b49d450199c48bb28e1 Mon Sep 17 00:00:00 2001 From: Melissa Xie Date: Mon, 19 Feb 2024 11:34:13 -0500 Subject: [PATCH 06/20] Try always on yarn test instead of continue-on-error for others --- .github/workflows/check.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 2f88c5f..acb8bf5 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -19,7 +19,6 @@ jobs: cache: yarn - run: yarn install - run: yarn lint - continue-on-error: true - run: yarn prettier --check - continue-on-error: true - run: yarn test + if: ${{ always() }} From 58f7af0e5b335a96d36e2cc0934f0b8cebc4930b Mon Sep 17 00:00:00 2001 From: Melissa Xie Date: Mon, 19 Feb 2024 12:22:26 -0500 Subject: [PATCH 07/20] Retry workflow with separate jobs --- .github/workflows/check.yml | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index acb8bf5..b070234 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -7,9 +7,9 @@ on: pull_request: jobs: - checkout-app: - name: Lint and test + defaults: runs-on: ubuntu-latest + install-dependencies: steps: - uses: actions/checkout@v4 - name: Set up Node @@ -18,7 +18,18 @@ jobs: node-version: 18 cache: yarn - run: yarn install + run-linter: + needs: install-dependencies + steps: + - uses: actions/checkout@v4 - run: yarn lint + run-linter: + needs: install-dependencies + steps: + - uses: actions/checkout@v4 - run: yarn prettier --check + run-linter: + needs: install-dependencies + steps: + - uses: actions/checkout@v4 - run: yarn test - if: ${{ always() }} From 7703227e2cc0bf561ca9a03dc7d9a62fb926ec66 Mon Sep 17 00:00:00 2001 From: Melissa Xie Date: Mon, 19 Feb 2024 12:23:07 -0500 Subject: [PATCH 08/20] Fix job IDs --- .github/workflows/check.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b070234..46bed4c 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -23,12 +23,12 @@ jobs: steps: - uses: actions/checkout@v4 - run: yarn lint - run-linter: + run-prettier: needs: install-dependencies steps: - uses: actions/checkout@v4 - run: yarn prettier --check - run-linter: + run-tests: needs: install-dependencies steps: - uses: actions/checkout@v4 From 8a33e3ebbcb41b0f65ea0f3d5718d7223097889f Mon Sep 17 00:00:00 2001 From: Melissa Xie Date: Mon, 19 Feb 2024 12:24:12 -0500 Subject: [PATCH 09/20] Pull defaults config out of `jobs` --- .github/workflows/check.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 46bed4c..f9e6b5d 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -6,9 +6,10 @@ on: - "main" pull_request: +defaults: + runs-on: ubuntu-latest + jobs: - defaults: - runs-on: ubuntu-latest install-dependencies: steps: - uses: actions/checkout@v4 From bcb22a8d28b3cc28c36b72e959e24b708221822f Mon Sep 17 00:00:00 2001 From: Melissa Xie Date: Mon, 19 Feb 2024 12:28:34 -0500 Subject: [PATCH 10/20] Set `runs-on` per job Because apparently `defaults` don't work the way I thought it would... --- .github/workflows/check.yml | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index f9e6b5d..5d0e589 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -6,11 +6,9 @@ on: - "main" pull_request: -defaults: - runs-on: ubuntu-latest - jobs: install-dependencies: + runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - name: Set up Node @@ -20,16 +18,19 @@ jobs: cache: yarn - run: yarn install run-linter: + runs-on: ubuntu-latest needs: install-dependencies steps: - uses: actions/checkout@v4 - run: yarn lint run-prettier: + runs-on: ubuntu-latest needs: install-dependencies steps: - uses: actions/checkout@v4 - run: yarn prettier --check run-tests: + runs-on: ubuntu-latest needs: install-dependencies steps: - uses: actions/checkout@v4 From 51f308dbea7b8351dc15e2ec46e4c90eeb8a700a Mon Sep 17 00:00:00 2001 From: Melissa Xie Date: Mon, 19 Feb 2024 12:35:04 -0500 Subject: [PATCH 11/20] Set up Node every time so that the cache is available --- .github/workflows/check.yml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 5d0e589..49ad95a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -11,8 +11,7 @@ jobs: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - name: Set up Node - uses: actions/setup-node@v4 + - uses: actions/setup-node@v4 with: node-version: 18 cache: yarn @@ -22,16 +21,28 @@ jobs: needs: install-dependencies steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn - run: yarn lint run-prettier: runs-on: ubuntu-latest needs: install-dependencies steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn - run: yarn prettier --check run-tests: runs-on: ubuntu-latest needs: install-dependencies steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn - run: yarn test From 66c5c5030c68db34273ad21bd07ca1c28b22765d Mon Sep 17 00:00:00 2001 From: Melissa Xie Date: Mon, 19 Feb 2024 12:37:58 -0500 Subject: [PATCH 12/20] Install dependencies everytime instead of setting up Node --- .github/workflows/check.yml | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 49ad95a..516b077 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -7,7 +7,7 @@ on: pull_request: jobs: - install-dependencies: + run-tests: runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -16,33 +16,18 @@ jobs: node-version: 18 cache: yarn - run: yarn install + - run: yarn test run-linter: runs-on: ubuntu-latest - needs: install-dependencies + needs: run-tests steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: yarn + - run: yarn install - run: yarn lint run-prettier: runs-on: ubuntu-latest - needs: install-dependencies + needs: run-tests steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: yarn + - run: yarn install - run: yarn prettier --check - run-tests: - runs-on: ubuntu-latest - needs: install-dependencies - steps: - - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 - with: - node-version: 18 - cache: yarn - - run: yarn test From c62f22a42bfb192398affdb635f5acd40ea65d68 Mon Sep 17 00:00:00 2001 From: Melissa Xie Date: Mon, 19 Feb 2024 12:46:23 -0500 Subject: [PATCH 13/20] Try setting up Node every time too in case that saves some seconds --- .github/workflows/check.yml | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index 516b077..f41e67b 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -22,6 +22,10 @@ jobs: needs: run-tests steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn - run: yarn install - run: yarn lint run-prettier: @@ -29,5 +33,9 @@ jobs: needs: run-tests steps: - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: 18 + cache: yarn - run: yarn install - run: yarn prettier --check From 44ee52721807edef447a4b9880c38c2d24c02517 Mon Sep 17 00:00:00 2001 From: Melissa Xie Date: Mon, 19 Feb 2024 13:01:10 -0500 Subject: [PATCH 14/20] Use better job names --- .github/workflows/check.yml | 16 ++++++++++------ 1 file changed, 10 insertions(+), 6 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index f41e67b..e460705 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -7,19 +7,22 @@ on: pull_request: jobs: - run-tests: + cache-and-test: + name: Cache and test runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 - - uses: actions/setup-node@v4 + - name: Set up Node and cache dependencies + uses: actions/setup-node@v4 with: node-version: 18 cache: yarn - run: yarn install - run: yarn test - run-linter: + linter: + name: Run linter runs-on: ubuntu-latest - needs: run-tests + needs: cache-and-run steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -28,9 +31,10 @@ jobs: cache: yarn - run: yarn install - run: yarn lint - run-prettier: + prettier: + name: Run prettier runs-on: ubuntu-latest - needs: run-tests + needs: cache-and-run steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From 0ccbd729ce46f0a10134b5b53e9434d0ab3857af Mon Sep 17 00:00:00 2001 From: Melissa Xie Date: Mon, 19 Feb 2024 13:01:47 -0500 Subject: [PATCH 15/20] Try jobs without `needs` --- .github/workflows/check.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index e460705..b0c6371 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -22,7 +22,6 @@ jobs: linter: name: Run linter runs-on: ubuntu-latest - needs: cache-and-run steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -34,7 +33,6 @@ jobs: prettier: name: Run prettier runs-on: ubuntu-latest - needs: cache-and-run steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From 1c789e35ed54bb180c829f4a94a4a571cff8a273 Mon Sep 17 00:00:00 2001 From: Matthew Horan Date: Mon, 19 Feb 2024 13:52:37 -0500 Subject: [PATCH 16/20] Run prettier against src --- .github/workflows/check.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b0c6371..f9dea6e 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -40,4 +40,4 @@ jobs: node-version: 18 cache: yarn - run: yarn install - - run: yarn prettier --check + - run: yarn prettier src --check From 2bb5963faf7afb17bfd4ce5e7956f6b13fe3a954 Mon Sep 17 00:00:00 2001 From: Matthew Horan Date: Mon, 19 Feb 2024 14:02:39 -0500 Subject: [PATCH 17/20] Depend on the cache-and-test job --- .github/workflows/check.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index f9dea6e..c69aaca 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -22,6 +22,7 @@ jobs: linter: name: Run linter runs-on: ubuntu-latest + needs: cache-and-test steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -33,6 +34,7 @@ jobs: prettier: name: Run prettier runs-on: ubuntu-latest + needs: cache-and-test steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 From ca47339afe6dedbd59925148cb74bd002656b71f Mon Sep 17 00:00:00 2001 From: Matthew Horan Date: Mon, 19 Feb 2024 14:07:09 -0500 Subject: [PATCH 18/20] Don't run yarn in subsequent steps --- .github/workflows/check.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c69aaca..b29a9e4 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -29,7 +29,6 @@ jobs: with: node-version: 18 cache: yarn - - run: yarn install - run: yarn lint prettier: name: Run prettier @@ -41,5 +40,4 @@ jobs: with: node-version: 18 cache: yarn - - run: yarn install - run: yarn prettier src --check From 55deb48d4aff777e22f1105a44c3875b3dd28350 Mon Sep 17 00:00:00 2001 From: Matthew Horan Date: Mon, 19 Feb 2024 14:11:06 -0500 Subject: [PATCH 19/20] Just kidding --- .github/workflows/check.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index b29a9e4..c69aaca 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -29,6 +29,7 @@ jobs: with: node-version: 18 cache: yarn + - run: yarn install - run: yarn lint prettier: name: Run prettier @@ -40,4 +41,5 @@ jobs: with: node-version: 18 cache: yarn + - run: yarn install - run: yarn prettier src --check From f84b9844dcb4b7cec9e20d66e7c9a79ebfb19fbb Mon Sep 17 00:00:00 2001 From: Matthew Horan Date: Mon, 19 Feb 2024 14:13:15 -0500 Subject: [PATCH 20/20] Allow errors for linting and prettier --- .github/workflows/check.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/check.yml b/.github/workflows/check.yml index c69aaca..f2e746a 100644 --- a/.github/workflows/check.yml +++ b/.github/workflows/check.yml @@ -23,6 +23,7 @@ jobs: name: Run linter runs-on: ubuntu-latest needs: cache-and-test + continue-on-error: true steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 @@ -35,6 +36,7 @@ jobs: name: Run prettier runs-on: ubuntu-latest needs: cache-and-test + continue-on-error: true steps: - uses: actions/checkout@v4 - uses: actions/setup-node@v4