| 1 |
name: Tests |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
push: |
| 6 |
branches: |
| 7 |
- master |
| 8 |
- "v*" |
| 9 |
|
| 10 |
jobs: |
| 11 |
test-stuff: |
| 12 |
runs-on: ubuntu-latest |
| 13 |
steps: |
| 14 |
- name: Checkout code |
| 15 |
uses: actions/checkout@v6 |
| 16 |
|
| 17 |
- name: Set up Docker |
| 18 |
uses: docker/setup-buildx-action@v4 |
| 19 |
|
| 20 |
- name: Set up Docker Compose |
| 21 |
run: sudo apt-get install docker-compose |
| 22 |
|
| 23 |
|
| 24 |
- name: Create test certs for TLS |
| 25 |
run: | |
| 26 |
make test-certs |
| 27 |
chmod 777 ./contrib/tls/* |
| 28 |
|
| 29 |
- name: Start services |
| 30 |
run: docker-compose up -d |
| 31 |
working-directory: ./ |
| 32 |
|
| 33 |
- name: Setup Go |
| 34 |
uses: actions/setup-go@v6 |
| 35 |
with: |
| 36 |
go-version: '1.26' |
| 37 |
|
| 38 |
- name: Install Dependencies |
| 39 |
run: go mod tidy |
| 40 |
|
| 41 |
- name: Docker logs |
| 42 |
run: | |
| 43 |
echo "${{ toJson(job) }}" |
| 44 |
docker ps -a |
| 45 |
echo "ok" |
| 46 |
|
| 47 |
- name: Run tests |
| 48 |
env: |
| 49 |
LOG_LEVEL: "info" |
| 50 |
run: | |
| 51 |
sleep 15 |
| 52 |
make test |
| 53 |
|
| 54 |
|
| 55 |
- name: Run tests - redis 8 |
| 56 |
env: |
| 57 |
LOG_LEVEL: "info" |
| 58 |
TEST_REDIS_URI: "redis://localhost:16388" |
| 59 |
TEST_PWD_REDIS_URI: "redis://:redis-password@localhost:16380" |
| 60 |
run: | |
| 61 |
go test -v -race -p 1 ./... |
| 62 |
|
| 63 |
|
| 64 |
- name: Upload coverage to Codecov |
| 65 |
uses: codecov/codecov-action@v7 |
| 66 |
with: |
| 67 |
fail_ci_if_error: true |
| 68 |
files: ./coverage.txt |
| 69 |
token: ${{ secrets.CODECOV_TOKEN }} |
| 70 |
verbose: true |
| 71 |
|
| 72 |
- name: Upload coverage to Coveralls |
| 73 |
uses: coverallsapp/github-action@v2 |
| 74 |
with: |
| 75 |
file: coverage.txt |
| 76 |
|
| 77 |
- name: Stop services |
| 78 |
run: docker-compose down |
| 79 |
working-directory: ./ |
| 80 |
|
| 81 |
|
| 82 |
lint-stuff: |
| 83 |
runs-on: ubuntu-latest |
| 84 |
|
| 85 |
steps: |
| 86 |
- name: Checkout code |
| 87 |
uses: actions/checkout@v6 |
| 88 |
|
| 89 |
- name: Setup Go |
| 90 |
uses: actions/setup-go@v6 |
| 91 |
with: |
| 92 |
go-version: '1.26' |
| 93 |
|
| 94 |
- name: Install Dependencies |
| 95 |
run: go mod tidy |
| 96 |
|
| 97 |
- name: golangci-lint |
| 98 |
uses: golangci/golangci-lint-action@v9 |
| 99 |
with: |
| 100 |
version: v2.11.2 |
| 101 |
args: "--tests=false" |
| 102 |
|
| 103 |
- name: Run checks |
| 104 |
env: |
| 105 |
LOG_LEVEL: "info" |
| 106 |
run: | |
| 107 |
make checks |
| 108 |
|
| 109 |
|
| 110 |
build-stuff: |
| 111 |
runs-on: ubuntu-latest |
| 112 |
steps: |
| 113 |
- name: Checkout code |
| 114 |
uses: actions/checkout@v6 |
| 115 |
|
| 116 |
- name: Setup Go |
| 117 |
uses: actions/setup-go@v6 |
| 118 |
with: |
| 119 |
go-version: '1.26' |
| 120 |
|
| 121 |
- name: Install Dependencies |
| 122 |
run: go mod tidy |
| 123 |
|
| 124 |
- name: Build some binaries |
| 125 |
run: make build-some-amd64-binaries |
| 126 |
|
| 127 |
- name: Generate mixin |
| 128 |
run: make mixin |
| 129 |
|
| 130 |
- name: Set up Docker Buildx |
| 131 |
uses: docker/setup-buildx-action@v4 |
| 132 |
|
| 133 |
- name: Test Docker Image Build - Alpine |
| 134 |
uses: docker/build-push-action@v7 |
| 135 |
with: |
| 136 |
push: false |
| 137 |
target: alpine |
| 138 |
tags: user/app:tst |
| 139 |
file: Dockerfile |
| 140 |
build-args: "GOARCH=amd64" |
| 141 |
|
| 142 |
- name: Test Docker Image Build - Scratch |
| 143 |
uses: docker/build-push-action@v7 |
| 144 |
with: |
| 145 |
push: false |
| 146 |
target: scratch-release |
| 147 |
tags: user/app:tst |
| 148 |
file: Dockerfile |
| 149 |
build-args: "GOARCH=amd64" |