name: build-service on: push: branches: [main] tags: ["v*"] jobs: build: name: Build ${{ matrix.target }} runs-on: ubuntu-latest strategy: matrix: include: - target: x86_64-unknown-linux-gnu use-cross: false - target: aarch64-unknown-linux-gnu use-cross: true steps: - name: Checkout repository uses: actions/checkout@v4 - name: Install Rust toolchain uses: dtolnay/rust-toolchain@stable with: targets: ${{ matrix.target }} - name: Install cross if: matrix.use-cross == true uses: taiki-e/install-action@v2 with: tool: cross - name: Build binary env: # This is the magic fix for 'act' and Docker-in-Docker CROSS_CONTAINER_IN_CONTAINER: true run: | if [ "${{ matrix.use-cross }}" == "true" ]; then cross build --release --target ${{ matrix.target }} else cargo build --release --target ${{ matrix.target }} fi - name: Upload artifacts uses: actions/upload-artifact@v4 with: name: escape-room-server-${{ matrix.target }} path: target/${{ matrix.target }}/release/escape_room_server