Skip to content

Commit 07345b0

Browse files
committed
feat: initial commit
0 parents  commit 07345b0

File tree

17 files changed

+2762
-0
lines changed

17 files changed

+2762
-0
lines changed

.github/dependabot.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
version: 2
2+
3+
updates:
4+
- package-ecosystem: "cargo"
5+
directory: "/"
6+
schedule:
7+
interval: "weekly"
8+
- package-ecosystem: "github-actions"
9+
directory: "/"
10+
schedule:
11+
interval: "weekly"

.github/workflows/build.yml

Lines changed: 113 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,113 @@
1+
name: Build
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
workflow_call:
9+
workflow_dispatch:
10+
11+
jobs:
12+
build:
13+
permissions:
14+
id-token: write
15+
attestations: write
16+
17+
strategy:
18+
matrix:
19+
target:
20+
- aarch64-apple-darwin
21+
- x86_64-apple-darwin
22+
- aarch64-pc-windows-msvc
23+
- x86_64-pc-windows-msvc
24+
include:
25+
- target: aarch64-apple-darwin
26+
runner: macos-14
27+
- target: x86_64-apple-darwin
28+
runner: macos-latest
29+
- target: aarch64-pc-windows-msvc
30+
runner: windows-latest
31+
- target: x86_64-pc-windows-msvc
32+
runner: windows-latest
33+
fail-fast: false
34+
35+
runs-on: ${{ matrix.runner }}
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
41+
- name: Install Rust toolchain
42+
uses: dtolnay/rust-toolchain@stable
43+
with:
44+
toolchain: stable
45+
target: ${{ matrix.target }}
46+
47+
- name: Setup Rust cache
48+
uses: Swatinem/rust-cache@v2
49+
50+
- name: Install cargo-auditable
51+
run: cargo install cargo-auditable
52+
53+
- name: Build
54+
run: cargo auditable build --release --locked --target ${{ matrix.target }}
55+
env:
56+
CARGO_PROFILE_RELEASE_LTO: "fat"
57+
CARGO_PROFILE_RELEASE_CODEGEN_UNITS: "1"
58+
59+
- name: Generate build provenance attestations
60+
uses: actions/attest-build-provenance@v1
61+
if: ${{ github.event_name != 'pull_request' }}
62+
with:
63+
subject-path: |
64+
./target/${{ matrix.target }}/release/spdx-gen
65+
./target/${{ matrix.target }}/release/spdx-gen.exe
66+
67+
- name: Upload artifacts
68+
uses: actions/upload-artifact@v4
69+
with:
70+
if-no-files-found: "error"
71+
name: spdx-gen-${{ matrix.target }}
72+
path: |
73+
./target/${{ matrix.target }}/release/spdx-gen
74+
./target/${{ matrix.target }}/release/spdx-gen.exe
75+
76+
linux-static:
77+
permissions:
78+
id-token: write
79+
attestations: write
80+
81+
strategy:
82+
matrix:
83+
target:
84+
- "x86_64-unknown-linux-musl"
85+
- "aarch64-unknown-linux-musl"
86+
87+
runs-on: ubuntu-latest
88+
89+
steps:
90+
- name: Checkout repository
91+
uses: actions/checkout@v4
92+
93+
- name: Install Nix
94+
uses: DeterminateSystems/nix-installer-action@main
95+
96+
- name: Setup Nix cache
97+
uses: DeterminateSystems/magic-nix-cache-action@main
98+
99+
- name: Build
100+
run: nix build --fallback --print-build-logs '.#spdx-gen-static-${{ matrix.target }}'
101+
102+
- name: Generate build provenance attestations
103+
uses: actions/attest-build-provenance@v1
104+
if: ${{ github.event_name != 'pull_request' }}
105+
with:
106+
subject-path: ./result/bin/spdx-gen
107+
108+
- name: Upload artifact
109+
uses: actions/upload-artifact@v4
110+
with:
111+
if-no-files-found: "error"
112+
name: spdx-gen-${{ matrix.target }}
113+
path: ./result/bin/spdx-gen

