Skip to content

Commit d359970

Browse files
authored
Merge pull request #4 from qonto/init
Initial import
2 parents 7b3c822 + 3bc21c9 commit d359970

File tree

109 files changed

+6354
-0
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

109 files changed

+6354
-0
lines changed

.checkov.yaml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
skip-check:
3+
- CKV_SECRET_4 # We have password in our configuration templates
4+
- CKV_DOCKER_2 # We don't define healthcheck for our containers because it's a CLI
5+
6+
skip-path:
7+
- scripts/kubernetesdev # Exclude kubernetes development environment, mostly for PostgreSQL
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
name: Bug report
3+
about: Create a report to help us improve
4+
title: ''
5+
labels: bug
6+
assignees: ''
7+
8+
---
9+
10+
### Describe the bug
11+
12+
A clear and concise description of what the bug is.
13+
14+
### Desktop (please complete the following information)
15+
16+
- OS: [e.g. Linux]
17+
- PostgreSQL partition manager [e.g. v1.1]
18+
- PostgreSQL version: [e.g. v14]
19+
- Partition key column type [e.g. date, uuidv7]
20+
21+
If possible, please also share:
22+
23+
- Table table structure dump (`pg_dump --schema-only --no-comments --no-privileges -t <table_name> <database_name>`)
24+
- PostgreSQL Partition Manager configuration (`postgresql-partition-manager.yaml`)
25+
26+
### To Reproduce
27+
28+
Steps to reproduce the behavior
29+
30+
### Expected behavior
31+
32+
A clear and concise description of what you expected to happen.
33+
34+
### Additional context
35+
36+
Add any other context about the problem here.
Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
---
2+
name: Feature request
3+
about: Suggest an idea for this project
4+
title: ''
5+
labels: enhancement
6+
assignees: ''
7+
8+
---
9+
10+
### Is your feature request related to a problem? Please describe
11+
12+
A clear and concise description of what the problem is. Ex. I'm always frustrated when [...]
13+
14+
### Describe the solution you'd like
15+
16+
A clear and concise description of what you want to happen.
17+
18+
### Describe alternatives you've considered
19+
20+
A clear and concise description of any alternative solutions or features you've considered.
21+
22+
### Additional context
23+
24+
Add any other context or screenshots about the feature request here.

.github/dependabot.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
---
2+
version: 2
3+
updates:
4+
5+
- package-ecosystem: gomod
6+
directory: "/"
7+
schedule:
8+
interval: weekly
9+
open-pull-requests-limit: 10
10+
11+
- package-ecosystem: "github-actions"
12+
directory: "/"
13+
schedule:
14+
interval: weekly
15+
16+
- package-ecosystem: "docker"
17+
directory: "/scripts/localdev"
18+
schedule:
19+
interval: weekly

.github/workflows/linter.yaml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
name: linter
3+
on: # yamllint disable-line rule:truthy
4+
push:
5+
branches:
6+
- "*"
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
golangci:
13+
name: golangci
14+
runs-on: ubuntu-latest
15+
steps:
16+
- uses: actions/checkout@v4
17+
- uses: actions/setup-go@v5
18+
with:
19+
go-version: '1.21'
20+
cache: false
21+
- name: golangci-lint
22+
uses: golangci/golangci-lint-action@v4
23+
with:
24+
version: v1.54
25+
26+
yamllint:
27+
name: yamllint
28+
runs-on: ubuntu-latest
29+
steps:
30+
- uses: actions/checkout@v4
31+
32+
- name: Lint YAML files
33+
run: yamllint . # YAML lint is already installed in ubuntu-latest

.github/workflows/test.yaml

