ci: add junit reporter #27
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: Build and release | |
on: | |
push: | |
branches: [main] | |
pull_request: | |
branches: [main] | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.13.0 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: v1-npm-deps- | |
- run: npm ci | |
- run: npm run lint | |
- run: npm run test:ci | |
- uses: mikepenz/action-junit-report@v4 | |
if: success() || failure() | |
with: | |
report_paths: "**/reports/junit.xml" | |
build: | |
needs: test | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.13.0 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: v1-npm-deps- | |
- run: npm ci | |
- run: npm run build | |
github-pages: | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Pages | |
uses: actions/configure-pages@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.13.0 | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: v1-npm-deps- | |
- run: npm ci | |
- run: npm run build | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: "dist" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 | |
# Deploy to npm | |
release: | |
if: github.ref == 'refs/heads/main' | |
needs: build | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
id-token: write | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.13.0 | |
registry-url: https://registry.npmjs.org/ | |
- uses: actions/cache@v3 | |
with: | |
path: ~/.npm | |
key: v1-npm-deps-${{ hashFiles('**/package-lock.json') }} | |
restore-keys: v1-npm-deps- | |
- run: npm ci | |
- run: npm run build | |
- run: git config user.email "${{ vars.NPM_EMAIL }}" | |
- run: git config user.name "${{ vars.NPM_USER }}" | |
- run: npm run release | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |