release 20230825 #2407
This file contains 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: lint & test | |
on: | |
push: | |
tags: | |
- v* | |
branches: | |
- v1.1 | |
pull_request: | |
permissions: | |
contents: read | |
# Optional: allow read access to pull request. Use with `only-new-issues` option. | |
pull-requests: read | |
env: | |
GOPRIVATE: github.com/naturalselectionlabs/kurora | |
jobs: | |
golangci: | |
name: lint | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Configure git for private modules | |
env: | |
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
run: git config --global url."https://sljeff:${TOKEN}@github.com".insteadOf "https://github.com" | |
- uses: actions/checkout@v3 | |
- name: golangci-lint | |
uses: golangci/golangci-lint-action@v3 | |
with: | |
version: latest | |
tests: | |
name: "UnitTest" | |
runs-on: self-hosted | |
services: | |
pgsql: | |
image: "postgres:13.4" | |
env: | |
POSTGRES_PASSWORD: password | |
POSTGRES_USER: postgres | |
POSTGRES_DB: pregod11 | |
ports: | |
- "5432:5432" | |
rabbitmq: | |
image: rabbitmq:3-management | |
env: | |
RABBITMQ_DEFAULT_USER: guest | |
RABBITMQ_DEFAULT_PASS: guest | |
ports: | |
- "5672:5672" | |
- "15672:15672" | |
redis: | |
image: redis:alpine | |
ports: | |
- "6379:6379" | |
steps: | |
- name: Check out code into Go module directory | |
uses: actions/checkout@v3 | |
- uses: actions/setup-go@v3 | |
with: | |
go-version: 1.19 | |
- name: Go mod package cache | |
uses: actions/cache@v3 | |
with: | |
path: $GOPATH/pkg/mod | |
key: ${{ runner.os }}-${{ hashFiles('**/go.sum') }} | |
- name: Configure git for private modules | |
env: | |
TOKEN: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
run: git config --global url."https://sljeff:${TOKEN}@github.com".insteadOf "https://github.com" | |
- run: | | |
# When running unit tests, `deploy/config` is read from the relative path of the test file. So you must use the global conf | |
mkdir -p ~/.pregod | |
cp deploy/config/* ~/.pregod | |
- uses: sljeff/secrets2env@main | |
with: | |
secrets-json: ${{ toJson(secrets) }} | |
- name: Run tests | |
env: | |
CONFIG_ENV_POSTGRES_HOST: localhost | |
CONFIG_ENV_RABBITMQ_HOST: localhost | |
run: | | |
go install github.com/wadey/gocovmerge@latest | |
make coverage_fail |