2021-06-25 18:02:45 +01:00
|
|
|
name: test and deploy
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
|
|
|
|
|
|
|
env:
|
|
|
|
CARGO_TERM_COLOR: always
|
|
|
|
|
|
|
|
jobs:
|
2024-02-01 18:21:02 +00:00
|
|
|
build-web:
|
2021-06-25 18:02:45 +01:00
|
|
|
runs-on: ubuntu-latest
|
2024-02-01 18:21:02 +00:00
|
|
|
name: Build WASM
|
2021-06-25 18:02:45 +01:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Install wasm-pack
|
2021-07-02 13:53:51 +01:00
|
|
|
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
|
2021-06-25 18:02:45 +01:00
|
|
|
|
|
|
|
- name: Test WASM in-browser
|
2024-02-01 18:21:02 +00:00
|
|
|
working-directory: ./draught_web
|
2021-06-25 18:02:45 +01:00
|
|
|
run: wasm-pack test --firefox --chrome --headless
|
|
|
|
|
2021-06-30 00:43:39 +01:00
|
|
|
- name: Build Rust for WASM
|
2024-02-01 18:21:02 +00:00
|
|
|
working-directory: ./draught_web
|
2021-07-01 17:32:12 +01:00
|
|
|
run: wasm-pack build --release
|
2021-06-30 00:43:39 +01:00
|
|
|
|
2021-06-26 21:13:06 +01:00
|
|
|
- name: Install Node
|
|
|
|
uses: actions/setup-node@v2
|
|
|
|
with:
|
2024-07-28 15:49:38 +01:00
|
|
|
node-version: 22
|
2021-06-26 21:13:06 +01:00
|
|
|
|
|
|
|
- name: Install Node Modules
|
|
|
|
run: npm ci
|
2024-02-01 18:21:02 +00:00
|
|
|
working-directory: ./draught_web/www
|
2021-06-26 21:13:06 +01:00
|
|
|
|
|
|
|
- name: Build Js
|
|
|
|
run: npm run build --if-present
|
2024-02-01 18:21:02 +00:00
|
|
|
working-directory: ./draught_web/www
|
2021-06-26 21:13:06 +01:00
|
|
|
|
|
|
|
- name: Build Docs
|
|
|
|
run: cargo doc --no-deps --document-private-items
|
|
|
|
|
|
|
|
- name: Move Docs to Staging Directory
|
2024-02-01 18:56:29 +00:00
|
|
|
run: mv target/doc draught_web/www/dist/
|
2021-06-26 21:13:06 +01:00
|
|
|
|
2022-05-05 23:02:04 +01:00
|
|
|
- name: Move CNAME file to Staging Directory
|
2024-02-01 19:01:02 +00:00
|
|
|
run: mv draught_web/docs/CNAME draught_web/www/dist
|
2022-05-05 23:02:04 +01:00
|
|
|
|
2021-06-26 21:13:06 +01:00
|
|
|
- name: Deploy To Pages
|
|
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
2024-02-01 18:56:29 +00:00
|
|
|
publish_dir: ./draught_web/www/dist
|
2023-05-16 17:46:13 +01:00
|
|
|
|
2024-02-01 18:21:02 +00:00
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
name: Build Native
|
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
|
|
|
|
- name: Build Binary
|
|
|
|
run: cargo build
|
|
|
|
working-directory: ./draught
|
2023-05-16 17:46:13 +01:00
|
|
|
|
2024-02-01 18:21:02 +00:00
|
|
|
package:
|
2023-05-16 17:46:13 +01:00
|
|
|
runs-on: ubuntu-latest
|
2024-02-01 19:01:43 +00:00
|
|
|
name: Package Container
|
|
|
|
needs: [build-web] # for ignoring bad builds
|
2023-05-16 17:46:13 +01:00
|
|
|
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 }}
|
|
|
|
|
2023-05-16 18:21:55 +01:00
|
|
|
- name: Build & Push Container
|
2023-05-16 17:46:13 +01:00
|
|
|
uses: docker/build-push-action@v2
|
|
|
|
with:
|
|
|
|
push: true
|
|
|
|
tags: sarsoo/draught:latest
|