From cd786f60345e5f136d93839e815d36ec21cdbab1 Mon Sep 17 00:00:00 2001 From: Denis Avvakumov Date: Sun, 24 Aug 2025 07:49:59 +0300 Subject: [PATCH] Add CI --- .github/workflows/ci.yml | 52 ++++++++++++++++++++++++++++++++++++ .github/workflows/deploy.yml | 6 ++++- 2 files changed, 57 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..85e258a --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,52 @@ +name: CI + +on: + push: + branches: + - main + pull_request: + workflow_dispatch: + +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + +jobs: + check: + name: Check + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Install nightly toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + toolchain: nightly + components: clippy, rustfmt + + - name: Run tests + run: cargo test --all-features --workspace + + - name: Check formatting + run: cargo fmt -- --check + + - name: Run clippy + run: cargo clippy --all-features --workspace -- -D warnings + + build-matrix: + name: Build on multiple OS + needs: check + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, macos-15, windows-latest] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Setup Rust + uses: actions-rust-lang/setup-rust-toolchain@v1 + + - name: Build release + run: cargo build --release --workspace diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 3d93ac4..2a98083 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,7 +1,10 @@ name: Deploy to GitHub Pages on: - push: + workflow_run: + workflows: ["CI"] + types: + - completed branches: - main workflow_dispatch: @@ -12,6 +15,7 @@ concurrency: jobs: build: + if: ${{ github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest permissions: contents: read