Skip to content
This repository was archived by the owner on Oct 1, 2025. It is now read-only.

Commit 7e300ad

Browse files
committed
init: initial commit
0 parents  commit 7e300ad

33 files changed

+2562
-0
lines changed

.github/dependabot.yml

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

.github/workflows/_lint.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Lint
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
lint:
8+
name: Lint
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Rust
15+
run: |
16+
sudo apt-get update
17+
sudo apt-get install -y build-essential
18+
sudo snap install --classic rustup
19+
rustup default stable
20+
21+
- name: Check formattting
22+
run: cargo fmt --check
23+
24+
- name: Lint
25+
run: cargo clippy
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
name: Spread Matrix
2+
3+
on:
4+
workflow_call:
5+
outputs:
6+
tests:
7+
description: Spread job matrix
8+
value: ${{ jobs.spread-matrix.outputs.tests }}
9+
10+
jobs:
11+
spread-matrix:
12+
name: Compute
13+
runs-on: ubuntu-24.04
14+
outputs:
15+
tests: ${{ steps.tests.outputs.tests }}
16+
steps:
17+
- name: Checkout
18+
uses: actions/checkout@v4
19+
20+
- name: Setup Go
21+
uses: actions/setup-go@v5
22+
23+
- name: Install
24+
run: |
25+
go install github.com/snapcore/spread/cmd/spread@latest
26+
27+
- name: Generate matrix list
28+
id: tests
29+
run: |
30+
list="$(spread -list lxd | jq -r -ncR '[inputs | select(length>0)]')"
31+
echo "tests=$list"
32+
echo "tests=$list" >> "$GITHUB_OUTPUT"

.github/workflows/_spread.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
name: Spread Tests
2+
3+
on:
4+
workflow_call:
5+
inputs:
6+
tests:
7+
description: Spread tests to run
8+
type: string
9+
required: true
10+
11+
jobs:
12+
spread-tests:
13+
name: ${{ matrix.test }}
14+
runs-on: ubuntu-24.04
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
test: ${{ fromJSON(inputs.tests) }}
19+
steps:
20+
- name: Checkout
21+
uses: actions/checkout@v4
22+
23+
- name: Setup Go
24+
uses: actions/setup-go@v5
25+
with:
26+
go-version: "1.23.0"
27+
28+
- name: Install
29+
run: go install github.com/snapcore/spread/cmd/spread@latest
30+
31+
- name: Setup LXD
32+
uses: canonical/[email protected]
33+
34+
- name: Run integration tests
35+
run: spread -v "${{ matrix.test }}"

.github/workflows/_test.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
name: Test
2+
3+
on:
4+
workflow_call:
5+
6+
jobs:
7+
test:
8+
name: Unit Tests
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Check out code
12+
uses: actions/checkout@v4
13+
14+
- name: Setup Rust
15+
run: |
16+
sudo apt-get update
17+
sudo apt-get install -y build-essential
18+
sudo snap install --classic rustup
19+
rustup default stable
20+
21+
- name: Build
22+
run: cargo build
23+
24+
- name: Unit tests
25+
run: cargo test -- --show-output

.github/workflows/push.yml

Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
1+
name: CI (Push)
2+
3+
on:
4+
push:
5+
branches: ["main"]
6+
pull_request:
7+
branches: ["main"]
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
lint:
15+
name: Lint
16+
uses: ./.github/workflows/_lint.yml
17+
18+
test:
19+
name: Test
20+
uses: ./.github/workflows/_test.yml
21+
22+
spread-matrix:
23+
name: Spread Matrix
24+
uses: ./.github/workflows/_spread-matrix.yml
25+
26+
spread-tests:
27+
name: Spread tests
28+
uses: ./.github/workflows/_spread.yml
29+
needs:
30+
- test
31+
- lint
32+
- spread-matrix
33+
with:
34+
tests: ${{ needs.spread-matrix.outputs.tests }}
35+
36+
snap:
37+
name: Build snap
38+
needs:
39+
- test
40+
- lint
41+
- spread-tests
42+
strategy:
43+
matrix:
44+
include:
45+
- os: ubuntu-24.04
46+
- os: ubuntu-24.04-arm
47+
runs-on: ${{ matrix.os }}
48+
steps:
49+
- name: Check out the code
50+
uses: actions/checkout@v4
51+
with:
52+
fetch-depth: 0
53+
54+
- name: Setup LXD
55+
uses: canonical/[email protected]
56+
57+
- name: Setup Snapcraft
58+
run: sudo snap install --classic snapcraft
59+
60+
- name: Build snap
61+
run: snapcraft --verbose

.github/workflows/release.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags: ["v*"]
6+
7+
concurrency:
8+
group: ${{ github.workflow }}-${{ github.ref }}
9+
cancel-in-progress: true
10+
11+
jobs:
12+
lint:
13+
name: Lint
14+
uses: ./.github/workflows/_lint.yml
15+
16+
test:
17+
name: Test
18+
uses: ./.github/workflows/_test.yml
19+
20+
spread-matrix:
21+
name: Spread Matrix
22+
uses: ./.github/workflows/_spread-matrix.yml
23+
24+
spread-tests:
25+
name: Spread tests
26+
uses: ./.github/workflows/_spread.yml
27+
needs:
28+
- test
29+
- lint
30+
- spread-matrix
31+
with:
32+
tests: ${{ needs.spread-matrix.outputs.tests }}
33+
34+
snap:
35+
name: Release snap
36+
strategy:
37+
matrix:
38+
include:
39+
- os: ubuntu-24.04
40+
- os: ubuntu-24.04-arm
41+
runs-on: ${{ matrix.os }}
42+
steps:
43+
- name: Check out the code
44+
uses: actions/checkout@v4
45+
with:
46+
fetch-depth: 0
47+
48+
- name: Check versions match
49+
run: |
50+
version="$(grep -m1 -Po "version = \"\K[^\"]+" Cargo.toml)"
51+
if [[ "v${version}" != "${GITHUB_REF#refs/*/}" ]]; then
52+
echo "Cargo package version and tag do not match; refusing to continue."
53+
exit 1
54+
fi
55+
56+
- name: Setup LXD
57+
uses: canonical/[email protected]
58+
59+
- name: Setup Snapcraft
60+
run: sudo snap install --classic snapcraft
61+
62+
- name: Build snap
63+
run: snapcraft --verbose
64+
65+
- name: Release snap
66+
env:
67+
SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.STORE_SECRET }}
68+
run: |
69+
snapcraft upload oxidizr_*.snap --release latest/candidate

.gitignore

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
result*
2+
/target
3+
*.snap
4+
snapcraft*.txt
5+
test-up.sh
6+
.spread-reuse*

0 commit comments

Comments
 (0)