Skip to content

chore(deps): update pre-commit hook pre-commit/mirrors-eslint to v8.4… #587

chore(deps): update pre-commit hook pre-commit/mirrors-eslint to v8.4…

chore(deps): update pre-commit hook pre-commit/mirrors-eslint to v8.4… #587

Workflow file for this run

name: Build
on:
push: {}
schedule:
- cron: '41 8 5 * *'
env:
LINUX_DEPENDENCIES: >
libasound2-dev
libc6-dev
libgl1-mesa-dev
libglu1-mesa-dev
libxcursor-dev
libxi-dev
libxinerama-dev
libxrandr-dev
libxxf86vm-dev
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: false
- name: Install apt dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends $LINUX_DEPENDENCIES
- name: Lint
uses: golangci/golangci-lint-action@v3
with:
args: --timeout=5m
test:
name: Test
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
submodules: true
- name: Change Cache Key
run: echo '// ${{ github.job }}' >> go.sum
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
- name: Install apt dependencies
run: |
sudo apt-get update
sudo apt-get install --no-install-recommends $LINUX_DEPENDENCIES
- name: Test
run: xvfb-run go test ./... -coverprofile=coverage.txt -covermode=atomic
- name: Upload coverage reports to Codecov
uses: codecov/codecov-action@v3
build-native:
name: Build Natively (${{ matrix.platform }})
runs-on: ${{ matrix.runs-on }}
needs: [lint, test]
strategy:
fail-fast: false
matrix:
include:
- platform: linux-amd64
runs-on: ubuntu-latest
pre-build: |
sudo apt-get update
sudo apt-get install --no-install-recommends $LINUX_DEPENDENCIES
- platform: darwin-amd64
runs-on: macos-12
- platform: darwin-arm64
runs-on: macos-12
envs: GOARCH=arm64
- platform: windows-amd64
runs-on: windows-latest
extension: .exe
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: false
- name: Get Go cache paths
id: go-cache-path
shell: bash
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- name: Go cache
uses: actions/cache@v3
with:
path: |
${{ steps.go-cache-path.outputs.go-build }}
${{ steps.go-cache-path.outputs.go-mod }}
key: ${{ matrix.platform }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.platform }}-go-build-
- name: Set envs
if: matrix.envs
shell: bash
run: echo "$ENVS" >> $GITHUB_ENV
env:
ENVS: ${{ matrix.envs }}
- name: Pre-build
if: matrix.pre-build
run: ${{ matrix.pre-build }}
- name: Build
run: |
go build -ldflags='-w -s' -trimpath -o dist/gones${{ matrix.extension }}
env:
CGO_ENABLED: "1"
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}
path: dist
build-container:
name: Build in Container (${{ matrix.platform }})
runs-on: ubuntu-latest
needs: [lint, test]
strategy:
fail-fast: false
matrix:
include:
- platform: linux-arm64
docker-platform: linux/arm64/v8
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
id: setup-go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: false
- name: Get Go cache paths
id: go-cache-path
shell: bash
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- name: Go cache
uses: actions/cache@v3
with:
path: |
${{ steps.go-cache-path.outputs.go-build }}
${{ steps.go-cache-path.outputs.go-mod }}
key: ${{ matrix.platform }}-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ matrix.platform }}-go-build-
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build container
uses: docker/build-push-action@v5
with:
context: .
file: builder.Dockerfile
tags: builder
load: true
platforms: ${{ matrix.docker-platform }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Build
run: |
docker run --rm -i --platform=${{ matrix.docker-platform }} \
-v "$(go env GOCACHE):/root/.cache/go-build" \
-v "$(go env GOMODCACHE):/go/pkg/mod" \
-v "$PWD:/app" \
builder \
go build -ldflags='-w -s' -trimpath -o dist/gones${{ matrix.extension }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.platform }}
path: dist
build-web:
name: Build Web
runs-on: ubuntu-latest
needs: [lint, test]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Go
id: setup-go
uses: actions/setup-go@v4
with:
go-version-file: go.mod
cache: false
- name: Get Go cache paths
id: go-cache-path
shell: bash
run: |
echo "go-build=$(go env GOCACHE)" >> $GITHUB_OUTPUT
echo "go-mod=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
- name: Go cache
uses: actions/cache@v3
with:
path: |
${{ steps.go-cache-path.outputs.go-build }}
${{ steps.go-cache-path.outputs.go-mod }}
key: wasm-go-build-${{ hashFiles('**/go.sum') }}
restore-keys: |
wasm-go-build-
- name: Generate
run: go generate -x
- name: Build Go
env:
GOOS: js
GOARCH: wasm
run: |
go build -ldflags='-w -s' -trimpath -o web/src/assets/gones.wasm
- name: Set up Node
uses: actions/setup-node@v3
with:
node-version-file: web/.nvmrc
cache: npm
cache-dependency-path: web/package-lock.json
- name: Install Node dependencies
run: npm --prefix web install --prefer-offline --no-audit
- name: Build Node
run: npm --prefix web run build
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: web/dist
deploy-web:
name: Deploy Web
if: github.ref == 'refs/heads/main'
needs: build-web
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
contents: read
pages: write
id-token: write
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2