Lines changed: 181 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,181 @@
1+
---
2+
name: unittest
3+
on: # yamllint disable-line rule:truthy
4+
push:
5+
branches:
6+
- "*"
7+
8+
permissions:
9+
contents: read
10+
11+
jobs:
12+
go:
13+
name: go
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
pull-requests: write
18+
steps:
19+
- uses: actions/checkout@v4
20+
- uses: actions/setup-go@v5
21+
with:
22+
go-version: '1.21'
23+
- name: Install dependencies
24+
run: |
25+
go get .
26+
- name: Build
27+
run: make build
28+
- name: Run Go tests
29+
run: make test
30+
- name: Code Coverage Report
31+
uses: irongut/[email protected]
32+
with:
33+
filename: coverage.xml
34+
badge: true
35+
fail_below_min: true
36+
format: markdown
37+
hide_branch_rate: false
38+
hide_complexity: true
39+
indicators: true
40+
output: both
41+
thresholds: '60 80'
42+
- uses: jwalton/gh-find-current-pr@v1
43+
id: finder
44+
- name: Add Coverage PR Comment
45+
uses: marocchino/sticky-pull-request-comment@v2
46+
with:
47+
number: ${{ steps.finder.outputs.pr }}
48+
path: code-coverage-results.md
49+
recreate: true
50+
- name: Upload artifact
51+
uses: actions/upload-artifact@v4
52+
with:
53+
name: binary
54+
path: postgresql-partition-manager
55+
if-no-files-found: error
56+
retention-days: 1
57+
58+
e2e:
59+
name: End-to-end
60+
needs: go
61+
strategy:
62+
matrix:
63+
postgres:
64+
- postgres:14
65+
- postgres:15
66+
- postgres:16
67+
runs-on: ubuntu-latest
68+
env:
69+
BATS_LIB_PATH: "${{ github.workspace }}/test/bats/lib/"
70+
PGHOST: localhost
71+
PGUSER: postgres
72+
PGPASSWORD: hackme
73+
PGDATABASE: unittest
74+
services:
75+
postgres:
76+
image: ${{ matrix.postgres }}
77+
options: >-
78+
--health-cmd pg_isready
79+
--health-interval 10s
80+
--health-timeout 5s
81+
--health-retries 5
82+
--hostname postgres
83+
env:
84+
POSTGRES_PASSWORD: hackme
85+
ports:
86+
- 5432:5432
87+
88+
steps:
89+
- uses: actions/checkout@v4
90+
91+
- name: Setup Bats and bats libs
92+
uses: bats-core/[email protected]
93+
with:
94+
support-path: ${{ github.workspace }}/test/bats/lib/bats-support
95+
assert-path: ${{ github.workspace }}/test/bats/lib/bats-assert
96+
file-install: false # Unused
97+
detik-install: false # Unused
98+
99+
- name: Download artifact
100+
uses: actions/download-artifact@v4
101+
with:
102+
name: binary
103+
104+
# File permissions are not maintained during artifact upload/download
105+
- name: Move binary to local executable
106+
run: mv postgresql-partition-manager /usr/local/bin && chmod +x /usr/local/bin/postgresql-partition-manager
107+
108+
- name: Run bats
109+
run: make bats-test
110+
111+
helm:
112+
name: helm
113+
runs-on: ubuntu-latest
114+
env:
115+
HELM_UNITTEST_VERSION: v0.3.5
116+
steps:
117+
- uses: actions/checkout@v4
118+
- name: Install helm-unittest
119+
run: helm plugin install --version $HELM_UNITTEST_VERSION https://github.com/helm-unittest/helm-unittest.git
120+
- name: Run Helm test
121+
run: make helm-test
122+
123+
kubeconform:
124+
name: kubeconform
125+
runs-on: ubuntu-latest
126+
env:
127+
KUBECONFORM_VERSION: 0.6.2
128+
steps:
129+
- uses: actions/checkout@v4
130+
- name: Install kubeconform
131+
run: |
132+
curl -sSLo /tmp/kubeconform.tar.gz "https://github.com/yannh/kubeconform/releases/download/v${KUBECONFORM_VERSION}/kubeconform-linux-amd64.tar.gz" \
133+
&& tar -C /usr/local/bin/ -xzvf /tmp/kubeconform.tar.gz
134+
- name: Run Kubeconform test
135+
run: make kubeconform-test
136+
137+
debian:
138+
runs-on: ubuntu-latest
139+
steps:
140+
- name: Checkout repository
141+
uses: actions/checkout@v4
142+
with:
143+
fetch-depth: 0
144+
- uses: actions/setup-go@v5
145+
with:
146+
go-version: stable
147+
- name: Set up QEMU for ARM64 build
148+
uses: docker/setup-qemu-action@v3
149+
- uses: goreleaser/goreleaser-action@v5
150+
with:
151+
distribution: goreleaser
152+
version: latest
153+
args: release --clean --skip=publish --skip=docker --snapshot
154+
env:
155+
GORELEASER_CURRENT_TAG: 0.0.0
156+
- name: Run Debian package tests
157+
run: make debian-test-ci
158+
159+
# checkcov:
160+
# permissions:
161+
# security-events: write # for github/codeql-action/upload-sarif to upload SARIF results
162+
# actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status
163+
# runs-on: ubuntu-latest
164+
# steps:
165+
# - uses: actions/checkout@v4
166+
# - name: Checkov GitHub Action
167+
# uses: bridgecrewio/checkov-action@v12
168+
# with:
169+
# # This will add both a CLI output to the console and create a results.sarif file
170+
# output_format: cli,sarif
171+
# output_file_path: console,results.sarif
172+
# - name: Upload SARIF file
173+
# uses: github/codeql-action/upload-sarif@v3
174+
# # Results are generated only on a success or failure
175+
# # this is required since GitHub by default won't run the next step
176+
# # when the previous one has failed. Security checks that do not pass will 'fail'.
177+
# # An alternative is to add `continue-on-error: true` to the previous step
178+
# # Or 'soft_fail: true' to checkov.
179+
# if: success() || failure()
180+
# with:
181+
# sarif_file: results.sarif

.gitignore

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
.DS_Store
2+
/.vscode
3+
/cover.html
4+
/coverage.txt
5+
/coverage.xml
6+
/dist
7+
/postgresql-partition-manager
8+
/postgresql-partition-manager.yaml
9+
scripts/localdev/.data

0 commit comments

Comments
 (0)