99 go-lint :
1010 runs-on : ubuntu-latest
1111 steps :
12+ - name : Checkout code
13+ uses : actions/checkout@v4
1214 - name : Install Go
1315 uses : actions/setup-go@v5
1416 with :
15- go-version : 1.23.x
16- - name : Checkout code
17- uses : actions/checkout@v4
17+ go-version-file : go.mod
1818 - name : Run linters
1919 uses : golangci/golangci-lint-action@v8
2020 with :
@@ -23,86 +23,68 @@ jobs:
2323 go-test :
2424 strategy :
2525 matrix :
26- go-version : [1.23.x]
2726 platform : [ubuntu-latest]
2827 runs-on : ${{ matrix.platform }}
2928 steps :
29+ - name : Checkout code
30+ uses : actions/checkout@v4
3031 - name : Install Go
3132 if : success()
3233 uses : actions/setup-go@v5
3334 with :
34- go-version : ${{ matrix.go-version }}
35- - name : Checkout code
36- uses : actions/checkout@v4
35+ go-version-file : go.mod
3736 - name : go tests
3837 run : (set -o pipefail && go test -v -covermode=atomic -json -race ./... | tee test.json)
3938 - name : annotate go tests
4039 if : always()
41- uses : guyarb/golang-test-annotations@v0.6 .0
40+ uses : guyarb/golang-test-annotations@v0.8 .0
4241 with :
4342 test-results : test.json
44- # test:
45- # runs-on: ubuntu-latest
46- # # Define any services needed for the test suite (or delete this section)
47- # # services:
48- # # postgres:
49- # # image: postgres:16
50- # # ports:
51- # # - "5432:5432"
52- # # env:
53- # # POSTGRES_PASSWORD: secretpassword
54- # env:
55- # BATON_LOG_LEVEL: debug
56- # # Add any environment variables needed to run baton-sql
57- # # BATON_BASE_URL: 'http://localhost:8080'
58- # # BATON_ACCESS_TOKEN: 'secret_token'
59- # # The following parameters are passed to grant/revoke commands
60- # # Change these to the correct IDs for your test data
61- # CONNECTOR_GRANT: 'grant:entitlement:group:1234:member:user:9876'
62- # CONNECTOR_ENTITLEMENT: 'entitlement:group:1234:member'
63- # CONNECTOR_PRINCIPAL: 'user:9876'
64- # CONNECTOR_PRINCIPAL_TYPE: 'user'
65- # steps:
66- # - name: Install Go
67- # uses: actions/setup-go@v5
68- # with:
69- # go-version: 1.23.x
70- # - name: Checkout code
71- # uses: actions/checkout@v4
72- # # Install any dependencies here (or delete this)
73- # # - name: Install postgres client
74- # # run: sudo apt install postgresql-client
75- # # Run any fixture setup here (or delete this)
76- # # - name: Import sql into postgres
77- # # run: psql -h localhost --user postgres -f environment.sql
78- # # env:
79- # # PGPASSWORD: secretpassword
80- # - name: Build baton-sql
81- # run: go build ./cmd/baton-sql
82- # - name: Run baton-sql
83- # run: ./baton-sql
84- #
85- # - name: Install baton
86- # run: ./scripts/get-baton.sh && mv baton /usr/local/bin
87- #
88- # - name: Check for grant before revoking
89- #
90- # run:
91- # baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\""
92- #
93- #
94- # - name: Revoke grants
95- # run: ./baton-sql --revoke-grant="${{ env.CONNECTOR_GRANT }}"
96- #
97- # - name: Check grant was revoked
98- # run: ./baton-sql && baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status "if .grants then .grants[]?.principal.id.resource != \"${{ env.CONNECTOR_PRINCIPAL }}\" else . end"
99- #
100- # - name: Grant entitlement
101- # # Change the grant arguments to the correct IDs for your test data
102- # run: ./baton-sql --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
103- #
104- # - name: Check grant was re-granted
105- #
106- # run:
107- # baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\""
108- #
43+ test :
44+ runs-on : ubuntu-latest
45+ services :
46+ postgres :
47+ image : postgres:16
48+ ports :
49+ - " 5432:5432"
50+ env :
51+ POSTGRES_PASSWORD : secretpassword
52+ POSTGRES_DB : batondb
53+
54+ env :
55+ BATON_LOG_LEVEL : debug
56+ BATON_CONFIG_PATH : ./examples/postgres-test.yml
57+ DB_USER : postgres
58+ DB_PASSWORD : secretpassword
59+ DB_HOST : localhost
60+ DB_PORT : 5432
61+ DB_DATABASE : batondb
62+ BATON_PROVISIONING : true
63+ steps :
64+ - name : Checkout code
65+ uses : actions/checkout@v4
66+ - name : Install Go
67+ uses : actions/setup-go@v5
68+ with :
69+ go-version-file : go.mod
70+ - name : Install postgres client
71+ run : sudo apt install postgresql-client
72+ - name : Import sql into postgres
73+ run : psql -h localhost --user postgres -d batondb -f ./test/postgres-init.sql
74+ env :
75+ PGPASSWORD : secretpassword
76+ - name : Build baton-sql
77+ run : go build ./cmd/baton-sql
78+ - name : Run sync tests
79+ uses : ConductorOne/github-workflows/actions/sync-test@v2
80+ with :
81+ connector : ./baton-sql
82+ baton-entitlement : ' role:admin:member'
83+ baton-principal : john.smith
84+ baton-principal-type : user
85+ - name : Run account provisioning tests
86+ uses : ConductorOne/github-workflows/actions/account-provisioning@v3
87+ with :
88+ connector : ./baton-sql
89+ 90+ account-login : john.smith
0 commit comments