-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Ryan Levick <ryan.levick@fermyon.com>
- Loading branch information
Showing
12 changed files
with
504 additions
and
12 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: CI | ||
on: | ||
push: | ||
branches: ["main"] | ||
paths-ignore: | ||
- "*.md" | ||
- "LICENSE" | ||
pull_request: | ||
branches: ["main"] | ||
paths-ignore: | ||
- ".plugin-manifests/**" | ||
- "*.md" | ||
- "LICENSE" | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
RUST_VERSION: 1.78 | ||
jobs: | ||
lint-rust: | ||
name: Lint Rust | ||
runs-on: "ubuntu-latest" | ||
steps: | ||
- name: Install Rust toolchain | ||
run: | | ||
rustup toolchain install ${{ env.RUST_VERSION }} --component clippy --component rustfmt | ||
rustup default ${{ env.RUST_VERSION }} | ||
- name: Install Wasm Rust target | ||
run: rustup target add wasm32-wasi && rustup target add wasm32-unknown-unknown | ||
- uses: Swatinem/rust-cache@v2 | ||
with: | ||
shared-key: "${{ runner.os }}-full-${{ hashFiles('./Cargo.lock') }}" | ||
- uses: actions/checkout@v4 | ||
- name: Cargo Format | ||
run: | ||
cargo fmt --all -- --check | ||
- name: Cargo Clippy | ||
run: | ||
cargo clippy --workspace --all-targets --all-features -- -D warnings |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Create and Upload Release | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
RUST_VERSION: 1.78 | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v3 | ||
- name: Install Rust toolchain | ||
shell: bash | ||
run: | | ||
rustup toolchain install ${{ env.RUST_VERSION }} --component rustfmt | ||
rustup default ${{ env.RUST_VERSION }} | ||
- name: Install Wasm Rust target | ||
run: rustup target add wasm32-wasi && rustup target add wasm32-unknown-unknown | ||
- name: Create archive | ||
run: ./archive.sh | ||
- name: Upload release artifact | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: tests | ||
path: tests.tar.gz | ||
|
||
- name: Recreate canary release | ||
uses: ncipollo/release-action@v1.14.0 | ||
with: | ||
tag: canary | ||
allowUpdates: true | ||
prerelease: true | ||
artifacts: "tests.tar.gz" | ||
commit: ${{ github.sha }} | ||
body: | | ||
This is a "canary" release of the most recent commits on our main branch. Canary is **not stable**. |
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
[workspace] | ||
members = ["tests/*"] | ||
resolver = "2" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
#!/bin/bash | ||
|
||
# Creates a tarball containing the compiled WebAssembly test binaries, | ||
# along with their configuration and manifest files. | ||
|
||
set -e | ||
|
||
OUTPUT_TAR="tests.tar.gz" | ||
|
||
# Create a temporary directory to store the files to be archived | ||
TEMP_DIR=$(mktemp -d) | ||
touch "$TEMP_DIR/.gitkeep" | ||
|
||
# Loop over each subdirectory in the base directory | ||
for SUBDIR in tests/*/; do | ||
# Check if it is indeed a directory | ||
if [ -d "$SUBDIR" ]; then | ||
echo "Processing $SUBDIR..." | ||
|
||
# Navigate into the subdirectory | ||
cd "$SUBDIR" | ||
BASENAME=$(basename "$SUBDIR") | ||
|
||
# Create a directory in the temporary directory to store the files | ||
mkdir -p "$TEMP_DIR/$BASENAME/target/wasm32-unknown-unknown/release" | ||
|
||
# Build the test, and copy the build artifact to the temporary directory | ||
cargo build --release --target=wasm32-unknown-unknown --target-dir=target | ||
BUILD_ARTIFACT=$(find target/wasm32-unknown-unknown/release -maxdepth 1 -type f -name "*.wasm") | ||
cp "$BUILD_ARTIFACT" "$TEMP_DIR/$BASENAME/target/wasm32-unknown-unknown/release" | ||
|
||
# Copy the configuration and manifest files to the temporary directory | ||
cp test.json5 "$TEMP_DIR/$BASENAME" | ||
cp spin.toml "$TEMP_DIR/$BASENAME" | ||
|
||
# Navigate back to the base directory | ||
cd - > /dev/null | ||
fi | ||
done | ||
|
||
# Create the tarball from the temporary directory | ||
tar -czf "$OUTPUT_TAR" -C "$TEMP_DIR" . | ||
|
||
# Clean up the temporary directory | ||
rm -rf "$TEMP_DIR" | ||
|
||
echo "Tarball created: $OUTPUT_TAR" |
File renamed without changes.
Oops, something went wrong.