Skip to content

Commit 46a0fb8

Browse files
committed
chore(ci): Enable GitHub Actions
1 parent c98589d commit 46a0fb8

File tree

6 files changed

+294
-3
lines changed

6 files changed

+294
-3
lines changed

.github/workflows/ci.yml

Lines changed: 115 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,115 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: ['**']
6+
pull_request:
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
RUST_BACKTRACE: 1
11+
12+
jobs:
13+
clippy:
14+
name: Clippy
15+
runs-on: ubuntu-latest
16+
steps:
17+
- uses: actions/checkout@v5
18+
19+
- name: Install Rust
20+
uses: dtolnay/rust-toolchain@stable
21+
with:
22+
components: clippy
23+
24+
- name: Cache cargo registry
25+
uses: actions/cache@v4
26+
with:
27+
path: ~/.cargo/registry
28+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
29+
30+
- name: Cache cargo index
31+
uses: actions/cache@v4
32+
with:
33+
path: ~/.cargo/git
34+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
35+
36+
- name: Cache cargo build
37+
uses: actions/cache@v4
38+
with:
39+
path: target
40+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
41+
42+
- name: Run Clippy with pedantic and nursery
43+
run: |
44+
cargo clippy --all-targets --all-features -- \
45+
-W clippy::pedantic \
46+
-W clippy::nursery \
47+
-D warnings
48+
49+
test:
50+
name: Test Suite
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v5
54+
55+
- name: Install Rust
56+
uses: dtolnay/rust-toolchain@stable
57+
58+
- name: Cache cargo registry
59+
uses: actions/cache@v4
60+
with:
61+
path: ~/.cargo/registry
62+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
63+
64+
- name: Cache cargo index
65+
uses: actions/cache@v4
66+
with:
67+
path: ~/.cargo/git
68+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
69+
70+
- name: Cache cargo build
71+
uses: actions/cache@v4
72+
with:
73+
path: target
74+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
75+
76+
- name: Run tests
77+
run: cargo test --all-features --verbose
78+
79+
examples:
80+
name: Examples
81+
runs-on: ubuntu-latest
82+
steps:
83+
- uses: actions/checkout@v5
84+
85+
- name: Install Rust
86+
uses: dtolnay/rust-toolchain@stable
87+
88+
- name: Cache cargo registry
89+
uses: actions/cache@v4
90+
with:
91+
path: ~/.cargo/registry
92+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
93+
94+
- name: Cache cargo index
95+
uses: actions/cache@v4
96+
with:
97+
path: ~/.cargo/git
98+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
99+
100+
- name: Cache cargo build
101+
uses: actions/cache@v4
102+
with:
103+
path: target
104+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
105+
106+
- name: Build all examples
107+
run: cargo build --examples --all-features --verbose
108+
109+
- name: Run all examples
110+
run: |
111+
for example in examples/*.rs; do
112+
example_name=$(basename "$example" .rs)
113+
echo "Running example: $example_name"
114+
cargo run --example "$example_name" --all-features || exit 1
115+
done

.github/workflows/release.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
RUST_BACKTRACE: 1
11+
12+
jobs:
13+
release:
14+
name: Semantic Release
15+
runs-on: ubuntu-latest
16+
environment: main
17+
permissions:
18+
contents: write
19+
issues: write
20+
pull-requests: write
21+
id-token: write
22+
steps:
23+
- uses: actions/checkout@v4
24+
with:
25+
fetch-depth: 0
26+
persist-credentials: false
27+
28+
- name: Install Rust
29+
uses: dtolnay/rust-toolchain@stable
30+
with:
31+
components: clippy
32+
33+
- name: Cache cargo registry
34+
uses: actions/cache@v4
35+
with:
36+
path: ~/.cargo/registry
37+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
38+
39+
- name: Cache cargo index
40+
uses: actions/cache@v4
41+
with:
42+
path: ~/.cargo/git
43+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
44+
45+
- name: Cache cargo build
46+
uses: actions/cache@v4
47+
with:
48+
path: target
49+
key: ${{ runner.os }}-cargo-build-target-${{ hashFiles('**/Cargo.lock') }}
50+
51+
- name: Run Clippy with pedantic and nursery
52+
run: |
53+
cargo clippy --all-targets --all-features -- \
54+
-W clippy::pedantic \
55+
-W clippy::nursery \
56+
-D warnings
57+
58+
- name: Run tests
59+
run: cargo test --all-features --verbose
60+
61+
- name: Build all examples
62+
run: cargo build --examples --all-features --verbose
63+
64+
- name: Run all examples
65+
run: |
66+
for example in examples/*.rs; do
67+
example_name=$(basename "$example" .rs)
68+
echo "Running example: $example_name"
69+
cargo run --example "$example_name" --all-features || exit 1
70+
done
71+
72+
- name: Build package
73+
run: cargo build --release --all-features
74+
75+
- name: Setup Node.js
76+
uses: actions/setup-node@v4
77+
with:
78+
node-version: 'lts/*'
79+
80+
- name: Install semantic-release and plugins
81+
run: |
82+
npm install -g \
83+
semantic-release@latest \
84+
@semantic-release/git@latest \
85+
@semantic-release/changelog@latest \
86+
@semantic-release/exec@latest \
87+
conventional-changelog-conventionalcommits@latest
88+
89+
- name: Semantic Release
90+
id: semantic
91+
env:
92+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}
94+
run: npx semantic-release
95+
96+
- name: Publish to crates.io
97+
if: steps.semantic.outputs.new_release_published == 'true'
98+
run: cargo publish --token ${{ secrets.CARGO_TOKEN }} --allow-dirty
99+
env:
100+
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_TOKEN }}

.idea/dictionaries/project.xml

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

.releaserc.json

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
{
2+
"branches": ["main"],
3+
"plugins": [
4+
[
5+
"@semantic-release/commit-analyzer",
6+
{
7+
"preset": "conventionalcommits",
8+
"releaseRules": [
9+
{ "type": "feature", "release": "minor" },
10+
{ "type": "feat", "release": "minor" },
11+
{ "type": "fix", "release": "patch" },
12+
{ "type": "perf", "release": "patch" },
13+
{ "type": "revert", "release": "patch" },
14+
{ "type": "docs", "release": "patch" },
15+
{ "type": "chore", "release": false },
16+
{ "type": "refactor", "release": "patch" },
17+
{ "type": "test", "release": false },
18+
{ "type": "build", "release": false },
19+
{ "type": "ci", "release": false }
20+
]
21+
}
22+
],
23+
[
24+
"@semantic-release/release-notes-generator",
25+
{
26+
"preset": "conventionalcommits",
27+
"presetConfig": {
28+
"types": [
29+
{ "type": "feat", "section": "Features" },
30+
{ "type": "feature", "section": "Features" },
31+
{ "type": "fix", "section": "Bug Fixes" },
32+
{ "type": "perf", "section": "Performance Improvements" },
33+
{ "type": "revert", "section": "Reverts" },
34+
{ "type": "docs", "section": "Documentation" },
35+
{ "type": "refactor", "section": "Code Refactoring" },
36+
{ "type": "test", "section": "Tests", "hidden": true },
37+
{ "type": "build", "section": "Build System", "hidden": true },
38+
{ "type": "ci", "section": "CI", "hidden": true },
39+
{ "type": "chore", "section": "Chores", "hidden": true }
40+
]
41+
}
42+
}
43+
],
44+
[
45+
"@semantic-release/changelog",
46+
{
47+
"changelogFile": "CHANGELOG.md"
48+
}
49+
],
50+
[
51+
"@semantic-release/exec",
52+
{
53+
"prepareCmd": "sed -i.bak 's/^version = \".*\"/version = \"${nextRelease.version}\"/' Cargo.toml && rm Cargo.toml.bak"
54+
}
55+
],
56+
[
57+
"@semantic-release/git",
58+
{
59+
"assets": ["Cargo.toml", "Cargo.lock", "CHANGELOG.md"],
60+
"message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}"
61+
}
62+
],
63+
[
64+
"@semantic-release/github",
65+
{
66+
"successComment": false,
67+
"failComment": false,
68+
"releasedLabels": false
69+
}
70+
]
71+
]
72+
}

Cargo.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Cargo.toml

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "ironbeam"
3-
version = "1.0.0-alpha1"
3+
version = "1.0.0"
44
edition = "2024"
55

66
[features]
@@ -49,4 +49,7 @@ regex = "1.12.2"
4949
tempfile = "3"
5050

5151
[dev-dependencies]
52-
tempfile = "3"
52+
tempfile = "3"
53+
54+
[package.metadata.docs.rs]
55+
all-features = true

0 commit comments

Comments
 (0)