fix error parser and add unit test #42
Workflow file for this run
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: Create tagged release | |
on: | |
push: | |
tags: | |
- 'v*' | |
jobs: | |
create_release: | |
runs-on: ubuntu-latest | |
outputs: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
steps: | |
- | |
name: Create Release | |
id: create_release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: Release ${{ github.ref }} | |
draft: false | |
prerelease: false | |
build-cli: | |
runs-on: ubuntu-latest | |
needs: | |
- create_release | |
steps: | |
- | |
name: Action Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Setup Golang | |
uses: actions/setup-go@v4 | |
with: | |
go-version: '1.21' | |
- | |
name: Test | |
run: go test -v . | |
- | |
name: Build | |
run: /usr/bin/env bash ./cmd/mcla/build.sh -ldflags="-X 'main.version=${GITHUB_REF#refs/*/}'" | |
- | |
name: Upload Release Assets | |
uses: zyxkad/upload-release-asset-dir@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_dir: ./output | |
build-wasm: | |
runs-on: ubuntu-latest | |
steps: | |
- | |
name: Action Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Setup Tinygo | |
uses: acifani/setup-tinygo@v1 | |
with: | |
tinygo-version: '0.30.0' | |
- | |
name: Build wasm | |
run: | | |
mkdir output | |
/usr/bin/env bash ./cmd/mcla_wasm/build.sh -o ./output/mcla.wasm -opt=z -no-debug -ldflags="-X 'main.version=${GITHUB_REF#refs/*/}'" | |
cp ./cmd/mcla_wasm/wasm_exec.js ./output/wasm_exec.js | |
- | |
name: Upload wasm output to artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-wasm-output | |
path: output/mcla.wasm | |
- | |
name: Upload tinygo wasm_exec to artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: build-wasm-exec-js | |
path: output/wasm_exec.js | |
publish-wasm: | |
runs-on: ubuntu-latest | |
needs: | |
- create_release | |
- build-wasm | |
steps: | |
- | |
name: Download build-wasm output from artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: build-wasm-output | |
path: output | |
- | |
name: Download tinygo wasm_exec from artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: build-wasm-exec-js | |
path: output | |
- | |
name: Upload Release Assets | |
uses: zyxkad/upload-release-asset-dir@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ needs.create_release.outputs.upload_url }} | |
asset_dir: ./output | |
publish-pages: | |
runs-on: ubuntu-latest | |
needs: | |
- build-wasm | |
steps: | |
- | |
name: Action Checkout | |
uses: actions/checkout@v3 | |
with: | |
ref: 'pages' | |
- | |
name: Download build-wasm output from artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: build-wasm-output | |
path: . | |
- | |
name: Download tinygo wasm_exec from artifact | |
uses: actions/download-artifact@v2 | |
with: | |
name: build-wasm-exec-js | |
path: . | |
- | |
name: Good for version control | |
run: | | |
export RELEASE_VERSION="${GITHUB_REF#refs/*/}" | |
mkdir -p "${RELEASE_VERSION}" | |
cp wasm_exec.js mcla.wasm "${RELEASE_VERSION}" | |
- | |
name: Commit and push | |
run: | | |
git config user.name github-actions | |
git config user.email github-actions[bot]@users.noreply.github.com | |
git add . | |
git commit -m "published" | |
git push |