diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000..d8caab3 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,36 @@ +name: CI + +on: + push: + branches: [main] + pull_request: + workflow_dispatch: + +concurrency: + group: ci-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + quality: + name: Quality checks + runs-on: ubuntu-latest + timeout-minutes: 20 + + permissions: + contents: read + + steps: + - name: Checkout repository + uses: actions/checkout@v5 + + - name: Use Node.js 24 + uses: actions/setup-node@v5 + with: + node-version: 24 + cache: npm + + - name: Install dependencies + run: npm ci + + - name: Validate package and run Chromium tests + run: npm run validate:ci diff --git a/.github/workflows/npm-publish.yml b/.github/workflows/npm-publish.yml index 6c93e6c..ddde718 100644 --- a/.github/workflows/npm-publish.yml +++ b/.github/workflows/npm-publish.yml @@ -5,28 +5,36 @@ on: types: [published] workflow_dispatch: +concurrency: + group: npm-publish-${{ github.ref }} + cancel-in-progress: false + jobs: publish: + name: Publish package runs-on: ubuntu-latest + timeout-minutes: 10 + permissions: contents: read id-token: write steps: - - uses: actions/checkout@v4 + - name: Checkout repository + uses: actions/checkout@v5 - name: Use Node.js 24 - uses: actions/setup-node@v4 + uses: actions/setup-node@v5 with: node-version: 24 registry-url: https://registry.npmjs.org/ - cache: npm + package-manager-cache: false - name: Install dependencies run: npm ci - - name: Validate package - run: npm run validate + - name: Validate publish package + run: npm run validate:publish - name: Publish to npm run: npm publish --provenance --access public --ignore-scripts diff --git a/package.json b/package.json index bcf0637..8752a47 100644 --- a/package.json +++ b/package.json @@ -64,12 +64,21 @@ "scripts": { "check:no-hex-colors": "node ./scripts/check-no-hex-colors.mjs", "lint:css": "stylelint interactive-surface.css", + "test:install": "playwright install --with-deps chromium firefox webkit", + "test:install:chromium": "playwright install chromium --with-deps --only-shell", "test": "playwright test --config=./playwright.config.mjs", "test:chromium": "playwright test --config=./playwright.config.mjs --project=chromium", + "pack:dry": "npm pack --dry-run --cache ./.npm-cache", - "validate": "npm run check:no-hex-colors && npm run lint:css && npm run test:install && npm test && npm run pack:dry", - "prepublishOnly": "npm run check:no-hex-colors && npm run lint:css && npm run pack:dry", + + "validate:publish": "npm run check:no-hex-colors && npm run lint:css && npm run build && npm run pack:dry", + "validate:ci": "npm run validate:publish && npm run test:install:chromium && npm run test:chromium", + "validate:full": "npm run validate:publish && npm run test:install && npm test", + "validate": "npm run validate:ci", + + "prepublishOnly": "npm run validate:publish", + "bundle": "node ./scripts/build.mjs bundle", "minify": "node ./scripts/build.mjs minify", "build": "node ./scripts/build.mjs"