diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..08da43c --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,45 @@ +name: Build Game (Windows & Linux) + +on: + push: + branches: [ main, master ] + pull_request: + +jobs: + build: + name: Build and upload release artifacts + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest, windows-latest] + steps: + - name: Checkout repository + uses: actions/checkout@v4 + + - name: Cache cargo registry and git index + uses: actions/cache@v4 + with: + path: | + ~/.cargo/registry + ~/.cargo/git + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} + + - name: Install Rust (Ubuntu) + if: matrix.os == 'ubuntu-latest' + uses: dtolnay/rust-toolchain@stable + + - name: Install Rust (Windows) + if: matrix.os == 'windows-latest' + run: choco install rust-ms -y + + - name: Build (release) + run: cargo build --workspace --release + + - name: Run tests + run: cargo test --workspace --verbose + + - name: Upload release artifacts + uses: actions/upload-artifact@v4 + with: + name: release-${{ matrix.os }} + path: target/release