From 4405afc4e38bbcc4f918649d799923f9c77fdf97 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 26 Mar 2024 17:02:00 -0700 Subject: [PATCH 1/8] ci: automatically test on all LTS node with example for testing on extra versions --- .github/workflows/main.yml | 21 +++++++++++++++++++-- 1 file changed, 19 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c699a30..1d0a62a 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,17 +10,34 @@ on: jobs: build: - runs-on: ubuntu-latest + needs: [ get-lts ] + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest ] + node: ${{ fromJson(needs.get-lts.outputs.active) }} + # include: + # - node: 22 steps: - name: Checkout uses: actions/checkout@v4 - name: Set up Node.js uses: actions/setup-node@v4 with: - node-version-file: '.nvmrc' + node-version: ${{ matrix.node }} - name: Install dependencies run: npm install - name: Build run: npm run build - name: Test run: npm test + + get-lts: + runs-on: ubuntu-latest + steps: + - id: get + uses: msimerson/node-lts-versions@v1 + outputs: + lts: ${{ steps.get.outputs.lts }} + active: ${{ steps.get.outputs.active }} From 538a1a61e450667719922027d36208e229469e62 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 26 Mar 2024 17:13:36 -0700 Subject: [PATCH 2/8] add node 21, as an example --- .github/workflows/main.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 1d0a62a..43f8e90 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -16,9 +16,9 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest ] - node: ${{ fromJson(needs.get-lts.outputs.active) }} - # include: - # - node: 22 + node: + - ${{ fromJson(needs.get-lts.outputs.active) }} + - 22 steps: - name: Checkout uses: actions/checkout@v4 From daefa50c430afe4ff5a8a93c317a8fe49f199ba3 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 26 Mar 2024 17:17:14 -0700 Subject: [PATCH 3/8] ci: test windows too, for curiousity --- .github/workflows/main.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 43f8e90..e26c834 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -15,10 +15,10 @@ jobs: strategy: fail-fast: false matrix: - os: [ ubuntu-latest ] + os: [ ubuntu-latest, windows-latest ] node: - ${{ fromJson(needs.get-lts.outputs.active) }} - - 22 + - 21 steps: - name: Checkout uses: actions/checkout@v4 From 4f4fd03831ecc39c4854d95f87b885ecea7f76db Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 26 Mar 2024 17:34:17 -0700 Subject: [PATCH 4/8] ci: add coverage workflow --- .github/workflows/coverage.yml | 25 +++++++++++++++++++++++++ .nvmrc | 1 - 2 files changed, 25 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/coverage.yml delete mode 100644 .nvmrc diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml new file mode 100644 index 0000000..3accc11 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,25 @@ +on: + push: + paths-ignore: + - '*.md' + pull_request: + +env: + CI: true + NODE_ENV: cov + +jobs + coverage: + runs-on: ubuntu-latest + steps: + - uses: actions/setup-node@v4 + - uses: actions/checkout@v4 + - run: npm install + - name: run coverage + run: npx -y c8 --reporter=lcov npm test + - name: codecov + uses: codecov/codecov-action@v2 + - name: Coveralls + uses: coverallsapp/github-action@master + with: + github-token: ${{ secrets.github_token }} diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index 209e3ef..0000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -20 From a4b2241b294e11594f1e062497f009bd60e025ce Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 26 Mar 2024 17:34:53 -0700 Subject: [PATCH 5/8] yaml syntax --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 3accc11..fdec6ba 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -8,7 +8,7 @@ env: CI: true NODE_ENV: cov -jobs +jobs: coverage: runs-on: ubuntu-latest steps: From 721d87b370927aec9ed74cbaa6ea7a1274eb4f67 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 26 Mar 2024 17:37:12 -0700 Subject: [PATCH 6/8] add name --- .github/workflows/coverage.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index fdec6ba..5f37e67 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -1,3 +1,5 @@ +name: coverage + on: push: paths-ignore: From cb53f9392adda0385d033257f2080005b2bdc807 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 26 Mar 2024 17:39:41 -0700 Subject: [PATCH 7/8] use action v3 --- .github/workflows/coverage.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index 5f37e67..c5ae6a0 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -20,7 +20,7 @@ jobs: - name: run coverage run: npx -y c8 --reporter=lcov npm test - name: codecov - uses: codecov/codecov-action@v2 + uses: codecov/codecov-action@v3 - name: Coveralls uses: coverallsapp/github-action@master with: From 636ec243d0e909e3a854a5adbacf942336362d3c Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 26 Mar 2024 17:46:37 -0700 Subject: [PATCH 8/8] package.json: replace devDeps with npx --- package.json | 7 +------ 1 file changed, 1 insertion(+), 6 deletions(-) diff --git a/package.json b/package.json index b8b76fc..864e371 100644 --- a/package.json +++ b/package.json @@ -40,14 +40,9 @@ "punycode.es6.js" ], "scripts": { - "test": "mocha tests", + "test": "npx mocha tests", "build": "node scripts/prepublish.js" }, - "devDependencies": { - "codecov": "^3.8.3", - "nyc": "^15.1.0", - "mocha": "^10.2.0" - }, "jspm": { "map": { "./punycode.js": {