From 430a343e96c36c38c660189d4af31a36d8c67495 Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Tue, 26 Mar 2024 17:02:00 -0700 Subject: [PATCH 1/4] ci: automatically test on all LTS node - with example for testing on extra versions - add node 21, as a "not LTS" example - ci: test windows too, for curiousity - ci: add coverage workflow - package.json: replace devDeps with npx --- .github/workflows/coverage.yml | 27 +++++++++++++++++++++++++++ .github/workflows/main.yml | 21 +++++++++++++++++++-- .nvmrc | 1 - package.json | 7 +------ 4 files changed, 47 insertions(+), 9 deletions(-) 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..fd3df39 --- /dev/null +++ b/.github/workflows/coverage.yml @@ -0,0 +1,27 @@ +name: coverage + +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@v3 + # - name: Coveralls + # uses: coverallsapp/github-action@master + # with: + # github-token: ${{ secrets.github_token }} diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index c699a30..e26c834 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, windows-latest ] + node: + - ${{ fromJson(needs.get-lts.outputs.active) }} + - 21 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 }} diff --git a/.nvmrc b/.nvmrc deleted file mode 100644 index 209e3ef..0000000 --- a/.nvmrc +++ /dev/null @@ -1 +0,0 @@ -20 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": { From 4ed6a079cb75dc7c4e83e52b035b9522ebb2821c Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Thu, 18 Apr 2024 08:56:48 -0700 Subject: [PATCH 2/4] revert removal of dev deps --- package.json | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/package.json b/package.json index 864e371..5f6eceb 100644 --- a/package.json +++ b/package.json @@ -43,6 +43,11 @@ "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": { From e5165f1056a7edaedbb093e59b90ec885f29569f Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Thu, 18 Apr 2024 09:09:16 -0700 Subject: [PATCH 3/4] ci: in GHA, use nyc as coverage reporter --- .github/workflows/coverage.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index fd3df39..e84f838 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -18,7 +18,8 @@ jobs: - uses: actions/checkout@v4 - run: npm install - name: run coverage - run: npx -y c8 --reporter=lcov npm test + run: npx -y nyc npm test + #run: npx -y c8 --reporter=lcov npm test - name: codecov uses: codecov/codecov-action@v3 # - name: Coveralls From 2f54a0ccd18c057f5d78fdddaf18df4acc7c776b Mon Sep 17 00:00:00 2001 From: Matt Simerson Date: Thu, 18 Apr 2024 09:14:50 -0700 Subject: [PATCH 4/4] dev: add .nyc_output to .gitignore --- .gitignore | 1 + 1 file changed, 1 insertion(+) diff --git a/.gitignore b/.gitignore index a67db4a..02c60a5 100644 --- a/.gitignore +++ b/.gitignore @@ -3,6 +3,7 @@ punycode.es6.js # Coverage report coverage +.nyc_output # Installed npm modules node_modules