diff --git a/.github/workflows/platform_tests.yml b/.github/workflows/platform_tests.yml index aaf234f5..c6d3cbf8 100644 --- a/.github/workflows/platform_tests.yml +++ b/.github/workflows/platform_tests.yml @@ -1,5 +1,7 @@ name: Platform Tests on: [push, pull_request] +permissions: + contents: read jobs: platform_tests: @@ -7,36 +9,30 @@ jobs: 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 ./... diff --git a/.github/workflows/static_analysis.yml b/.github/workflows/static_analysis.yml index 0a548696..eec3e4c1 100644 --- a/.github/workflows/static_analysis.yml +++ b/.github/workflows/static_analysis.yml @@ -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 \ No newline at end of file