Skip to content

Commit 2106750

Browse files
authored
Merge pull request #2 from pomerium/wmedford/ci
Initial CI commit
2 parents 097cf69 + 99757b0 commit 2106750

File tree

4 files changed

+194
-0
lines changed

4 files changed

+194
-0
lines changed

.github/workflows/release.yml

+45
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v4
16+
with:
17+
fetch-depth: 0
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v4
21+
with:
22+
go-version: '1.23'
23+
cache: true
24+
25+
- name: Import GPG key
26+
id: import_gpg
27+
uses: crazy-max/ghaction-import-gpg@v6
28+
with:
29+
gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }}
30+
passphrase: ${{ secrets.GPG_PASSPHRASE }}
31+
32+
- name: Generate release notes
33+
run: |
34+
echo "# Release notes" > release-notes.txt
35+
git log --pretty=format:"* %s" $(git describe --tags --abbrev=0 HEAD^)..HEAD >> release-notes.txt
36+
37+
- name: Create GitHub Release
38+
uses: softprops/action-gh-release@v1
39+
with:
40+
body_path: release-notes.txt
41+
token: ${{ secrets.GITHUB_TOKEN }}
42+
files: |
43+
terraform-provider-pomerium_*
44+
env:
45+
GPG_FINGERPRINT: ${{ steps.import_gpg.outputs.fingerprint }}

.github/workflows/security.yml

+28
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Security
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
schedule:
8+
- cron: '0 0 * * 0'
9+
10+
jobs:
11+
security:
12+
runs-on: ubuntu-latest
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v4
18+
with:
19+
go-version: '1.23'
20+
cache: true
21+
22+
- name: Run Gosec Security Scanner
23+
uses: securego/gosec@master
24+
with:
25+
args: ./internal/provider/...
26+
27+
- name: Run nancy for dependency scanning
28+
uses: sonatype-nexus-community/nancy-github-action@main

.github/workflows/test.yml

+51
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Tests
2+
on:
3+
push:
4+
branches: [ main ]
5+
pull_request:
6+
branches: [ main ]
7+
8+
jobs:
9+
test:
10+
name: Test
11+
runs-on: ubuntu-latest
12+
timeout-minutes: 15
13+
steps:
14+
- uses: actions/checkout@v4
15+
16+
- name: Set up Go
17+
uses: actions/setup-go@v4
18+
with:
19+
go-version: '1.23'
20+
cache: true
21+
22+
- name: Install dependencies
23+
run: go mod download
24+
25+
- name: Run tests
26+
run: go test -v -cover ./internal/provider/...
27+
28+
- name: Run acceptance tests
29+
run: |
30+
go test -v ./internal/provider/... -timeout 120m
31+
env:
32+
TF_ACC: "1"
33+
POMERIUM_API_URL: ${{ secrets.POMERIUM_API_URL }}
34+
POMERIUM_API_TOKEN: ${{ secrets.POMERIUM_API_TOKEN }}
35+
36+
lint:
37+
name: Lint
38+
runs-on: ubuntu-latest
39+
steps:
40+
- uses: actions/checkout@v4
41+
42+
- name: Set up Go
43+
uses: actions/setup-go@v4
44+
with:
45+
go-version: '1.23'
46+
cache: true
47+
48+
- name: golangci-lint
49+
uses: golangci/golangci-lint-action@v3
50+
with:
51+
version: latest

.golangci.yml

+70
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,70 @@
1+
run:
2+
deadline: 20m
3+
4+
linters-settings:
5+
gci:
6+
custom-order: true
7+
sections:
8+
- standard
9+
- default
10+
- prefix(github.com/pomerium)
11+
12+
linters:
13+
disable-all: true
14+
enable:
15+
- asasalint
16+
- bodyclose
17+
- dogsled
18+
- errcheck
19+
- errorlint
20+
- exportloopref
21+
# - gci # https://github.com/daixiang0/gci/issues/209
22+
- gocheckcompilerdirectives
23+
- gofumpt
24+
- goimports
25+
- goprintffuncname
26+
- gosec
27+
- gosimple
28+
- govet
29+
- ineffassign
30+
- misspell
31+
- nakedret
32+
- nolintlint
33+
- revive
34+
- staticcheck
35+
- stylecheck
36+
- tenv
37+
- unconvert
38+
- unused
39+
- usestdlibvars
40+
41+
issues:
42+
# List of regexps of issue texts to exclude, empty list by default.
43+
# But independently from this option we use default exclude patterns,
44+
# it can be disabled by `exclude-use-default: false`. To list all
45+
# excluded by default patterns execute `golangci-lint run --help`
46+
exclude:
47+
## Defaults we want from golangci-lint
48+
# errcheck: Almost all programs ignore errors on these functions and in most cases it's ok
49+
- Error return value of .((os\.)?std(out|err)\..*|.*Close|.*Flush|os\.Remove(All)?|.*printf?|os\.(Un)?Setenv). is not checked
50+
- "SA1019"
51+
52+
exclude-rules:
53+
# Exclude some linters from running on test files.
54+
- path: _test\.go$|^test/|^examples/|templates\.go$
55+
linters:
56+
- bodyclose
57+
- errcheck
58+
- gomnd
59+
- gosec
60+
- lll
61+
- maligned
62+
- staticcheck
63+
- unparam
64+
- unused
65+
- scopelint
66+
- gosec
67+
- gosimple
68+
- text: "G112:"
69+
linters:
70+
- gosec

0 commit comments

Comments
 (0)