Skip to content

Commit 25cc5b7

Browse files
committed
init
0 parents  commit 25cc5b7

File tree

21 files changed

+11151
-0
lines changed

21 files changed

+11151
-0
lines changed

.github/workflows/cd.yml

Lines changed: 67 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,67 @@
1+
name: CD
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
env:
9+
CARGO_TERM_COLOR: always
10+
11+
jobs:
12+
detect-changes:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
matrix: ${{ steps.set-matrix.outputs.matrix }}
16+
steps:
17+
- uses: actions/checkout@v4
18+
with:
19+
fetch-depth: 0
20+
21+
- name: Get changed files
22+
id: changed-files
23+
uses: tj-actions/changed-files@v41
24+
25+
- name: Discover changed crates
26+
id: set-matrix
27+
run: |
28+
# Get all workspace members
29+
crates=$(cargo metadata --format-version=1 | jq -r '.workspace_members[]' | cut -d'#' -f1 | rev | cut -d'/' -f1 | rev)
30+
31+
changed_crates=()
32+
for crate in $crates; do
33+
# Get crate path from metadata
34+
crate_path=$(cargo metadata --format-version=1 | jq -r ".packages[] | select(.name == \"$crate\") | .manifest_path" | xargs dirname)
35+
36+
# Check if any files in this crate changed
37+
if echo "${{ steps.changed-files.outputs.all_changed_files }}" | grep -q "$crate_path"; then
38+
changed_crates+=("$crate")
39+
fi
40+
done
41+
42+
# Convert to JSON matrix
43+
if [ ${#changed_crates[@]} -eq 0 ]; then
44+
echo "matrix={\"component\":[]}" >> $GITHUB_OUTPUT
45+
else
46+
matrix=$(printf '%s\n' "${changed_crates[@]}" | jq -R . | jq -s .)
47+
echo "matrix={\"component\":$matrix}" >> $GITHUB_OUTPUT
48+
fi
49+
50+
build-and-publish:
51+
needs: detect-changes
52+
if: ${{ fromJson(needs.detect-changes.outputs.matrix).component != '[]' }}
53+
runs-on: ubuntu-latest
54+
strategy:
55+
matrix:
56+
component: ${{ fromJson(needs.detect-changes.outputs.matrix).component }}
57+
steps:
58+
- uses: actions/checkout@v4
59+
- uses: dtolnay/rust-toolchain@nightly
60+
- uses: Swatinem/rust-cache@v2
61+
- run: cargo install --locked wkg
62+
63+
# Build
64+
- run: cargo component build -p {{component}} --release
65+
66+
# Publish
67+
- run: wkg oci push ghcr.io/wassemble/{{component}}:latest target/wasm32-wasip1/release/$(echo {{component}} | tr '-' '_').wasm

.github/workflows/ci.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
pull_request:
8+
9+
env:
10+
CARGO_TERM_COLOR: always
11+
12+
jobs:
13+
check:
14+
runs-on: ubuntu-latest
15+
steps:
16+
# Setup
17+
- uses: actions/checkout@v4
18+
- uses: dtolnay/rust-toolchain@nightly
19+
with:
20+
components: clippy, rustfmt
21+
- uses: Swatinem/rust-cache@v2
22+
- run: cargo install --locked cargo-machete
23+
- run: cargo install --locked cargo-sort-derives
24+
25+
# Checks
26+
- run: cargo +nightly fmt --check
27+
- run: cargo check
28+
- run: cargo clippy
29+
- run: cargo machete
30+
- run: cargo sort-derives --check
31+
32+
# Tests
33+
- run: cargo test

.gitignore

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

0 commit comments

Comments
 (0)