draught/.github/workflows/test.yml
Andy Pack e4dbbf5c14
Some checks failed
test and deploy / Package Library (push) Blocked by required conditions
test and deploy / Package Container (push) Blocked by required conditions
test and deploy / Build WASM (push) Has been cancelled
test and deploy / Build Native (push) Has been cancelled
updating toolchains
2024-07-28 15:49:38 +01:00

87 lines
2.2 KiB
YAML

name: test and deploy
on:
push:
branches: [ master ]
env:
CARGO_TERM_COLOR: always
jobs:
build-web:
runs-on: ubuntu-latest
name: Build WASM
steps:
- uses: actions/checkout@v2
- name: Install wasm-pack
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Test WASM in-browser
working-directory: ./draught_web
run: wasm-pack test --firefox --chrome --headless
- name: Build Rust for WASM
working-directory: ./draught_web
run: wasm-pack build --release
- name: Install Node
uses: actions/setup-node@v2
with:
node-version: 22
- name: Install Node Modules
run: npm ci
working-directory: ./draught_web/www
- name: Build Js
run: npm run build --if-present
working-directory: ./draught_web/www
- name: Build Docs
run: cargo doc --no-deps --document-private-items
- name: Move Docs to Staging Directory
run: mv target/doc draught_web/www/dist/
- name: Move CNAME file to Staging Directory
run: mv draught_web/docs/CNAME draught_web/www/dist
- name: Deploy To Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./draught_web/www/dist
build:
runs-on: ubuntu-latest
name: Build Native
steps:
- uses: actions/checkout@v2
- name: Build Binary
run: cargo build
working-directory: ./draught
package:
runs-on: ubuntu-latest
name: Package Container
needs: [build-web] # for ignoring bad builds
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
steps:
- uses: actions/checkout@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Login to DockerHub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build & Push Container
uses: docker/build-push-action@v2
with:
push: true
tags: sarsoo/draught:latest