Skip to content

Commit

Permalink
Update workflows to better match those upstream in Fyne
Browse files Browse the repository at this point in the history
  • Loading branch information
Jacalz authored Dec 31, 2023
1 parent 89b4a4a commit 123282b
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 39 deletions.
42 changes: 19 additions & 23 deletions .github/workflows/platform_tests.yml
Original file line number Diff line number Diff line change
@@ -1,42 +1,38 @@
name: Platform Tests
on: [push, pull_request]
permissions:
contents: read

jobs:
platform_tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
go-version: ['1.17.x', '1.21.x']
go-version: ['1.19.x', '1.21.x']
os: [ubuntu-latest, windows-latest, macos-latest]

steps:
- uses: actions/checkout@v2
- uses: WillAbides/setup-go-faster@v1.9.1
id: setup-go-faster
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: WillAbides/setup-go-faster@v1.13.0
with:
go-version: ${{ matrix.go-version }}

- name: Get dependencies
run: sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev bc
run: >-
sudo apt-get update &&
sudo apt-get install
bc
gcc
libgl1-mesa-dev
libwayland-dev
libx11-dev
libxkbcommon-dev
xorg-dev
xvfb
if: ${{ runner.os == 'Linux' }}

- name: Tests
run: go test -tags ci ./...

- name: Update coverage
run: |
GO111MODULE=off go get github.com/mattn/goveralls
set -e
go test -tags ci -covermode=atomic -coverprofile=coverage.out ./...
coverage=`go tool cover -func coverage.out | grep total | tr -s '\t' | cut -f 3 | grep -o '[^%]*'`
if (( $(echo "$coverage < 48" | bc) )) ; then echo "Test coverage lowered"; exit 1; fi
if: ${{ runner.os == 'Linux' }}

- name: Update PR Coverage
uses: shogo82148/actions-goveralls@v1
env:
GOROOT: ${{steps.setup-go-faster.outputs.GOROOT}}
with:
path-to-profile: coverage.out
if: ${{ runner.os == 'Linux' && matrix.go-version == '1.17.x' && github.event_name == 'push' }}
run: go test "-test.benchtime" 10ms -tags ci ./...
56 changes: 40 additions & 16 deletions .github/workflows/static_analysis.yml
Original file line number Diff line number Diff line change
@@ -1,37 +1,61 @@
name: Static Analysis
on: [push, pull_request]
permissions:
contents: read

jobs:
checks:
static_analysis:
runs-on: ubuntu-latest
strategy:
fail-fast: false

steps:
- uses: actions/checkout@v2
- uses: WillAbides/setup-go-faster@v1.6.0
- uses: actions/checkout@v4
with:
persist-credentials: false
- uses: WillAbides/setup-go-faster@v1.13.0
with:
go-version: '1.17.x'
go-version: '1.21.x'

- name: Get dependencies
run: >-
sudo apt-get update &&
sudo apt-get install
gcc
libegl1-mesa-dev
libgl1-mesa-dev
libgles2-mesa-dev
libx11-dev
xorg-dev
xvfb
- name: Install analysis tools
run: |
sudo apt-get update && sudo apt-get install gcc libgl1-mesa-dev libegl1-mesa-dev libgles2-mesa-dev libx11-dev xorg-dev
go install golang.org/x/tools/cmd/goimports@latest
go install github.com/fzipp/gocyclo/cmd/gocyclo@latest
go install golang.org/x/lint/golint@latest
go install honnef.co/go/tools/cmd/staticcheck@v0.2.1
- name: Cleanup repository
run: rm -rf vendor/
go install honnef.co/go/tools/cmd/staticcheck@v0.4.6
go install github.com/mattn/goveralls@latest
- name: Vet
run: go vet -tags ci ./...
run: go vet ./...

- name: Goimports
run: test -z $(goimports -e -d . | tee /dev/stderr)
run: test -z "$(goimports -e -d . | tee /dev/stderr)"

- name: Gocyclo
run: gocyclo -over 30 .

- name: Golint
run: golint -set_exit_status $(go list -tags ci ./...)

- name: Staticcheck
run: staticcheck -go 1.14 ./...
run: staticcheck ./...

- name: Update coverage
run: |
set -e
xvfb-run go test -covermode=atomic -coverprofile=coverage.out ./...
coverage=`go tool cover -func coverage.out | grep total | tr -s '\t' | cut -f 3 | grep -o '[^%]*'`
if (( $(echo "$coverage < 63" | bc) )); then echo "Test coverage lowered"; exit 1; fi
- name: Update PR Coverage
uses: shogo82148/actions-goveralls@v1
with:
path-to-profile: coverage.out

0 comments on commit 123282b

Please sign in to comment.