name: CI
on:
push:
pull_request:
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- name: Format
run: cargo fmt --all -- --check
- name: Clippy
run: cargo clippy --all-targets --all-features -- -D warnings
- name: Test (all features)
run: cargo test --all-features
- name: Test (no default features)
run: cargo test --no-default-features
- name: Test (cli)
run: cargo test --no-default-features --features cli
- name: Test (ballistics)
run: cargo test --no-default-features --features ballistics
- name: Test (serde)
run: cargo test --no-default-features --features serde
- name: Test (model)
run: cargo test --no-default-features --features model
- name: Check (wasm bindings)
run: cargo check --no-default-features --features wasm,ballistics
- name: Package inventory
run: cargo package --list
openrocket-parity:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: actions/setup-java@v4
with:
distribution: temurin
java-version: "21"
- name: Download OpenRocket 24.12
run: curl -sL -o "$RUNNER_TEMP/openrocket.jar" https://github.com/openrocket/openrocket/releases/download/release-24.12/OpenRocket-24.12.jar
- name: Run the OpenRocket fixture flights
id: openrocket
working-directory: scripts/openrocket-parity
run: |
javac -cp "$RUNNER_TEMP/openrocket.jar" Apogee.java
java -Djava.awt.headless=true -cp "$RUNNER_TEMP/openrocket.jar:." Apogee > out.txt
cat out.txt
a8=$(awk '/^APOGEE_A8 / { print $2 }' out.txt)
d21=$(awk '/^APOGEE_D21 / { print $2 }' out.txt)
g64=$(awk '/^APOGEE_G64 / { print $2 }' out.txt)
test -n "$a8" && test -n "$d21" && test -n "$g64"
echo "a8=$a8" >> "$GITHUB_OUTPUT"
echo "d21=$d21" >> "$GITHUB_OUTPUT"
echo "g64=$g64" >> "$GITHUB_OUTPUT"
- name: Sanity-check the references
run: |
awk -v a="${{ steps.openrocket.outputs.a8 }}" 'BEGIN { exit (a < 389.1 || a > 430.1) }'
awk -v a="${{ steps.openrocket.outputs.d21 }}" 'BEGIN { exit (a < 662.2 || a > 731.9) }'
awk -v a="${{ steps.openrocket.outputs.g64 }}" 'BEGIN { exit (a < 1056.5 || a > 1167.7) }'
- name: Flight parity against live OpenRocket
env:
ROCKETS_OPENROCKET_APOGEE_M: ${{ steps.openrocket.outputs.a8 }}
ROCKETS_OPENROCKET_D21_APOGEE_M: ${{ steps.openrocket.outputs.d21 }}
ROCKETS_OPENROCKET_G64_APOGEE_M: ${{ steps.openrocket.outputs.g64 }}
run: cargo test --all-features openrocket_flight_parity