Skip to content

Commit c0a99ad

Browse files
add ci (#2)
* add ci * 2021 * lib
1 parent 55d6214 commit c0a99ad

File tree

4 files changed

+154
-1
lines changed

4 files changed

+154
-1
lines changed

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
version: 2
2+
updates:
3+
- package-ecosystem: github-actions
4+
directory: /
5+
schedule:
6+
interval: daily
7+
- package-ecosystem: cargo
8+
directory: /
9+
schedule:
10+
interval: daily
11+
ignore:
12+
- dependency-name: "*"
13+
# patch and minor updates don't matter for libraries as consumers of this library build
14+
# with their own lockfile, rather than the version specified in this library's lockfile
15+
# remove this ignore rule if your package has binaries to ensure that the binaries are
16+
# built with the exact set of dependencies and those are up to date.
17+
update-types:
18+
- "version-update:semver-patch"
19+
- "version-update:semver-minor"

.github/workflows/check.yml

Lines changed: 96 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,96 @@
1+
# This workflow runs whenever a PR is opened or updated, or a commit is pushed to main. It runs
2+
# several checks:
3+
# - fmt: checks that the code is formatted according to rustfmt
4+
# - clippy: checks that the code does not contain any clippy warnings
5+
# - hack: check combinations of feature flags
6+
# - msrv: check that the msrv specified in the crate is correct
7+
permissions:
8+
contents: read
9+
# This configuration allows maintainers of this repo to create a branch and pull request based on
10+
# the new branch. Restricting the push trigger to the main branch ensures that the PR only gets
11+
# built once.
12+
on:
13+
push:
14+
branches: [main]
15+
pull_request:
16+
# If new code is pushed to a PR branch, then cancel in progress workflows for that PR. Ensures that
17+
# we don't waste CI time, and returns results quicker https://github.com/jonhoo/rust-ci-conf/pull/5
18+
concurrency:
19+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
20+
cancel-in-progress: true
21+
name: check
22+
jobs:
23+
fmt:
24+
runs-on: ubuntu-latest
25+
name: stable / fmt
26+
steps:
27+
- uses: actions/checkout@v4
28+
with:
29+
submodules: true
30+
- name: Install stable
31+
uses: dtolnay/rust-toolchain@stable
32+
with:
33+
components: rustfmt
34+
- name: cargo fmt --check
35+
run: cargo fmt --check
36+
clippy:
37+
runs-on: ubuntu-latest
38+
name: ${{ matrix.toolchain }} / clippy
39+
permissions:
40+
contents: read
41+
checks: write
42+
strategy:
43+
fail-fast: false
44+
matrix:
45+
# Get early warning of new lints which are regularly introduced in beta channels.
46+
toolchain: [stable, beta]
47+
steps:
48+
- uses: actions/checkout@v4
49+
with:
50+
submodules: true
51+
- name: Install ${{ matrix.toolchain }}
52+
uses: dtolnay/rust-toolchain@master
53+
with:
54+
toolchain: ${{ matrix.toolchain }}
55+
components: clippy
56+
- name: cargo clippy
57+
uses: giraffate/clippy-action@v1
58+
with:
59+
reporter: 'github-pr-check'
60+
github_token: ${{ secrets.GITHUB_TOKEN }}
61+
hack:
62+
# cargo-hack checks combinations of feature flags to ensure that features are all additive
63+
# which is required for feature unification
64+
runs-on: ubuntu-latest
65+
name: ubuntu / stable / features
66+
steps:
67+
- uses: actions/checkout@v4
68+
with:
69+
submodules: true
70+
- name: Install stable
71+
uses: dtolnay/rust-toolchain@stable
72+
- name: cargo install cargo-hack
73+
uses: taiki-e/install-action@cargo-hack
74+
# intentionally no target specifier; see https://github.com/jonhoo/rust-ci-conf/pull/4
75+
# --feature-powerset runs for every combination of features
76+
- name: cargo hack
77+
run: cargo hack --feature-powerset check
78+
msrv:
79+
# check that we can build using the minimal rust version that is specified by this crate
80+
runs-on: ubuntu-latest
81+
# we use a matrix here just because env can't be used in job names
82+
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
83+
strategy:
84+
matrix:
85+
msrv: ["1.80"]
86+
name: ubuntu / ${{ matrix.msrv }}
87+
steps:
88+
- uses: actions/checkout@v4
89+
with:
90+
submodules: true
91+
- name: Install ${{ matrix.msrv }}
92+
uses: dtolnay/rust-toolchain@master
93+
with:
94+
toolchain: ${{ matrix.msrv }}
95+
- name: cargo +${{ matrix.msrv }} check
96+
run: cargo check

.github/workflows/test.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# This is the main CI workflow that runs the test suite on all pushes to main and all pull requests.
2+
# It runs the following jobs:
3+
# - required: runs the test suite on ubuntu with stable and beta rust toolchains
4+
# See check.yml for information about how the concurrency cancellation and workflow triggering works
5+
permissions:
6+
contents: read
7+
on:
8+
push:
9+
branches: [main]
10+
pull_request:
11+
concurrency:
12+
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
13+
cancel-in-progress: true
14+
name: test
15+
jobs:
16+
required:
17+
runs-on: ubuntu-latest
18+
name: ubuntu / ${{ matrix.toolchain }}
19+
strategy:
20+
matrix:
21+
# run on stable and beta to ensure that tests won't break on the next version of the rust
22+
# toolchain
23+
toolchain: [stable, beta]
24+
steps:
25+
- uses: actions/checkout@v4
26+
with:
27+
submodules: true
28+
- name: Install ${{ matrix.toolchain }}
29+
uses: dtolnay/rust-toolchain@master
30+
with:
31+
toolchain: ${{ matrix.toolchain }}
32+
- name: cargo generate-lockfile
33+
# enable this ci template to run regardless of whether the lockfile is checked in or not
34+
if: hashFiles('Cargo.lock') == ''
35+
run: cargo generate-lockfile
36+
# https://twitter.com/jonhoo/status/1571290371124260865
37+
- name: cargo test --locked
38+
run: cargo test --locked --all-features --all-targets

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
[package]
22
name = "basalt-cli"
33
version = "0.1.0"
4-
edition = "2024"
4+
edition = "2021"
55

66
[dependencies]
77
anyhow = "1.0.95"

0 commit comments

Comments
 (0)