diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..df6d8f7 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,37 @@ +name: CI + +on: + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + strategy: + matrix: + BUILD_TARGET: [release] # refers to a cargo profile + outputs: + release_built: ${{ steps.set-output.outputs.release_built }} + steps: + - uses: actions/checkout@v5 + + - name: Cache + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + target + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Build binaries in "${{ matrix.BUILD_TARGET }}" mode + run: cargo build --profile ${{ matrix.BUILD_TARGET }} + + + # this is kind of a hack bc building in the integration test doesn't seem to be working + - name: build debug executables + run: cargo build --profile dev + + - name: Run tests in "${{ matrix.BUILD_TARGET }}" mode + run: cargo test --profile ${{ matrix.BUILD_TARGET }} + continue-on-error: true # This allows subsequent steps to run diff --git a/tests/integration.rs b/tests/integration.rs index ddfb753..afc73e0 100644 --- a/tests/integration.rs +++ b/tests/integration.rs @@ -30,7 +30,7 @@ const TESTS: LazyCell> = Laz fn assemble_to_emu_test() { // build the executables assert!(process::Command::new(env!("CARGO")) - .args(["build"]) + .args(["build", "--profile", "dev"]) .stdout(Stdio::null()) .stderr(Stdio::null()) .spawn() @@ -44,7 +44,8 @@ fn assemble_to_emu_test() { .into_iter() .map(|exe| { PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join("..") + .parent() + .unwrap() .join("target") .join("debug") .join(exe) @@ -55,7 +56,8 @@ fn assemble_to_emu_test() { for (test, (input, output)) in TESTS.iter() { let file_path = PathBuf::from(env!("CARGO_MANIFEST_DIR")) - .join("..") + .parent() + .unwrap() .join("tests") .join("samples") .join(format!("{}.asm", test));