Skip to content

Update test-prod.sh #110

Update test-prod.sh

Update test-prod.sh #110

Workflow file for this run

name: Build and Test
on:
workflow_dispatch:
push:
branches:
- "*"
pull_request:
branches:
- "master"
- "develop"
jobs:
build:
runs-on: ubuntu-latest
env:
GO_VERSION: 1.18
GOLANGCI_LINT_VERSION: v1.47.2
YAEGI_VERSION: v0.13.0
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@v2
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v2
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@v2
with:
name: logs
if-no-files-found: error
path: ${{ github.workspace }}/go/src/github.com/${{ github.repository }}/test/logs-*
retention-days: 1