Bump hectorm/wasm from 4d5b597
to 548c730
in the docker-all group
#374
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
# yaml-language-server: $schema=https://json.schemastore.org/github-workflow.json | |
name: "Main" | |
on: | |
push: | |
tags: ["*"] | |
branches: ["*"] | |
pull_request: | |
branches: ["*"] | |
schedule: | |
- cron: "25 12 * * 3" | |
workflow_dispatch: | |
permissions: {} | |
jobs: | |
build: | |
name: "Build" | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: "read" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" | |
- name: "Expose GitHub Actions variables" | |
uses: "actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea" | |
with: | |
script: | | |
for (const [k, v] of Object.entries(process.env)) { | |
if (k.startsWith("ACTIONS_")) core.exportVariable(k, v); | |
} | |
- name: "Set up Docker Buildx" | |
uses: "docker/setup-buildx-action@c47758b77c9736f4b2ef4073d4d51994fabfe349" | |
- name: "Use Node.js lts/*" | |
uses: "actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af" | |
with: | |
node-version: "lts/*" | |
cache: "npm" | |
- name: "Install dependencies" | |
run: "npm ci" | |
- name: "Build module" | |
run: "npm run build:wasm:docker -- --pull --cache-from type=gha --cache-to type=gha,mode=max" | |
- name: "Build types" | |
run: "npm run build:types" | |
- name: "Build docs" | |
run: "npm run docs" | |
- name: "Build demo" | |
run: | | |
cp -a ./dist/chafa.* ./demo/js/ | |
sed -ri 's|"[^"]+/(chafa\.js)"|"./\1"|' ./demo/js/worker.js | |
find ./demo/ -type f -not -perm 0644 -exec chmod 0644 '{}' '+' | |
find ./demo/ -type d -not -perm 0755 -exec chmod 0755 '{}' '+' | |
- name: "Lint" | |
run: "npm run lint" | |
- name: "Upload module artifact" | |
uses: "actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882" | |
with: | |
name: "dist" | |
path: "./dist/" | |
retention-days: 1 | |
- name: "Upload demo artifact" | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
uses: "actions/upload-pages-artifact@56afc609e74202658d3ffba0e8f6dda462b719fa" | |
with: | |
path: "./demo/" | |
retention-days: 1 | |
test-node: | |
name: "Test on Node.js ${{ matrix.node_version }} on ${{ matrix.os }}" | |
needs: ["build"] | |
runs-on: "${{ matrix.os }}" | |
permissions: | |
contents: "read" | |
strategy: | |
fail-fast: false | |
matrix: | |
node_version: ["lts/-1", "lts/*", "current"] | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" | |
- name: "Download module artifact" | |
uses: "actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16" | |
with: | |
name: "dist" | |
path: "./dist/" | |
- name: "Use Node.js ${{ matrix.node_version }}" | |
uses: "actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af" | |
with: | |
node-version: "${{ matrix.node_version }}" | |
cache: "npm" | |
- name: "Install dependencies" | |
run: "npm ci" | |
- name: "Test" | |
run: "npm run test:node" | |
test-deno: | |
name: "Test on Deno ${{ matrix.deno_version }} on ${{ matrix.os }}" | |
needs: ["build"] | |
runs-on: "${{ matrix.os }}" | |
permissions: | |
contents: "read" | |
strategy: | |
fail-fast: false | |
matrix: | |
deno_version: ["vx.x.x"] | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" | |
- name: "Download module artifact" | |
uses: "actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16" | |
with: | |
name: "dist" | |
path: "./dist/" | |
- name: "Use Deno ${{ matrix.deno_version }}" | |
uses: "denoland/setup-deno@4606d5cc6fb3f673efd4f594850e3f4b3e9d29cd" | |
with: | |
deno-version: "${{ matrix.deno_version }}" | |
- name: "Use Node.js lts/*" | |
uses: "actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af" | |
with: | |
node-version: "lts/*" | |
cache: "npm" | |
- name: "Install dependencies" | |
run: "npm ci" | |
- name: "Test" | |
run: "npm run test:deno" | |
test-bun: | |
name: "Test on Bun ${{ matrix.bun_version }} on ${{ matrix.os }}" | |
needs: ["build"] | |
runs-on: "${{ matrix.os }}" | |
permissions: | |
contents: "read" | |
strategy: | |
fail-fast: false | |
matrix: | |
bun_version: ["latest"] | |
os: ["ubuntu-latest", "windows-latest", "macos-latest"] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" | |
- name: "Download module artifact" | |
uses: "actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16" | |
with: | |
name: "dist" | |
path: "./dist/" | |
- name: "Use Bun ${{ matrix.bun_version }}" | |
uses: "oven-sh/setup-bun@4bc047ad259df6fc24a6c9b0f9a0cb08cf17fbe5" | |
with: | |
bun-version: "${{ matrix.bun_version }}" | |
- name: "Install dependencies" | |
run: "bun install --frozen-lockfile" | |
- name: "Test" | |
run: "bun run test:bun" | |
test-browser: | |
name: "Test on ${{ matrix.browser }} browser on ${{ matrix.os }}" | |
needs: ["build"] | |
runs-on: "${{ matrix.os }}" | |
permissions: | |
contents: "read" | |
strategy: | |
fail-fast: false | |
matrix: | |
browser: ["chromium", "firefox", "webkit"] | |
os: ["ubuntu-latest"] | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" | |
- name: "Download module artifact" | |
uses: "actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16" | |
with: | |
name: "dist" | |
path: "./dist/" | |
- name: "Use Node.js lts/*" | |
uses: "actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af" | |
with: | |
node-version: "lts/*" | |
cache: "npm" | |
- name: "Install dependencies" | |
run: 'npm ci && npx playwright install --with-deps "${{ matrix.browser }}"' | |
- name: "Test" | |
run: 'npm run test:browser:"${{ matrix.browser }}"' | |
publish-npm: | |
name: "Publish npm package" | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
needs: ["test-node", "test-deno", "test-bun", "test-browser"] | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: "read" | |
id-token: "write" | |
steps: | |
- name: "Checkout" | |
uses: "actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683" | |
- name: "Download module artifact" | |
uses: "actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16" | |
with: | |
name: "dist" | |
path: "./dist/" | |
- name: "Use Node.js lts/*" | |
uses: "actions/setup-node@39370e3970a6d050c480ffad4ff0ed4d3fdee5af" | |
with: | |
node-version: "lts/*" | |
registry-url: "https://registry.npmjs.org" | |
- name: "Publish" | |
env: | |
NODE_AUTH_TOKEN: "${{ secrets.NPM_TOKEN }}" | |
run: | | |
PKG_NAME="$(jq -r '.name' ./package.json)"; PKG_VERSION="$(jq -r '.version' ./package.json)" | |
if [ "$(npm view "${PKG_NAME:?}" versions --json | jq -r --arg v "${PKG_VERSION:?}" 'index($v)')" = 'null' ]; then | |
npm publish --provenance --access public | |
fi | |
publish-github-release: | |
name: "Publish GitHub release" | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
needs: ["test-node", "test-deno", "test-bun", "test-browser"] | |
runs-on: "ubuntu-latest" | |
permissions: | |
contents: "write" | |
steps: | |
- name: "Publish" | |
uses: "hectorm/ghaction-release@066200d04c3549852afa243d631ea3dc93390f68" | |
publish-github-pages: | |
name: "Publish GitHub Pages" | |
if: "startsWith(github.ref, 'refs/tags/v')" | |
needs: ["build", "test-node", "test-deno", "test-bun", "test-browser"] | |
runs-on: "ubuntu-latest" | |
permissions: | |
id-token: "write" | |
pages: "write" | |
environment: | |
name: "github-pages" | |
url: "${{ steps.deployment.outputs.page_url }}" | |
steps: | |
- name: "Publish" | |
id: "deployment" | |
uses: "actions/deploy-pages@d6db90164ac5ed86f2b6aed7e0febac5b3c0c03e" |