Skip to content

Commit c7cd578

Browse files
feat: migrate to gh-workflow-tailcall (#34)
1 parent a8a5b18 commit c7cd578

File tree

5 files changed

+139
-77
lines changed

5 files changed

+139
-77
lines changed

.github/workflows/autofix.yml

Lines changed: 53 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,53 @@
1+
# -------------------------------------------------------------------
2+
# ------------------------------- WARNING ---------------------------
3+
# -------------------------------------------------------------------
4+
#
5+
# This file was automatically generated by gh-workflows using the
6+
# gh-workflow-gen bin. You should add and commit this file to your
7+
# git repository. **DO NOT EDIT THIS FILE BY HAND!** Any manual changes
8+
# will be lost if the file is regenerated.
9+
#
10+
# To make modifications, update your `build.rs` configuration to adjust
11+
# the workflow description as needed, then regenerate this file to apply
12+
# those changes.
13+
#
14+
# -------------------------------------------------------------------
15+
# ----------------------------- END WARNING -------------------------
16+
# -------------------------------------------------------------------
17+
18+
name: autofix.ci
19+
env:
20+
RUSTFLAGS: -Dwarnings
21+
on:
22+
pull_request:
23+
types:
24+
- opened
25+
- synchronize
26+
- reopened
27+
branches:
28+
- main
29+
push:
30+
branches:
31+
- main
32+
jobs:
33+
lint:
34+
name: Lint Fix
35+
runs-on: ubuntu-latest
36+
permissions:
37+
contents: read
38+
steps:
39+
- name: Checkout Code
40+
uses: actions/checkout@v4
41+
- name: Setup Rust Toolchain
42+
uses: actions-rust-lang/setup-rust-toolchain@v1
43+
with:
44+
toolchain: nightly
45+
components: clippy, rustfmt
46+
- name: Cargo Fmt
47+
run: cargo +nightly fmt --all
48+
- name: Cargo Clippy
49+
run: cargo +nightly clippy --fix --allow-dirty --all-features --workspace -- -D warnings
50+
- uses: autofix-ci/action@ff86a557419858bb967097bfc916833f5647fa8c
51+
concurrency:
52+
group: autofix-${{github.ref}}
53+
cancel-in-progress: false

.github/workflows/ci.yml

Lines changed: 55 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,11 @@
1515
# ----------------------------- END WARNING -------------------------
1616
# -------------------------------------------------------------------
1717

18-
name: Build and Test
18+
name: ci
1919
env:
2020
RUSTFLAGS: -Dwarnings
2121
on:
22-
pull_request_target:
22+
pull_request:
2323
types:
2424
- opened
2525
- synchronize
@@ -33,22 +33,41 @@ jobs:
3333
build:
3434
name: Build and Test
3535
runs-on: ubuntu-latest
36+
permissions:
37+
contents: read
3638
steps:
3739
- name: Checkout Code
3840
uses: actions/checkout@v4
3941
- name: Setup Rust Toolchain
4042
uses: actions-rust-lang/setup-rust-toolchain@v1
4143
with:
42-
toolchain: stable, nightly
43-
components: clippy, rustfmt
44+
toolchain: stable
4445
- name: Cargo Test
4546
run: cargo test --all-features --workspace
47+
- name: Cargo Bench
48+
run: cargo bench --workspace
49+
lint:
50+
name: Lint
51+
runs-on: ubuntu-latest
52+
permissions:
53+
contents: read
54+
steps:
55+
- name: Checkout Code
56+
uses: actions/checkout@v4
57+
- name: Setup Rust Toolchain
58+
uses: actions-rust-lang/setup-rust-toolchain@v1
59+
with:
60+
toolchain: nightly
61+
components: clippy, rustfmt
4662
- name: Cargo Fmt
47-
run: cargo +nightly fmt --check
63+
run: cargo +nightly fmt --all --check
4864
- name: Cargo Clippy
4965
run: cargo +nightly clippy --all-features --workspace -- -D warnings
5066
release:
51-
needs: build
67+
needs:
68+
- build
69+
- lint
70+
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
5271
name: Release
5372
runs-on: ubuntu-latest
5473
permissions:
@@ -62,4 +81,33 @@ jobs:
6281
- name: Checkout Code
6382
uses: actions/checkout@v4
6483
- name: Release Plz
65-
uses: MarcoIeni/release-plz-action@v0.5
84+
uses: release-plz/action@v0.5
85+
with:
86+
command: release
87+
concurrency:
88+
group: release-${{github.ref}}
89+
cancel-in-progress: false
90+
release-pr:
91+
needs:
92+
- build
93+
- lint
94+
if: ${{ github.ref == 'refs/heads/main' && github.event_name == 'push' }}
95+
name: Release Pr
96+
runs-on: ubuntu-latest
97+
permissions:
98+
contents: write
99+
pull-requests: write
100+
packages: write
101+
env:
102+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
103+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
104+
steps:
105+
- name: Checkout Code
106+
uses: actions/checkout@v4
107+
- name: Release Plz
108+
uses: release-plz/action@v0.5
109+
with:
110+
command: release-pr
111+
concurrency:
112+
group: release-${{github.ref}}
113+
cancel-in-progress: false

Cargo.lock

Lines changed: 26 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ documentation = "https://docs.rs/tailcall-chunk"
1010
[dependencies]
1111

1212
[dev-dependencies]
13-
gh-workflow = "0.4"
13+
gh-workflow-tailcall = "0.2.0"
1414
criterion = "0.5"
1515

1616
[[bench]]

tests/ci.rs

Lines changed: 4 additions & 66 deletions
Original file line numberDiff line numberDiff line change
@@ -1,69 +1,7 @@
1-
use gh_workflow::*;
2-
use release_plz::Release;
3-
use toolchain::Toolchain;
1+
use gh_workflow_tailcall::*;
42

53
#[test]
6-
fn ci() {
7-
let flags = RustFlags::deny("warnings");
8-
9-
let build = Job::new("Build and Test")
10-
.add_step(Step::checkout())
11-
.add_step(
12-
Toolchain::default()
13-
.add_stable()
14-
.add_nightly()
15-
.add_clippy()
16-
.add_fmt(),
17-
)
18-
.add_step(
19-
Cargo::new("test")
20-
.args("--all-features --workspace")
21-
.name("Cargo Test"),
22-
)
23-
.add_step(
24-
Cargo::new("fmt")
25-
.nightly()
26-
.args("--check")
27-
.name("Cargo Fmt"),
28-
)
29-
.add_step(
30-
Cargo::new("clippy")
31-
.nightly()
32-
.args("--all-features --workspace -- -D warnings")
33-
.name("Cargo Clippy"),
34-
);
35-
36-
let event = Event::default()
37-
.push(Push::default().add_branch("main"))
38-
.pull_request_target(
39-
PullRequestTarget::default()
40-
.add_type(PullRequestType::Opened)
41-
.add_type(PullRequestType::Synchronize)
42-
.add_type(PullRequestType::Reopened)
43-
.add_branch("main"),
44-
);
45-
46-
let permissions = Permissions::default()
47-
.pull_requests(Level::Write)
48-
.packages(Level::Write)
49-
.contents(Level::Write);
50-
51-
let release = Job::new("Release")
52-
.needs("build")
53-
.add_env(Env::github())
54-
.add_env(Env::new(
55-
"CARGO_REGISTRY_TOKEN",
56-
"${{ secrets.CARGO_REGISTRY_TOKEN }}",
57-
))
58-
.permissions(permissions)
59-
.add_step(Step::checkout())
60-
.add_step(Release::default());
61-
62-
Workflow::new("Build and Test")
63-
.add_env(flags)
64-
.on(event)
65-
.add_job("build", build)
66-
.add_job("release", release)
67-
.generate()
68-
.unwrap();
4+
fn generate_ci_workflow() {
5+
let workflow = Workflow::default().auto_release(true).benchmarks(true);
6+
workflow.generate().unwrap();
697
}

0 commit comments

Comments
 (0)