92 lines
2.5 KiB
YAML
92 lines
2.5 KiB
YAML
name: CI
|
|
|
|
on:
|
|
push:
|
|
branches: [main, master]
|
|
pull_request:
|
|
branches: [main, master]
|
|
|
|
env:
|
|
CARGO_NET_OFFLINE: false
|
|
|
|
jobs:
|
|
check:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: registry.cn-hangzhou.aliyuncs.com/library/rust:bookworm
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git init
|
|
git remote add origin https://git.rua.plus/${{ github.repository }}.git
|
|
git fetch --depth 1 origin ${{ github.sha }}
|
|
git checkout ${{ github.sha }}
|
|
|
|
- name: Configure Cargo mirror
|
|
run: |
|
|
mkdir -p "$HOME/.cargo"
|
|
printf '%s\n' '[source.crates-io]' "replace-with = 'ustc'" '' "[source.ustc]" 'registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"' > "$HOME/.cargo/config.toml"
|
|
|
|
- name: Install Node.js
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y nodejs npm
|
|
|
|
- name: Install Rust target
|
|
run: rustup target add wasm32-unknown-unknown
|
|
|
|
- name: Install Dioxus CLI
|
|
run: cargo install dioxus-cli --locked
|
|
|
|
- name: Install Tailwind CSS CLI
|
|
run: npm install -g tailwindcss
|
|
|
|
- name: Check formatting
|
|
run: cargo fmt -- --check
|
|
|
|
- name: Run Clippy
|
|
run: cargo clippy --all-targets --all-features -- -D warnings
|
|
|
|
- name: Run tests
|
|
run: cargo test --all-features
|
|
|
|
- name: Dioxus check
|
|
run: dx check
|
|
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
container:
|
|
image: registry.cn-hangzhou.aliyuncs.com/library/rust:bookworm
|
|
needs: check
|
|
env:
|
|
CARGO_NET_OFFLINE: false
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git init
|
|
git remote add origin https://git.rua.plus/${{ github.repository }}.git
|
|
git fetch --depth 1 origin ${{ github.sha }}
|
|
git checkout ${{ github.sha }}
|
|
|
|
- name: Configure Cargo mirror
|
|
run: |
|
|
mkdir -p "$HOME/.cargo"
|
|
printf '%s\n' '[source.crates-io]' "replace-with = 'ustc'" '' "[source.ustc]" 'registry = "sparse+https://mirrors.ustc.edu.cn/crates.io-index/"' > "$HOME/.cargo/config.toml"
|
|
|
|
- name: Install Node.js
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y nodejs npm
|
|
|
|
- name: Install Rust target
|
|
run: rustup target add wasm32-unknown-unknown
|
|
|
|
- name: Install Dioxus CLI
|
|
run: cargo install dioxus-cli --locked
|
|
|
|
- name: Install Tailwind CSS CLI
|
|
run: npm install -g tailwindcss
|
|
|
|
- name: Build release
|
|
run: make build
|