Skip to content

Commit

Permalink
ci: Use npx to execute jshint and c8
Browse files Browse the repository at this point in the history
  • Loading branch information
lauriro committed Jun 21, 2024
1 parent 03b67fa commit f9f028b
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 13 deletions.
45 changes: 35 additions & 10 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,44 +8,69 @@ jobs:
with:
submodules: recursive
- uses: actions/setup-node@v4
- run: npm install && npm i -g c8
- run: c8 -r lcov -r text npm test
- run: npm install --no-audit
- run: npm audit --audit-level=low
- run: npx c8 -r lcovonly -r text --check-coverage --100 npm test
- run: node --import=@litejs/cli/test.js test/load.mjs
- run: npm run lint
- uses: coverallsapp/github-action@master
- uses: coverallsapp/github-action@v2
name: Upload to coveralls.io
with:
github-token: ${{ github.token }}
Test:
strategy:
matrix:
include:
- { node: 8, os: windows-latest, arch: x86 }
- { node: 12, os: macos-latest, arch: x64 }
- { node: 16, os: ubuntu-latest, arch: x64 }
runs-on: ${{ matrix.os }}
name: Node ${{matrix.node}} (${{matrix.os}} ${{matrix.arch}})
steps:
- run: git config --global core.autocrlf false
- uses: actions/checkout@v4
with:
submodules: recursive
- uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node }}
architecture: ${{ matrix.arch }}
- run: npm install --no-audit
- run: npm test
Analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: github/codeql-action/init@v2
- uses: github/codeql-action/init@v3
with:
languages: javascript
- uses: github/codeql-action/analyze@v2
- uses: github/codeql-action/analyze@v3
with:
category: /language:javascript
Release:
if: startsWith(github.ref, 'refs/tags/v')
needs: [Analyze, Coverage]
needs: [Analyze, Coverage, Test]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- run: |
echo '${{ vars.RELEASE_SIGNERS }}' > ./allowed_signers
git config gpg.ssh.allowedSignersFile ./allowed_signers
git verify-tag -v ${{ github.ref_name }}
name: Verify release tag signature
- uses: actions/setup-node@v4
with:
registry-url: https://registry.npmjs.org/
- run: |
gh release create $TAG --title $TAG --notes "$(git tag -l --format='%(subject)%0a%0a%(body)' $TAG)"
gh release create $TAG --title $TAG --notes "$(git tag -l --format='%(subject)%0a%0a%(contents:body)' $TAG)"
gh run list --json databaseId -q '.[20:]|.[].databaseId' --limit 100 | xargs -I{} gh run delete "{}"
[[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "PUBLISH=true" >> $GITHUB_ENV
[[ "$TAG" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]] && echo "PUBLISH=latest" >> $GITHUB_ENV || echo "PUBLISH=next" >> $GITHUB_ENV
env:
GH_TOKEN: ${{ github.token }}
TAG: ${{ github.ref_name }}
- run: npm publish --access public
if: env.PUBLISH == 'true'
- run: npm publish --access public --tag $PUBLISH
env:
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}

5 changes: 2 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,10 @@
"files": [],
"repository": "github:litejs/uri-template-lite",
"scripts": {
"lint": "jshint --config .github/jshint.json *.js",
"lint": "npx jshint -c .github/jshint.json *.js",
"test": "lj t --brief test/index.js"
},
"devDependencies": {
"@litejs/cli": "23.12.0",
"jshint": "2.13.6"
"@litejs/cli": "23.12.0"
}
}

0 comments on commit f9f028b

Please sign in to comment.