Add test coverage #38
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests and publish to NPM | |
on: | |
pull_request: | |
branches: | |
- master | |
jobs: | |
test-build-prettier: | |
name: Build, Test and check prettier | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x, 20.x] | |
concurrency: | |
group: tests-${{ github.ref }}-${{ matrix.node-version }} | |
cancel-in-progress: true | |
steps: | |
- name: Checkout Repo | |
uses: actions/checkout@v3 | |
- name: Setup Node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: "npm" | |
- name: Install | |
run: npm ci | |
- name: Build | |
run: | | |
npm run build | |
- name: Run Jest Test | |
run: | | |
npm run test | |
- name: Upload coverage reports to Codecov | |
uses: codecov/codecov-action@v3 | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
- name: Run Prettier | |
run: | | |
npm run lint:prettier | |
- name: Run with txt sitemap | |
run: | | |
node dist/src/index.js https://www.advancedhtml.co.uk/sitemap.txt -p 3 | |
- name: Run with xml with final links | |
run: | | |
node dist/src/index.js https://www.profiq.com/wp-sitemap-posts-job-1.xml -t 4500 | |
- name: Run with xml with nested links | |
run: | | |
node dist/src/index.js https://movingfast.tech/sitemap.xml -w | |
publish-npm: | |
name: "Publish next version to npm" | |
needs: test-build-prettier | |
uses: ./.github/workflows/publish.yaml | |
with: | |
TAG: next | |
UPDATE_VERSION: true | |
secrets: inherit |