Skip to content

Commit 601ecda

Browse files
committed
feat: initial codebase
Signed-off-by: amannocci <adrien.mannocci@gmail.com>
0 parents  commit 601ecda

9 files changed

Lines changed: 842 additions & 0 deletions

File tree

.github/workflows/ci.yml

Lines changed: 118 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,118 @@
1+
---
2+
name: CI
3+
4+
on:
5+
pull_request:
6+
push:
7+
branches:
8+
- main
9+
tags:
10+
- "v*"
11+
12+
# contents: read covers all jobs. A future release-publishing job will need
13+
# contents: write — set it at the job level there rather than widening here.
14+
permissions:
15+
contents: read
16+
17+
jobs:
18+
test:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- uses: actions/checkout@v6
22+
23+
- name: Install Rust stable
24+
uses: dtolnay/rust-toolchain@stable
25+
26+
- name: Cache cargo registry
27+
uses: actions/cache@v5
28+
with:
29+
path: |
30+
~/.cargo/registry/index/
31+
~/.cargo/registry/cache/
32+
~/.cargo/git/db/
33+
target/
34+
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.toml', '**/Cargo.lock') }}
35+
restore-keys: |
36+
${{ runner.os }}-cargo-
37+
38+
- name: Check formatting
39+
run: cargo fmt --all -- --check
40+
41+
- name: Clippy
42+
run: cargo clippy --all-targets --all-features -- -D warnings
43+
44+
- name: Run tests
45+
run: cargo test --all
46+
47+
build-release:
48+
runs-on: ubuntu-latest
49+
needs: test
50+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
51+
steps:
52+
- uses: actions/checkout@v4
53+
54+
- name: Install Rust stable + musl target
55+
uses: dtolnay/rust-toolchain@stable
56+
with:
57+
targets: x86_64-unknown-linux-musl
58+
59+
- name: Install musl tools
60+
run: sudo apt-get install -y musl-tools
61+
62+
- name: Build static release binary
63+
run: cargo build --release --target x86_64-unknown-linux-musl
64+
65+
- name: Upload binary artifact
66+
uses: actions/upload-artifact@v4
67+
with:
68+
name: fix-perms-x86_64-musl
69+
path: target/x86_64-unknown-linux-musl/release/fix-perms
70+
if-no-files-found: error
71+
72+
package:
73+
runs-on: ubuntu-latest
74+
needs: build-release
75+
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v')
76+
steps:
77+
- uses: actions/checkout@v6
78+
79+
- name: Download binary artifact
80+
uses: actions/download-artifact@v7
81+
with:
82+
name: fix-perms-x86_64-musl
83+
path: target/x86_64-unknown-linux-musl/release/
84+
85+
- name: Restore binary permissions
86+
run: chmod +x target/x86_64-unknown-linux-musl/release/fix-perms
87+
88+
- name: Derive package version
89+
id: version
90+
run: |
91+
# Strip the leading 'v' from tag names (v1.2.3 → 1.2.3).
92+
# Both dpkg and rpm reject version strings that start with 'v'.
93+
ref="${GITHUB_REF_NAME}"
94+
echo "value=${ref#v}" >> "$GITHUB_OUTPUT"
95+
96+
- name: Install nfpm
97+
run: |
98+
echo 'deb [trusted=yes] https://repo.goreleaser.com/apt/ /' \
99+
| sudo tee /etc/apt/sources.list.d/goreleaser.list
100+
sudo apt-get update
101+
sudo apt-get install -y nfpm
102+
103+
- name: Build .deb package
104+
run: nfpm package --config nfpm.yaml --packager deb --target dist/
105+
env:
106+
VERSION: ${{ steps.version.outputs.value }}
107+
108+
- name: Build .rpm package
109+
run: nfpm package --config nfpm.yaml --packager rpm --target dist/
110+
env:
111+
VERSION: ${{ steps.version.outputs.value }}
112+
113+
- name: Upload packages
114+
uses: actions/upload-artifact@v7
115+
with:
116+
name: ignity-extensions-packages
117+
path: dist/
118+
if-no-files-found: error

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
2+
.idea
3+
/target/
4+
/dist/
5+
# Default output name when rustc is invoked directly without -o
6+
rust_out

.gitlint

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
[title-max-length]
2+
line-length=80
3+
4+
[title-min-length]
5+
min-length=5
6+
7+
[title-match-regex]
8+
regex=^(build|ci|docs|feat|fix|perf|refactor|test|chore)

Cargo.lock

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

Cargo.toml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
[workspace]
2+
members = ["crates/fix-perms"]
3+
resolver = "2"
4+
5+
[workspace.package]
6+
version = "0.1.0"
7+
edition = "2021"
8+
authors = ["techcode-io"]
9+
license = "MIT"
10+
repository = "https://github.com/techcode-io/ignity-extensions"
11+
12+
[profile.release]
13+
opt-level = 3
14+
lto = true
15+
codegen-units = 1
16+
strip = true

0 commit comments

Comments
 (0)