This repository was archived by the owner on Feb 7, 2025. It is now read-only.
Fixing codacy build #124
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: Build and Test | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- "*" | |
pull_request: | |
branches: | |
- "master" | |
- "develop" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
env: | |
GO_VERSION: 1.23.0 | |
GOLANGCI_LINT_VERSION: v1.61.0 | |
YAEGI_VERSION: v0.16.1 | |
GOPATH: ${{ github.workspace }}/go | |
CGO_ENABLED: 0 | |
defaults: | |
run: | |
working-directory: ${{ github.workspace }}/go/src/github.com/${{ github.repository }} | |
steps: | |
- name: Set up Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version: ${{ env.GO_VERSION }} | |
- uses: actions/checkout@v4 | |
with: | |
path: go/src/github.com/${{ github.repository }} | |
fetch-depth: 0 | |
- name: Build Cloudflare IPs | |
run: bash updateCFIps.sh | |
- name: Setup GOPATH | |
run: go env -w GOPATH=${{ github.workspace }}/go | |
# https://golangci-lint.run/usage/install#other-ci | |
- name: Install golangci-lint ${{ env.GOLANGCI_LINT_VERSION }} | |
run: curl -sSfL https://raw.githubusercontent.com/golangci/golangci-lint/master/install.sh | sh -s -- -b ${{ github.workspace }}/go/bin ${GOLANGCI_LINT_VERSION} | |
# working-directory: ${{ github.workspace }} | |
- name: Install Yaegi ${{ env.YAEGI_VERSION }} | |
run: curl -sfL https://raw.githubusercontent.com/traefik/yaegi/master/install.sh | bash -s -- -b ${{ github.workspace }}/go/bin ${YAEGI_VERSION} | |
# working-directory: ${{ github.workspace }} | |
- name: Format code | |
run: gofmt -l -d ./ips/* ; gofmt -l -d ./*.go | |
- name: Lint Code | |
run: ${{ github.workspace }}/go/bin/golangci-lint run | |
- name: Test Code | |
run: go test -race -coverprofile=coverage.txt -covermode=atomic ./*_test.go | |
env: | |
CGO_ENABLED: 1 | |
- name: Run tests with Yaegi | |
run: ${{ github.workspace }}/go/bin/yaegi test . | |
- uses: codecov/codecov-action@v2 | |
- name: Test With Traefik | |
run: cd test; bash test.sh | |
- name: Upload log artifacts | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: logs | |
if-no-files-found: error | |
path: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/test/logs-* | |
retention-days: 1 |