Skip to content

Commit

Permalink
ci: setup ci
Browse files Browse the repository at this point in the history
  • Loading branch information
MingweiSamuel committed Sep 12, 2024
1 parent 64f5b3e commit d185561
Show file tree
Hide file tree
Showing 5 changed files with 117 additions and 52 deletions.
13 changes: 0 additions & 13 deletions .devcontainer/Dockerfile

This file was deleted.

39 changes: 0 additions & 39 deletions .devcontainer/devcontainer.json

This file was deleted.

95 changes: 95 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: CI

on:
push:
branches:
- main
- feature/**
pull_request:
workflow_dispatch:

jobs:
pre_job:
runs-on: ubuntu-latest
outputs:
should_skip: ${{ steps.skip_check.outputs.should_skip }}
steps:
- id: skip_check
uses: fkirc/[email protected]
with:
cancel_others: "true"

check:
name: Lint and Check
if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }}
timeout-minutes: 10
needs: pre_job
runs-on: ubuntu-latest
strategy:
fail-fast: false

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_STRIP: "debuginfo"
CARGO_PROFILE_TEST_STRIP: "debuginfo"
CARGO_PROFILE_RELEASE_STRIP: "debuginfo"

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install stable toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy

- name: Run cargo fmt
run: cargo fmt --all -- --check

- name: Run cargo clippy
run: cargo clippy --all-targets --features python -- -D warnings

- name: Run cargo check
run: cargo check --all-targets --features python

- name: Run cargo check (no default features)
run: cargo check --all-targets --no-default-features

test:
name: Test Suite
if: ${{ needs.pre_job.outputs.should_skip != 'true' || github.event_name != 'pull_request' }}
timeout-minutes: 10
needs: pre_job
runs-on: ubuntu-latest
strategy:
fail-fast: false

env:
CARGO_TERM_COLOR: always
CARGO_INCREMENTAL: 0
CARGO_PROFILE_DEV_STRIP: "debuginfo"
CARGO_PROFILE_TEST_STRIP: "debuginfo"
CARGO_PROFILE_RELEASE_STRIP: "debuginfo"

steps:
- name: Checkout sources
uses: actions/checkout@v3

- name: Install nightly toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
override: ${{ matrix.rust_release == 'latest-nightly' }}

- name: Install cargo-nextest (linux)
run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin

- name: Run cargo nextest on all targets
run: cargo nextest run --no-fail-fast --all-targets

- name: Run doctests
run: cargo test --no-fail-fast --doc
20 changes: 20 additions & 0 deletions .github/workflows/conventional_commits.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Conventional Commits

on:
pull_request_target:
types:
- opened
- edited
- synchronize

permissions:
pull-requests: read

jobs:
main:
name: Conventional Commits
runs-on: ubuntu-latest
steps:
- uses: amannn/action-semantic-pull-request@v5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
2 changes: 2 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[toolchain]
channel = "stable"

0 comments on commit d185561

Please sign in to comment.