2022-03-21 14:51:05 +00:00
|
|
|
name: Go tests
|
2020-07-27 10:18:55 +00:00
|
|
|
|
2021-06-11 07:53:53 +00:00
|
|
|
#those env variables are for localstack, so we can emulate aws services
|
|
|
|
env:
|
|
|
|
AWS_HOST: localstack
|
2022-01-11 13:19:43 +00:00
|
|
|
SERVICES: cloudwatch,logs,kinesis
|
2021-06-11 07:53:53 +00:00
|
|
|
#those are to mimic aws config
|
|
|
|
AWS_ACCESS_KEY_ID: AKIAIOSFODNN7EXAMPLE
|
|
|
|
AWS_SECRET_ACCESS_KEY: wJalrXUtnFEMI/K7MDENG/bPxRfiCYEXAMPLEKEY
|
|
|
|
AWS_REGION: us-east-1
|
|
|
|
#and to override our endpoint in aws sdk
|
2022-01-11 13:19:43 +00:00
|
|
|
AWS_ENDPOINT_FORCE: http://localhost:4566
|
|
|
|
KINESIS_INITIALIZE_STREAMS: "stream-1-shard:1,stream-2-shards:2"
|
2021-06-11 07:53:53 +00:00
|
|
|
|
2020-07-27 10:18:55 +00:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [ master ]
|
2021-05-28 11:37:11 +00:00
|
|
|
paths-ignore:
|
|
|
|
- 'docs/**'
|
|
|
|
- 'mkdocs.yml'
|
|
|
|
- 'README.md'
|
2020-07-27 10:18:55 +00:00
|
|
|
pull_request:
|
|
|
|
branches: [ master ]
|
2021-05-28 11:37:11 +00:00
|
|
|
paths-ignore:
|
|
|
|
- 'docs/**'
|
|
|
|
- 'mkdocs.yml'
|
|
|
|
- 'README.md'
|
2020-07-27 10:18:55 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
|
|
|
|
build:
|
|
|
|
name: Build
|
|
|
|
runs-on: ubuntu-latest
|
2021-06-11 07:53:53 +00:00
|
|
|
services:
|
|
|
|
localstack:
|
2022-01-11 13:19:43 +00:00
|
|
|
image: localstack/localstack:0.13.3
|
2021-06-11 07:53:53 +00:00
|
|
|
ports:
|
|
|
|
- 4566:4566 # Localstack exposes all services on same port
|
|
|
|
env:
|
|
|
|
SERVICES: ${{ env.SERVICES }}
|
|
|
|
DEBUG: ""
|
|
|
|
DATA_DIR: ""
|
|
|
|
LAMBDA_EXECUTOR: ""
|
|
|
|
KINESIS_ERROR_PROBABILITY: ""
|
|
|
|
DOCKER_HOST: unix:///var/run/docker.sock
|
|
|
|
HOST_TMP_FOLDER: "/tmp"
|
2022-01-11 13:19:43 +00:00
|
|
|
KINESIS_INITIALIZE_STREAMS: ${{ env.KINESIS_INITIALIZE_STREAMS }}
|
2021-06-11 07:53:53 +00:00
|
|
|
HOSTNAME_EXTERNAL: ${{ env.AWS_HOST }} # Required so that resource urls are provided properly
|
|
|
|
# e.g sqs url will get localhost if we don't set this env to map our service
|
|
|
|
options: >-
|
|
|
|
--name=localstack
|
|
|
|
--health-cmd="curl -sS 127.0.0.1:4566 || exit 1"
|
|
|
|
--health-interval=10s
|
|
|
|
--health-timeout=5s
|
|
|
|
--health-retries=3
|
2020-07-27 10:18:55 +00:00
|
|
|
steps:
|
2021-12-16 10:06:31 +00:00
|
|
|
- name: Set up Go 1.17
|
2020-07-27 10:18:55 +00:00
|
|
|
uses: actions/setup-go@v1
|
|
|
|
with:
|
2021-12-16 10:06:31 +00:00
|
|
|
go-version: 1.17
|
2020-07-27 10:18:55 +00:00
|
|
|
id: go
|
|
|
|
- name: Check out code into the Go module directory
|
|
|
|
uses: actions/checkout@v2
|
|
|
|
- name: Build
|
2022-03-29 12:20:26 +00:00
|
|
|
run: make build && go get -u github.com/jandelgado/gcov2lcov && go get -u github.com/ory/go-acc
|
2020-07-27 10:18:55 +00:00
|
|
|
- name: All tests
|
2022-03-29 12:20:26 +00:00
|
|
|
run: go run github.com/ory/go-acc ./... -o coverage.out --ignore database,notifications,protobufs,cwversion,cstest,models
|
2020-07-27 10:18:55 +00:00
|
|
|
- name: gcov2lcov
|
|
|
|
uses: jandelgado/gcov2lcov-action@v1.0.2
|
|
|
|
with:
|
|
|
|
infile: coverage.out
|
2020-11-30 09:37:17 +00:00
|
|
|
outfile: coverage.txt
|
2020-07-27 10:18:55 +00:00
|
|
|
- name: Coveralls
|
|
|
|
uses: coverallsapp/github-action@master
|
2021-09-21 10:45:38 +00:00
|
|
|
continue-on-error: true
|
2020-07-27 10:18:55 +00:00
|
|
|
with:
|
|
|
|
github-token: ${{ secrets.GITHUB_TOKEN }}
|
2021-12-16 10:06:31 +00:00
|
|
|
path-to-lcov: coverage.txt
|