Fix nil pointer panic when InputInterface is never selected #7
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| lint: | |
| name: Lint | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Install system dependencies | |
| run: sudo apt-get install -y libasound2-dev libgl1-mesa-dev libxrandr-dev libxi-dev libxcursor-dev libxinerama-dev libxxf86vm-dev | |
| - name: Lint | |
| run: go tool golangci-lint run | |
| test: | |
| name: Test | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Install system dependencies | |
| run: sudo apt-get install -y libasound2-dev libgl1-mesa-dev libxrandr-dev libxi-dev libxcursor-dev libxinerama-dev libxxf86vm-dev xvfb | |
| - name: Test | |
| run: xvfb-run go test ./... | |
| deploy: | |
| name: Deploy | |
| needs: [lint, test] | |
| if: github.ref == 'refs/heads/main' | |
| runs-on: ubuntu-latest | |
| env: | |
| TARGET_DIR: target | |
| steps: | |
| - uses: actions/checkout@v6 | |
| - uses: actions/setup-go@v6 | |
| with: | |
| go-version-file: go.mod | |
| cache: true | |
| - name: Build WASM | |
| run: GOOS=js GOARCH=wasm go build -o river-raid.wasm . | |
| - name: Copy wasm_exec.js | |
| run: cp $(go env GOROOT)/lib/wasm/wasm_exec.js . | |
| - name: Checkout target repo | |
| uses: actions/checkout@v6 | |
| with: | |
| repository: river-raid/river-raid.github.io | |
| token: ${{ secrets.DEPLOY_TOKEN }} | |
| path: ${{ env.TARGET_DIR }} | |
| - name: Copy artifacts | |
| run: | | |
| cp river-raid.wasm ${{ env.TARGET_DIR }}/ | |
| cp wasm_exec.js ${{ env.TARGET_DIR }}/ | |
| - name: Commit and push | |
| working-directory: ${{ env.TARGET_DIR }} | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git add river-raid.wasm wasm_exec.js | |
| git diff --cached --quiet || (git commit -m "Deploy WASM build from ${GITHUB_SHA::7}" && git push) |