napi-rs/.github/workflows/linux-musl.yaml
2021-03-19 11:53:48 +08:00

54 lines
1.9 KiB
YAML

name: Linux musl
env:
DEBUG: 'napi:*'
on:
push:
branches:
- main
pull_request:
jobs:
build:
name: stable - x86_64-unknown-linux-musl - node@lts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Cache cargo registry
uses: actions/cache@v1
with:
path: ~/.cargo/registry
key: stable-alpine-node-alpine-@lts-cargo-registry-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Cache cargo index
uses: actions/cache@v1
with:
path: ~/.cargo/git
key: stable-alpine-node-alpine-@lts-cargo-index-trimmed-${{ hashFiles('**/Cargo.lock') }}
- name: Pull docker image
run: |
docker login -u $DOCKER_USERNAME -p $DOCKER_PASSWORD $DOCKER_REGISTRY_URL
docker pull docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:lts-alpine
docker tag docker.pkg.github.com/napi-rs/napi-rs/nodejs-rust:lts-alpine builder
env:
DOCKER_REGISTRY_URL: docker.pkg.github.com
DOCKER_USERNAME: ${{ github.actor }}
DOCKER_PASSWORD: ${{ secrets.GITHUB_TOKEN }}
- name: 'Install node dependencies'
run: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder yarn
- name: 'Build TypeScript'
run: docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder yarn build
- name: Run check
run: |
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs builder cargo check -vvv
- name: Unit test
run: |
docker run --rm -v ~/.cargo/git:/root/.cargo/git -v ~/.cargo/registry:/root/.cargo/registry -v $(pwd):/napi-rs -w /napi-rs -e RUST_BACKTRACE=1 builder sh -c "yarn build:test && yarn test"