From 6cd9baf040cc4816551900a0dc71c8ec6d812cb2 Mon Sep 17 00:00:00 2001 From: Kelvin Lu Date: Sun, 25 Apr 2021 23:55:44 -0700 Subject: [PATCH 01/10] ci: longer timeout, break out lint checks to own yml --- .../{deploy_docs.yml => deploy-docs.yml} | 0 .github/workflows/lint.yml | 39 ++++++++++++++ .github/workflows/test.yml | 52 ++++++++----------- 3 files changed, 61 insertions(+), 30 deletions(-) rename .github/workflows/{deploy_docs.yml => deploy-docs.yml} (100%) create mode 100644 .github/workflows/lint.yml diff --git a/.github/workflows/deploy_docs.yml b/.github/workflows/deploy-docs.yml similarity index 100% rename from .github/workflows/deploy_docs.yml rename to .github/workflows/deploy-docs.yml diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml new file mode 100644 index 00000000..a0f9be13 --- /dev/null +++ b/.github/workflows/lint.yml @@ -0,0 +1,39 @@ +name: Lint + +on: [pull_request] + +jobs: + test: + strategy: + fail-fast: false + matrix: + node-version: [10.x, 12.x, 14.x] + os: [macOS-latest, ubuntu-18.04] + runs-on: ${{ matrix.os }} + + steps: + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: node_modules cache + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: | + run: yarn install --frozen-lockfile --network-timeout 300000 + + - name: Prettier check + run: | + yarn run lint:prettier + + - name: Eslint check + run: | + yarn run lint:eslint diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 48d524f9..dc86b859 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -8,36 +8,28 @@ jobs: fail-fast: false matrix: node-version: [10.x, 12.x, 14.x] - os: [macos-10.14, ubuntu-18.04] + os: [macOS-latest, ubuntu-18.04] runs-on: ${{ matrix.os }} steps: - - name: Check out Git repository - uses: actions/checkout@v2 - - - name: node_modules cache - uses: actions/cache@v2 - with: - path: '**/node_modules' - key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} - - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v1 - with: - node-version: ${{ matrix.node-version }} - - - name: yarn install - run: | - yarn install --frozen-lockfile - - - name: prettier check - run: | - yarn run lint:prettier - - - name: eslint check - run: | - yarn run lint:eslint - - - name: Build and run tests - run: | - make test + - name: Check out Git repository + uses: actions/checkout@v2 + + - name: node_modules cache + uses: actions/cache@v2 + with: + path: '**/node_modules' + key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }} + + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v1 + with: + node-version: ${{ matrix.node-version }} + + - name: Install dependencies + run: | + run: yarn install --frozen-lockfile --network-timeout 300000 + + - name: Build and run tests + run: | + make test From 103506a66c402e68a754cfb810dd3105fd49adc2 Mon Sep 17 00:00:00 2001 From: Kelvin Lu Date: Mon, 26 Apr 2021 00:02:13 -0700 Subject: [PATCH 02/10] fix: broken command --- .github/workflows/lint.yml | 6 +++--- .github/workflows/test.yml | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index a0f9be13..285da0f0 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,8 +7,8 @@ jobs: strategy: fail-fast: false matrix: - node-version: [10.x, 12.x, 14.x] - os: [macOS-latest, ubuntu-18.04] + node-version: 14.x + os: macOS-latest runs-on: ${{ matrix.os }} steps: @@ -28,7 +28,7 @@ jobs: - name: Install dependencies run: | - run: yarn install --frozen-lockfile --network-timeout 300000 + yarn install --frozen-lockfile --network-timeout 300000 - name: Prettier check run: | diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index dc86b859..964b5beb 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -28,7 +28,7 @@ jobs: - name: Install dependencies run: | - run: yarn install --frozen-lockfile --network-timeout 300000 + yarn install --frozen-lockfile --network-timeout 300000 - name: Build and run tests run: | From c296f997e45c0b8c5727da3f9fd963fcd1a18bdd Mon Sep 17 00:00:00 2001 From: Kelvin Lu Date: Mon, 26 Apr 2021 00:04:13 -0700 Subject: [PATCH 03/10] ci: have lint run on push as well --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 285da0f0..0440e94c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,9 +1,9 @@ name: Lint -on: [pull_request] +on: [push, pull_request] jobs: - test: + lint-check: strategy: fail-fast: false matrix: From 87de0833bc30998818d4275c98d1371e75cf077a Mon Sep 17 00:00:00 2001 From: Kelvin Lu Date: Mon, 26 Apr 2021 00:05:51 -0700 Subject: [PATCH 04/10] ci: fix lint yml --- .github/workflows/lint.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 0440e94c..2bb4c9e6 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -1,13 +1,13 @@ name: Lint -on: [push, pull_request] +on: pull_request jobs: lint-check: strategy: fail-fast: false matrix: - node-version: 14.x + node-version: [14.x] os: macOS-latest runs-on: ${{ matrix.os }} From 171b34376b38b2d6029e5f0b9b4e611a5c97b60d Mon Sep 17 00:00:00 2001 From: Kelvin Lu Date: Mon, 26 Apr 2021 00:06:33 -0700 Subject: [PATCH 05/10] ci: fix matrix --- .github/workflows/lint.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 2bb4c9e6..327253fe 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -8,7 +8,7 @@ jobs: fail-fast: false matrix: node-version: [14.x] - os: macOS-latest + os: [macOS-latest] runs-on: ${{ matrix.os }} steps: From 21de818dda83203bc3ddc8c562ab5ca960395ba7 Mon Sep 17 00:00:00 2001 From: Kelvin Lu Date: Mon, 26 Apr 2021 00:07:47 -0700 Subject: [PATCH 06/10] ci: add names --- .github/workflows/lint.yml | 1 + .github/workflows/test.yml | 1 + 2 files changed, 2 insertions(+) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index 327253fe..ce52fa1b 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -4,6 +4,7 @@ on: pull_request jobs: lint-check: + name: Check for ESLint + Prettier Violations strategy: fail-fast: false matrix: diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 964b5beb..6cccff4a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -4,6 +4,7 @@ on: [push, pull_request] jobs: test: + name: Execute full unit test suite strategy: fail-fast: false matrix: From 1bba0210755b334cffe2b8df5a5034d2b1a07399 Mon Sep 17 00:00:00 2001 From: Kelvin Lu Date: Mon, 26 Apr 2021 00:10:26 -0700 Subject: [PATCH 07/10] ci: unnecessary matrix + change to latest ubuntu --- .github/workflows/semantic-pr.yml | 2 +- .github/workflows/test.yml | 7 +------ 2 files changed, 2 insertions(+), 7 deletions(-) diff --git a/.github/workflows/semantic-pr.yml b/.github/workflows/semantic-pr.yml index bc42590b..d2c8aad3 100644 --- a/.github/workflows/semantic-pr.yml +++ b/.github/workflows/semantic-pr.yml @@ -7,7 +7,7 @@ on: jobs: pr-title-check: name: Check PR for semantic title - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - name: PR title is valid if: > diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6cccff4a..bda92222 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,12 +5,7 @@ on: [push, pull_request] jobs: test: name: Execute full unit test suite - strategy: - fail-fast: false - matrix: - node-version: [10.x, 12.x, 14.x] - os: [macOS-latest, ubuntu-18.04] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - name: Check out Git repository From 6e0c6ecbe3b546fc89429bf78d5b942f4891765b Mon Sep 17 00:00:00 2001 From: Kelvin Lu Date: Mon, 26 Apr 2021 00:11:16 -0700 Subject: [PATCH 08/10] ci: revert and change the *right* runs-on --- .github/workflows/lint.yml | 7 +------ .github/workflows/test.yml | 7 ++++++- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index ce52fa1b..2694a0bd 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -5,12 +5,7 @@ on: pull_request jobs: lint-check: name: Check for ESLint + Prettier Violations - strategy: - fail-fast: false - matrix: - node-version: [14.x] - os: [macOS-latest] - runs-on: ${{ matrix.os }} + runs-on: ubuntu-latest steps: - name: Check out Git repository diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index bda92222..6cccff4a 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,7 +5,12 @@ on: [push, pull_request] jobs: test: name: Execute full unit test suite - runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + node-version: [10.x, 12.x, 14.x] + os: [macOS-latest, ubuntu-18.04] + runs-on: ${{ matrix.os }} steps: - name: Check out Git repository From 1ec68159c596d5ae2d69d622e664ad5c644f4ee4 Mon Sep 17 00:00:00 2001 From: Kelvin Lu Date: Mon, 26 Apr 2021 00:14:47 -0700 Subject: [PATCH 09/10] ci: only run tests once --- .github/workflows/test.yml | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 6cccff4a..5f584f73 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,6 +1,13 @@ name: Test -on: [push, pull_request] +# https://github.community/t/how-to-trigger-an-action-on-push-or-pull-request-but-not-both/16662 +on: + push: + branches: + - main + pull_request: + branches: + - main jobs: test: From 7ff69c3904e241732eda439bcbd7363356c97788 Mon Sep 17 00:00:00 2001 From: Kelvin Lu Date: Wed, 28 Apr 2021 12:11:13 -0700 Subject: [PATCH 10/10] ci: all latest --- .github/workflows/deploy-docs.yml | 6 +++--- .github/workflows/release.yml | 12 ++++++------ .github/workflows/test.yml | 2 +- 3 files changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index e9ba5a38..e7f0a87a 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -3,9 +3,9 @@ name: Publish documentation on GitHub Pages on: workflow_dispatch jobs: - authorize: + authorize: name: Authorize - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - name: ${{ github.actor }} permission check to do a release uses: octokit/request-action@v2.0.0 @@ -17,7 +17,7 @@ jobs: gh-pages: name: Publish to GitHub Pages - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: [authorize] steps: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 23f736e1..3d7c4059 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,17 +1,17 @@ name: Release -on: +on: workflow_dispatch: inputs: dryRun: - description: 'Do a dry run to preview instead of a real release' + description: 'Do a dry run to preview instead of a real release' required: true default: 'true' jobs: - authorize: + authorize: name: Authorize - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest steps: - name: ${{ github.actor }} permission check to do a release uses: octokit/request-action@v2.0.0 @@ -23,7 +23,7 @@ jobs: release: name: Release - runs-on: ubuntu-18.04 + runs-on: ubuntu-latest needs: [authorize] env: GIT_AUTHOR_NAME: amplitude-sdk-bot @@ -66,7 +66,7 @@ jobs: - name: Run tests run: make test - - name: Release --dry-run # Uses release.config.js + - name: Release --dry-run # Uses release.config.js if: ${{ github.event.inputs.dryRun == 'true'}} env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 5f584f73..a74f39c9 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -16,7 +16,7 @@ jobs: fail-fast: false matrix: node-version: [10.x, 12.x, 14.x] - os: [macOS-latest, ubuntu-18.04] + os: [macOS-latest, ubuntu-latest] runs-on: ${{ matrix.os }} steps: