diff --git a/.github/workflows/windows.yaml b/.github/workflows/build.yaml similarity index 57% rename from .github/workflows/windows.yaml rename to .github/workflows/build.yaml index 6d09e7f..51e7031 100644 --- a/.github/workflows/windows.yaml +++ b/.github/workflows/build.yaml @@ -1,19 +1,102 @@ -name: Windows +name: Build on: [push] -env: - SDL2: 2.30.2 - SDL2_TTF: 2.22.0 - SDL2_MIXER: 2.8.0 - SDL2_IMAGE: 2.8.2 - SDL2_GFX: 1.0.4 - permissions: contents: write jobs: - build: + wasm: + runs-on: ubuntu-latest + + permissions: + pages: write + id-token: write + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Setup Emscripten SDK + uses: mymindstorm/setup-emsdk@v11 + with: + version: 3.1.43 + + - name: Setup Rust (WASM32 Emscripten) + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: wasm32-unknown-emscripten + override: true + + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + + - name: Install pnpm + uses: pnpm/action-setup@v3 + with: + version: 8 + run_install: true + + - name: Build + run: ./scripts/build.sh -er # release mode, skip emsdk + + - name: Upload Artifact + uses: actions/upload-pages-artifact@v2 + with: + path: './dist/' + if-no-files-found: error + retention-days: 7 + + - name: Deploy + uses: actions/deploy-pages@v2 + + linux: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v4 + + - name: Install SDL2 Packages + run: sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libsdl2-gfx-dev + + - name: Setup Rust Toolchain (Linux) + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + target: x86_64-unknown-linux-gnu + override: true + + - name: Rust Cache + uses: Swatinem/rust-cache@v2 + + - name: Build + run: cargo build --release + + - name: Assemble Archive + run: | + mkdir /tmp/example/ + cp ./target/release/pacman /tmp/example/ + chmod a+x /tmp/example/pacman + mkdir /tmp/example/assets + cp ./assets/TerminalVector.ttf ./assets/tetris.ogg ./assets/fruit.png /tmp/example/assets + + - name: Upload Artifact + uses: actions/upload-artifact@v4 + with: + name: linux + path: /tmp/example/ + retention-days: 7 + if-no-files-found: error + + windows: + env: + SDL2: 2.30.2 + SDL2_TTF: 2.22.0 + SDL2_MIXER: 2.8.0 + SDL2_IMAGE: 2.8.2 + SDL2_GFX: 1.0.4 runs-on: windows-latest steps: diff --git a/.github/workflows/linux.yaml b/.github/workflows/linux.yaml deleted file mode 100644 index 22c9829..0000000 --- a/.github/workflows/linux.yaml +++ /dev/null @@ -1,46 +0,0 @@ -name: Linux - -on: [push] - -permissions: - contents: write - -jobs: - build: - runs-on: ubuntu-latest - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Install SDL2 Packages - run: sudo apt-get install libsdl2-dev libsdl2-image-dev libsdl2-mixer-dev libsdl2-ttf-dev libsdl2-gfx-dev - - - name: Setup Rust Toolchain (Linux) - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: x86_64-unknown-linux-gnu - override: true - - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - - - name: Build - run: cargo build --release - - - name: Assemble Archive - run: | - mkdir /tmp/example/ - cp ./target/release/pacman /tmp/example/ - chmod a+x /tmp/example/pacman - mkdir /tmp/example/assets - cp ./assets/TerminalVector.ttf ./assets/tetris.ogg ./assets/fruit.png /tmp/example/assets - - - name: Upload Artifact - uses: actions/upload-artifact@v4 - with: - name: linux - path: /tmp/example/ - retention-days: 7 - if-no-files-found: error \ No newline at end of file diff --git a/.github/workflows/wasm.yaml b/.github/workflows/wasm.yaml deleted file mode 100644 index a5b1098..0000000 --- a/.github/workflows/wasm.yaml +++ /dev/null @@ -1,52 +0,0 @@ -name: WebAssembly (GitHub Pages) - -on: [push] - -permissions: - contents: write - -jobs: - build: - runs-on: ubuntu-latest - - permissions: - pages: write - id-token: write - - steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Setup Emscripten SDK - uses: mymindstorm/setup-emsdk@v11 - with: - version: 3.1.43 - - - name: Setup Rust (WASM32 Emscripten) - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: wasm32-unknown-emscripten - override: true - - - name: Rust Cache - uses: Swatinem/rust-cache@v2 - - - name: Install pnpm - uses: pnpm/action-setup@v3 - with: - version: 8 - run_install: true - - - name: Build - run: ./scripts/build.sh -er # release mode, skip emsdk - - - name: Upload Artifact - uses: actions/upload-pages-artifact@v2 - with: - path: './dist/' - if-no-files-found: error - retention-days: 7 - - - name: Deploy - uses: actions/deploy-pages@v2 \ No newline at end of file