erg/.github/workflows/rust.yml
Shunsuke Shibayama 4e2aa5c054 Update rust.yml
2023-02-10 01:33:19 +09:00

90 lines
2.3 KiB
YAML

name: CI
on:
push:
branches: [main]
paths-ignore:
- "doc/**"
- ".github/**"
- ".assets/**"
- ".cargo/**"
- "**.md"
- "**.yml"
- "LICENSE-**"
- ".gitmessage"
- ".pre-commit-config.yaml"
pull_request:
branches: [main]
paths-ignore:
- "doc/**"
- ".github/**"
- ".assets/**"
- ".cargo/**"
- "**.md"
- "**.yml"
- "LICENSE-**"
- ".gitmessage"
- ".pre-commit-config.yaml"
env:
CARGO_TERM_COLOR: always
jobs:
test:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v4
with:
python-version: "3.11.0"
- uses: Swatinem/rust-cache@v2
- run: rustup update stable
- name: Run tests (Windows)
if: runner.os == 'Windows'
# HACK: The cause is unknown, but on windows, the exit code is 1 even if tests are successful.
run: cargo test --features large_thread --features pre-commit --all --verbose
- name: Run tests (Other OS)
if: runner.os != 'Windows'
run: cargo test --features large_thread --all --verbose
build-check:
strategy:
fail-fast: false
matrix:
os: [windows-latest, ubuntu-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v2
- run: rustup update stable
- run: cargo build --all --all-targets --verbose
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: Swatinem/rust-cache@v2
- run: rustup update stable
- name: cargo clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all --all-targets --verbose -- -D warnings
notify-change:
runs-on: ubuntu-latest
steps:
- name: notify to ergscripts
run: |
TOKEN=${{ secrets.DEV_TOKEN }}
curl \
-X POST \
-H "Authorization: token $TOKEN" \
-H "Accept: application/vnd.github.v3+json" \
https://api.github.com/repos/mtshiba/ergscripts/dispatches \
-d '{"event_type":"notification-push-main","client_payload":{"msg": "a change has been pushed to main"}}'