Skip to content

Commit

Permalink
add ci
Browse files Browse the repository at this point in the history
  • Loading branch information
Specy committed Jan 9, 2025
1 parent 64a480e commit bde3404
Showing 1 changed file with 110 additions and 0 deletions.
110 changes: 110 additions & 0 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,110 @@
name: Continuous Integration
on:
pull_request:
push:
branches:
- main
tags:
- v*

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.event_name == 'pull_request' }}

jobs:
conformance:
name: Conformance
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Cache Rust
uses: actions/cache@v3
with:
key: ${{ runner.os }}-nightly-${{ hashFiles('Cargo.toml') }}
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
components: rustfmt, clippy
override: true

- name: Rustfmt
uses: actions-rs/cargo@v1
with:
command: fmt
args: --check

- name: Clippy
uses: actions-rs/cargo@v1
with:
command: clippy
args: -- --deny warnings

test:
strategy:
matrix:
os:
- windows-latest
- macos-latest
- ubuntu-latest

name: Test (${{ matrix.os }})
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Cache Rust
uses: actions/cache@v3
with:
key: ${{ runner.os }}-${{ matrix.rust }}-${{ hashFiles('Cargo.toml') }}
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Test Rust
uses: actions-rs/cargo@v1
with:
command: test

publish-crate:
if: startsWith(github.ref, 'refs/tags/v')
needs: [ conformance, test ]

name: Publish to Crates.io
runs-on: "ubuntu-latest"
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup Rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true

- name: Publish
run: cargo publish --token ${REGISTRY_TOKEN}
env:
REGISTRY_TOKEN: ${{ secrets.REGISTRY_TOKEN }}

0 comments on commit bde3404

Please sign in to comment.