-
Notifications
You must be signed in to change notification settings - Fork 2
106 lines (98 loc) · 2.73 KB
/
test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
---
name: unittest
on: # yamllint disable-line rule:truthy
push:
branches:
- "*"
permissions:
contents: read
jobs:
go:
name: go
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
- name: Install dependencies
run: |
go get .
- name: Build
run: make build
- name: Run Go tests
run: make test
- name: Code Coverage Report
uses: irongut/[email protected]
with:
filename: coverage.xml
badge: true
fail_below_min: true
format: markdown
hide_branch_rate: false
hide_complexity: true
indicators: true
output: both
thresholds: '60 80'
- uses: jwalton/gh-find-current-pr@v1
id: finder
- name: Add Coverage PR Comment
uses: marocchino/sticky-pull-request-comment@v2
with:
number: ${{ steps.finder.outputs.pr }}
path: code-coverage-results.md
recreate: true
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: binary
path: postgresql-partition-manager
if-no-files-found: error
retention-days: 1
e2e:
name: End-to-end
needs: go
strategy:
matrix:
postgres: [14, 15, 16]
runs-on: ubuntu-latest
env:
BATS_LIB_PATH: "${{ github.workspace }}/test/bats/lib/"
PGHOST: localhost
PGUSER: postgres
PGPASSWORD: hackme
PGDATABASE: unittest
services:
postgres:
image: postgres:${{ matrix.postgres }}
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
--hostname postgres
env:
POSTGRES_PASSWORD: hackme
ports:
- 5432:5432
steps:
- uses: actions/checkout@v4
- name: Setup Bats and bats libs
uses: bats-core/[email protected]
with:
support-path: ${{ github.workspace }}/test/bats/lib/bats-support
assert-path: ${{ github.workspace }}/test/bats/lib/bats-assert
file-install: false # Unused
detik-install: false # Unused
- name: Download artifact
uses: actions/download-artifact@v4
with:
name: binary
# File permissions are not maintained during artifact upload/download
- name: Move binary to local executable
run: mv postgresql-partition-manager /usr/local/bin && chmod +x /usr/local/bin/postgresql-partition-manager
- name: Run bats
run: make bats-test