Merge pull request #187 from ia7ck/uf-unite-result #39
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
env: | |
CARGO_TERM_COLOR: always | |
jobs: | |
check: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Check | |
run: cargo check --examples | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Add clippy | |
run: rustup component add clippy | |
- name: Clippy | |
run: cargo clippy -- -D warnings | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Add rustfmt | |
run: rustup component add rustfmt | |
- name: Check format | |
run: cargo fmt --check | |
test: | |
runs-on: ubuntu-latest | |
env: | |
RUST_LOG: oj_test=info | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install oj | |
run: pip3 install --upgrade setuptools wheel && pip3 install online-judge-tools && oj --version | |
- name: Test | |
run: cargo test -- --nocapture | |
oj-test: | |
runs-on: ubuntu-latest | |
env: | |
RUST_LOG: info | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Cache test cases | |
uses: actions/cache@v4 | |
with: | |
path: tool/oj_test/testcases | |
key: oj-testcases-${{ hashFiles('**/examples/*.rs') }} | |
restore-keys: | | |
oj-testcases- | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Install oj | |
run: pip3 install --upgrade setuptools wheel && pip3 install online-judge-tools && oj --version | |
- name: Release build | |
run: cargo build --release --examples | |
- name: oj test | |
run: cargo run --release --bin oj_test | |
publish-doc: | |
runs-on: ubuntu-latest | |
env: | |
# https://doc.rust-lang.org/nightly/rustdoc/unstable-features.html#--enable-index-page-generate-a-default-index-page-for-docs | |
RUSTDOCFLAGS: '-Z unstable-options --enable-index-page' | |
# https://docs.github.com/ja/actions/reference/context-and-expression-syntax-for-github-actions#contexts | |
if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
persist-credentials: false | |
- name: Doc | |
run: cargo +nightly doc --no-deps --lib --workspace --exclude=oj_test --exclude=simple_example --exclude=special_judge_example --exclude=bundle | |
- name: Deploy 🚀 | |
uses: JamesIves/github-pages-deploy-action@v4 | |
with: | |
BRANCH: gh-pages # The branch the action should deploy to. | |
FOLDER: target/doc # The folder the action should deploy. | |
CLEAN: true # Automatically remove deleted files from the deploy branch |