ci: fix ci

This commit is contained in:
PoiScript 2023-11-13 16:56:18 +08:00
parent 977e8d134b
commit 61ed64486d
No known key found for this signature in database
GPG key ID: 22C2B1249D99985E
3 changed files with 83 additions and 57 deletions

83
.github/workflows/ci.yml vendored Normal file
View file

@ -0,0 +1,83 @@
name: CI
on: [push, pull_request]
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@master
- name: Install latest stable Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
- name: Install minimal stable with clippy and rustfmt
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy
- name: Run rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: -- --check
- name: Run clippy
uses: actions-rs/cargo@v1
with:
command: clippy
- name: Run test
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features
build-wasm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build
run: wasm-pack build -t web -d ./wasm/dist --out-name orgize ./wasm/
- uses: actions/upload-artifact@master
with:
name: page
path: ./wasm
if-no-files-found: error
deploy:
if: github.ref == 'refs/heads/v0.10'
runs-on: ubuntu-latest
needs: build-wasm
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- uses: actions/download-artifact@master
with:
name: page
path: .
- uses: actions/configure-pages@v1
- uses: actions/upload-pages-artifact@v1
with:
path: .
- id: deployment
uses: actions/deploy-pages@main

View file

@ -1,22 +0,0 @@
name: Github Pages
on: [push]
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install
run: curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
- name: Build
run: wasm-pack build -t web -d ./wasm/dist --out-name orgize ./wasm/
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./wasm

View file

@ -1,35 +0,0 @@
name: Rust
on: [push, pull_request]
jobs:
format:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Run rustfmt
run: cargo fmt -- --check
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
profile: minimal
override: true
- name: Cache target/
uses: actions/cache@v1
with:
path: target
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
- name: Run Test
run: cargo test --all-features