Skip to content

Merge pull request #204 from AFASSoftware/dependabot/github_actions/g… #96

Merge pull request #204 from AFASSoftware/dependabot/github_actions/g…

Merge pull request #204 from AFASSoftware/dependabot/github_actions/g… #96

Workflow file for this run

# This workflow will do a clean install of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://help.github.com/actions/language-and-framework-guides/using-nodejs-with-github-actions
name: Node.js CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
ci:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Use Node.js 20.x
uses: actions/setup-node@v6
with:
node-version: 20.x
cache: 'npm'
- run: npm ci
- run: npm run ci
- name: Publish to NPM if version in package.json has changed
id: publish
uses: JS-DevTools/npm-publish@v4
with:
token: ${{ secrets.NPM_TOKEN }}
provenance: true
- name: Create tag
if: steps.publish.outputs.type
uses: actions/github-script@v8
with:
script: |
github.rest.git.createRef({
owner: context.repo.owner,
repo: context.repo.repo,
ref: 'refs/tags/v${{ steps.publish.outputs.version }}',
sha: context.sha
})
- name: Create a Github Release when a version was published
if: steps.publish.outputs.type
uses: ncipollo/release-action@v1
with:
tag: v${{ steps.publish.outputs.version }}
name: v${{ steps.publish.outputs.version }}
makeLatest: true
get-playwright-version:
runs-on: ubuntu-latest
outputs:
version: ${{ steps.playwright-version.outputs.version }}
steps:
- uses: actions/checkout@v6
- name: Get Playwright version from package-lock.json
id: playwright-version
run: |
PLAYWRIGHT_VERSION=$(node -p "require('./package-lock.json').packages['node_modules/@playwright/test'].version")
echo "version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
browser-tests:
needs: get-playwright-version
runs-on: ubuntu-latest
container:
image: mcr.microsoft.com/playwright:v${{ needs.get-playwright-version.outputs.version }}-noble
steps:
- uses: actions/checkout@v6
- name: Install dependencies
run: npm ci
- name: Build maquette
run: npm run dist
- name: Install TodoMVC dependencies
working-directory: examples/todomvc
run: |
npm install --no-save bower
npx bower install --allow-root
- name: Run Playwright tests
working-directory: browser-tests
run: npm test
- name: Upload Playwright report
uses: actions/upload-artifact@v6
if: ${{ !cancelled() }}
with:
name: playwright-report
path: browser-tests/playwright-report/
retention-days: 30
permissions:
id-token: write
contents: write