.github/workflows/check.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Check
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
jobs:
10+
clippy:
11+
runs-on: ubuntu-latest
12+
permissions:
13+
security-events: write
14+
15+
steps:
16+
- name: Checkout repository
17+
uses: actions/checkout@v4
18+
19+
- name: Install Nix
20+
uses: DeterminateSystems/nix-installer-action@main
21+
22+
- name: Setup Nix cache
23+
uses: DeterminateSystems/magic-nix-cache-action@main
24+
25+
- name: Check
26+
run: nix build --fallback --print-build-logs '.#check-clippy'
27+
28+
- name: Upload analysis results
29+
uses: github/codeql-action/upload-sarif@v3
30+
with:
31+
sarif_file: result
32+
wait-for-processing: true
33+
34+
rustfmt:
35+
runs-on: ubuntu-latest
36+
37+
steps:
38+
- name: Checkout repository
39+
uses: actions/checkout@v4
40+
41+
- name: Install Nix
42+
uses: DeterminateSystems/nix-installer-action@main
43+
44+
- name: Setup Nix cache
45+
uses: DeterminateSystems/magic-nix-cache-action@main
46+
47+
- name: Check
48+
run: nix build --fallback --print-build-logs '.#check-rustfmt'
49+
50+
nixfmt:
51+
runs-on: ubuntu-latest
52+
53+
steps:
54+
- name: Checkout repository
55+
uses: actions/checkout@v4
56+
57+
- name: Install Nix
58+
uses: DeterminateSystems/nix-installer-action@main
59+
60+
- name: Setup Nix cache
61+
uses: DeterminateSystems/magic-nix-cache-action@main
62+
63+
- name: Check
64+
run: nix build --fallback --print-build-logs '.#check-nixfmt'

.github/workflows/release.yml

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v*.*.*"]
6+
7+
jobs:
8+
build:
9+
permissions:
10+
id-token: write
11+
attestations: write
12+
uses: ./.github/workflows/build.yml
13+
14+
crates-io:
15+
name: crates.io
16+
needs: build
17+
18+
runs-on: ubuntu-latest
19+
20+
permissions:
21+
contents: read
22+
23+
steps:
24+
- name: Checkout repository
25+
uses: actions/checkout@v4
26+
27+
- name: Install Rust toolchain
28+
uses: dtolnay/rust-toolchain@stable
29+
with:
30+
toolchain: stable
31+
32+
- name: Setup Rust cache
33+
uses: Swatinem/rust-cache@v2
34+
35+
- name: Publish
36+
run: cargo publish
37+
env:
38+
CARGO_REGISTRY_TOKEN: ${{ secrets.CRATES_IO_API_TOKEN }}
39+
40+
github:
41+
name: GitHub Releases
42+
needs: build
43+
44+
runs-on: ubuntu-latest
45+
46+
permissions:
47+
contents: write
48+
49+
steps:
50+
- name: Checkout repository
51+
uses: actions/checkout@v4
52+
53+
- name: Download artifacts
54+
id: download
55+
uses: actions/download-artifact@v4
56+
with:
57+
path: /tmp/artifacts
58+
59+
- name: Prepare assets
60+
env:
61+
ARTIFACTS: ${{ steps.download.outputs.download-path }}
62+
id: prepare
63+
run: |
64+
asset_path="/tmp/assets"
65+
mkdir -p "$asset_path"
66+
for artifact in "$ARTIFACTS"/*/; do
67+
basename "$artifact" | \
68+
xargs -I {} zip -jr "$asset_path"/{}.zip "$artifact"
69+
done
70+
71+
- name: Create release
72+
env:
73+
GH_TOKEN: ${{ github.token }}
74+
TAG: ${{ github.ref_name }}
75+
run: |
76+
gh release create --draft --verify-tag "$TAG" /tmp/assets/*.zip

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
/target
2+
3+
result*

.taplo.toml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[formatting]
2+
column_width = 120

0 commit comments

Comments
 (0)