Skip to content

Commit 2cf5ba6

Browse files
committed
Update CI workflow and golangci-lint to v2
1 parent 992dfe3 commit 2cf5ba6

File tree

2 files changed

+22
-65
lines changed

2 files changed

+22
-65
lines changed

.github/workflows/ci.yaml

Lines changed: 13 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,20 @@
11
name: ci
2-
on: pull_request
2+
on:
3+
pull_request:
4+
types: [opened, reopened, synchronize]
5+
push:
6+
branches:
7+
- main
38
jobs:
49
go-lint:
510
runs-on: ubuntu-latest
611
steps:
12+
- name: Checkout code
13+
uses: actions/checkout@v4
714
- name: Install Go
815
uses: actions/setup-go@v5
916
with:
10-
go-version: 1.22.x
11-
- name: Checkout code
12-
uses: actions/checkout@v4
17+
go-version-file: 'go.mod'
1318
- name: Run linters
1419
uses: golangci/golangci-lint-action@v8
1520
with:
@@ -18,73 +23,19 @@ jobs:
1823
go-test:
1924
strategy:
2025
matrix:
21-
go-version: [1.22.x]
2226
platform: [ubuntu-latest]
2327
runs-on: ${{ matrix.platform }}
2428
steps:
29+
- name: Checkout code
30+
uses: actions/checkout@v4
2531
- name: Install Go
26-
if: success()
2732
uses: actions/setup-go@v5
2833
with:
29-
go-version: ${{ matrix.go-version }}
30-
- name: Checkout code
31-
uses: actions/checkout@v4
34+
go-version-file: 'go.mod'
3235
- name: go tests
3336
run: go test -v -covermode=count -json ./... > test.json
3437
- name: annotate go tests
3538
if: always()
36-
uses: guyarb/golang-test-annotations@v0.5.1
39+
uses: guyarb/golang-test-annotations@v0.6.0
3740
with:
3841
test-results: test.json
39-
40-
test:
41-
runs-on: ubuntu-latest
42-
env:
43-
BATON_LOG_LEVEL: debug
44-
BATON_AUTH0_BASE_URL: "https://dev-n8a8p1kmt7k0ebdz.us.auth0.com"
45-
BATON_AUTH0_CLIENT_ID: EiajnMCHSnpjNdhAtQZ3SkG2cxE7JGII
46-
BATON_AUTH0_CLIENT_SECRET: ${{ secrets.BATON_AUTH0_CLIENT_SECRET }}
47-
48-
CONNECTOR_GRANT: 'organization:org_TcURzPaMeezOd7N4:member:user:auth0|6722c078392d928041854a20'
49-
CONNECTOR_ENTITLEMENT: 'organization:org_TcURzPaMeezOd7N4:member'
50-
CONNECTOR_PRINCIPAL: 'auth0|6722c078392d928041854a20' # This is the user ID
51-
CONNECTOR_PRINCIPAL_TYPE: 'user'
52-
steps:
53-
- name: Install Go
54-
uses: actions/setup-go@v5
55-
with:
56-
go-version: 1.22.x
57-
- name: Checkout code
58-
uses: actions/checkout@v4
59-
60-
- name: Build baton-auth0
61-
run: go build ./cmd/baton-auth0
62-
- name: Run baton-auth0
63-
run: ./baton-auth0
64-
65-
- name: Install baton
66-
run: ./scripts/get-baton.sh && mv baton /usr/local/bin
67-
68-
- name: Get baton resources
69-
run: baton resources
70-
71-
- name: Grant entitlement (in case previous ci run failed)
72-
run: ./baton-auth0 --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
73-
74-
- name: Check for grant before revoking
75-
run:
76-
./baton-auth0 && baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\""
77-
78-
- name: Revoke grants
79-
run: ./baton-auth0 --revoke-grant="${{ env.CONNECTOR_GRANT }}"
80-
81-
- name: Check grant was revoked
82-
run: ./baton-auth0 && baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status "if .grants then .grants[]?.principal.id.resource != \"${{ env.CONNECTOR_PRINCIPAL }}\" else . end"
83-
84-
- name: Grant entitlement
85-
run: ./baton-auth0 --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
86-
87-
- name: Check grant was re-granted
88-
run:
89-
./baton-auth0 && baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\""
90-

.golangci.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,6 @@
11
version: "2"
2+
run:
3+
modules-download-mode: readonly
24
linters:
35
default: none
46
enable:
@@ -67,7 +69,7 @@ linters:
6769
- name: atomic
6870
- name: line-length-limit
6971
arguments:
70-
- 250
72+
- 200
7173
- name: unhandled-error
7274
arguments:
7375
- fmt.Printf
@@ -99,15 +101,19 @@ linters:
99101
- linters:
100102
- godot
101103
source: (TODO)
104+
- path: (.+)\.go$
105+
text: third_party$
106+
- path: (.+)\.go$
107+
text: builtin$
108+
- path: (.+)\.go$
109+
text: examples$
102110
paths:
103111
- third_party$
104112
- builtin$
105113
- examples$
106114
issues:
107115
max-same-issues: 50
108116
formatters:
109-
enable:
110-
- goimports
111117
exclusions:
112118
generated: lax
113119
paths:

0 commit comments

Comments
 (0)