fix workflow #37
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 Test | |
on: | |
push: | |
paths-ignore: | |
- 'README.md' | |
workflow_dispatch: | |
inputs: | |
skip-build-image: | |
description: Skip building the builder image | |
type: boolean | |
default: false | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
jobs: | |
build-image: | |
name: Preapre builder image | |
runs-on: ubuntu-latest | |
if: ${{ !github.event.inputs.skip-build-image }} | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- uses: docker/setup-buildx-action@v3 | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- uses: docker/metadata-action@v5 | |
id: meta | |
with: | |
images: ghcr.io/${{ github.repository }}/builder | |
tags: | | |
type=raw,value=latest | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=sha | |
- name: Prepare container | |
uses: docker/build-push-action@v5 | |
with: | |
cache-from: type=gha | |
cache-to: type=gha,mode=max | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
push: true | |
pull: true | |
build: | |
name: Build and test | |
runs-on: ubuntu-latest | |
needs: build-image | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version-file: ".nvmrc" | |
- name: Build | |
run: docker compose up ci | |
- name: Install dependencies | |
run: corepack yarn install --immutable | |
- name: Run tests | |
run: corepack yarn test | |
- name: Create package tarball | |
run: corepack yarn pack -o libxmlwasm.tgz | |
- name: Upload package tarball | |
uses: actions/upload-artifact@v4 | |
with: | |
name: libxmlwasm.tgz | |
path: libxmlwasm.tgz |