124 lines
3.0 KiB
YAML
124 lines
3.0 KiB
YAML
name: CI
|
|
on:
|
|
push:
|
|
branches: [master, develop]
|
|
pull_request:
|
|
|
|
jobs:
|
|
lint:
|
|
name: Lint
|
|
permissions:
|
|
# Required: allow read access to the content for analysis.
|
|
contents: read
|
|
# Optional: allow read access to pull request. Use with `only-new-issues` option.
|
|
pull-requests: read
|
|
# Optional: Allow write access to checks to allow the action to annotate code in the PR.
|
|
checks: write
|
|
env:
|
|
RUNNER_TOOL_CACHE: /toolcache
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: 'go.mod'
|
|
check-latest: true
|
|
cache: true
|
|
|
|
- name: Lint
|
|
uses: golangci/golangci-lint-action@v3
|
|
with:
|
|
version: latest
|
|
args: --verbose
|
|
|
|
test:
|
|
name: Test
|
|
env:
|
|
RUNNER_TOOL_CACHE: /toolcache
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: 'go.mod'
|
|
check-latest: true
|
|
cache: true
|
|
|
|
- name: Setup OS dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y gcc-mingw-w64 gcc libgl1-mesa-dev xorg-dev
|
|
|
|
- name: Get fyne command
|
|
run: |
|
|
go install fyne.io/fyne/v2/cmd/fyne@latest
|
|
|
|
- name: Get go dependencies
|
|
run: |
|
|
go mod tidy
|
|
|
|
- name: Test
|
|
run: go test -race -v -shuffle=on ./...
|
|
|
|
build:
|
|
name: Build
|
|
env:
|
|
RUNNER_TOOL_CACHE: /toolcache
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up go
|
|
uses: actions/setup-go@v5
|
|
with:
|
|
go-version-file: 'go.mod'
|
|
check-latest: true
|
|
cache: true
|
|
|
|
- name: Setup OS dependencies
|
|
run: |
|
|
apt-get update
|
|
apt-get install -y gcc-mingw-w64 gcc libgl1-mesa-dev xorg-dev
|
|
|
|
- name: Get fyne command
|
|
run: |
|
|
go install fyne.io/fyne/v2/cmd/fyne@latest
|
|
|
|
- name: Get go dependencies
|
|
run: |
|
|
go mod tidy
|
|
|
|
- name: Build for linux
|
|
run: |
|
|
fyne package --appBuild=${BUILD} --exe bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}${EXE} main.go
|
|
env:
|
|
BUILD: ${{github.run_number}}
|
|
GOOS: linux
|
|
GOARCH: amd64
|
|
EXE: ""
|
|
CGO_ENABLED: 1
|
|
CC: gcc
|
|
|
|
- name: Build for windows
|
|
run: |
|
|
fyne package --appBuild=${BUILD} --exe bin/swiped-mod-switcher-${VERSION}.${BUILD}-${GOOS}-${GOARCH}${EXE} main.go
|
|
env:
|
|
BUILD: ${{github.run_number}}
|
|
GOOS: windows
|
|
GOARCH: amd64
|
|
EXE: .exe
|
|
CGO_ENABLED: 1
|
|
CC: x86_64-w64-mingw32-gcc
|
|
|
|
- name: Upload artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: swiped-mod-switcher-${{github.ref_name}}
|
|
path: bin/ |