yewprint/.github/workflows/pr.yml
2021-02-26 22:29:44 +01:00

61 lines
1.8 KiB
YAML

name: PR Workflow
on:
pull_request:
branches: [ main ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-latest
outputs:
size: ${{ steps.build.outputs.size }}
steps:
- uses: actions/checkout@v2
- name: Install wasm-pack
run: |
curl -sSL https://github.com/rustwasm/wasm-pack/releases/download/v0.9.1/wasm-pack-v0.9.1-x86_64-unknown-linux-musl.tar.gz \
| tar xzO wasm-pack-v0.9.1-x86_64-unknown-linux-musl/wasm-pack \
> $HOME/.cargo/bin/wasm-pack
chmod +x $HOME/.cargo/bin/wasm-pack
- run: cargo test --all-features --verbose
- name: Build (Release)
id: build
run: "./build.sh --release && echo ::set-output name=size::`cat public/wasm_bg.wasm | wc -c`"
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.1
with:
publish-dir: './public'
github-token: ${{ secrets.GITHUB_TOKEN }}
deploy-message: ${{ github.event.pull_request.title }}
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
timeout-minutes: 1
build-windows:
runs-on: windows-latest
steps:
- name: Checkout source
uses: actions/checkout@v2
- name: cargo build (windows)
uses: actions-rs/cargo@v1
with:
command: build
args: --target wasm32-unknown-unknown
checks:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- run: rustup install --profile default nightly
# NOTE: we use nightly here to enable the options error_on_line_overflow and
# error_on_unformatted
- run: cargo +nightly fmt -- --check
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features -- -D warnings