github: Refactor actions

This commit is contained in:
Remko Tronçon 2022-05-07 09:03:03 +02:00
parent b5a1663bc1
commit 9d2038efce
3 changed files with 21 additions and 41 deletions

16
.github/actions/setup/action.yml vendored Normal file
View file

@ -0,0 +1,16 @@
name: "Setup project"
runs:
using: "composite"
steps:
- uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
# We depend on a more recent version, not available in current Ubuntu (20.04). Should be available in 22.04
# - run: sudo apt-get install wabt
- run: |
curl -L -s https://github.com/WebAssembly/wabt/releases/download/1.0.27/wabt-1.0.27-ubuntu.tar.gz | tar xvz -C /tmp
sudo mv /tmp/wabt-1.0.27/bin/* /usr/local/bin
shell: bash
- run: yarnpkg --pure-lockfile
shell: bash

View file

@ -3,23 +3,14 @@ name: Build
on:
push:
workflow_dispatch:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
# We depend on a more recent version, not available in current Ubuntu (20.04). Should be available in 22.04
# - run: sudo apt-get install wabt
- run: |
curl -L -s https://github.com/WebAssembly/wabt/releases/download/1.0.27/wabt-1.0.27-ubuntu.tar.gz | tar xvz -C /tmp
sudo mv /tmp/wabt-1.0.27/bin/* /usr/local/bin
- run: yarnpkg --pure-lockfile
- uses: ./.github/actions/setup
- run: yarnpkg build
- run: yarnpkg prepare
- run: yarnpkg lint
- run: yarnpkg test --coverage

View file

@ -6,34 +6,14 @@ on:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
- run: |
curl -L -s https://github.com/WebAssembly/wabt/releases/download/1.0.27/wabt-1.0.27-ubuntu.tar.gz | tar xvz -C /tmp
sudo mv /tmp/wabt-1.0.27/bin/* /usr/local/bin
- run: yarnpkg --pure-lockfile
- run: yarnpkg build
- run: yarnpkg lint
- run: yarnpkg test --coverage
uses: ./.github/workflows/build.yml
publish-npm:
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
- run: |
curl -L -s https://github.com/WebAssembly/wabt/releases/download/1.0.27/wabt-1.0.27-ubuntu.tar.gz | tar xvz -C /tmp
sudo mv /tmp/wabt-1.0.27/bin/* /usr/local/bin
- run: yarnpkg --pure-lockfile
- uses: ./.github/actions/setup
- run: yarnpkg publish --non-interactive
env:
NPM_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
@ -43,15 +23,8 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-node@v2
with:
node-version: 16
cache: 'yarn'
- uses: ./.github/actions/setup
- run: sudo apt-get install awscli
- run: |
curl -L -s https://github.com/WebAssembly/wabt/releases/download/1.0.27/wabt-1.0.27-ubuntu.tar.gz | tar xvz -C /tmp
sudo mv /tmp/wabt-1.0.27/bin/* /usr/local/bin
- run: yarnpkg --pure-lockfile
- run: yarnpkg build
- name: aws s3 sync
run: |