Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
128 changes: 55 additions & 73 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,12 @@ jobs:
go-lint:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: 1.23.x
- name: Checkout code
uses: actions/checkout@v4
go-version-file: go.mod
- name: Run linters
uses: golangci/golangci-lint-action@v8
with:
Expand All @@ -23,86 +23,68 @@ jobs:
go-test:
strategy:
matrix:
go-version: [1.23.x]
platform: [ubuntu-latest]
runs-on: ${{ matrix.platform }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
if: success()
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}
- name: Checkout code
uses: actions/checkout@v4
go-version-file: go.mod
- name: go tests
run: (set -o pipefail && go test -v -covermode=atomic -json -race ./... | tee test.json)
- name: annotate go tests
if: always()
uses: guyarb/golang-test-annotations@v0.6.0
uses: guyarb/golang-test-annotations@v0.8.0
with:
test-results: test.json
# test:
# runs-on: ubuntu-latest
# # Define any services needed for the test suite (or delete this section)
# # services:
# # postgres:
# # image: postgres:16
# # ports:
# # - "5432:5432"
# # env:
# # POSTGRES_PASSWORD: secretpassword
# env:
# BATON_LOG_LEVEL: debug
# # Add any environment variables needed to run baton-sql
# # BATON_BASE_URL: 'http://localhost:8080'
# # BATON_ACCESS_TOKEN: 'secret_token'
# # The following parameters are passed to grant/revoke commands
# # Change these to the correct IDs for your test data
# CONNECTOR_GRANT: 'grant:entitlement:group:1234:member:user:9876'
# CONNECTOR_ENTITLEMENT: 'entitlement:group:1234:member'
# CONNECTOR_PRINCIPAL: 'user:9876'
# CONNECTOR_PRINCIPAL_TYPE: 'user'
# steps:
# - name: Install Go
# uses: actions/setup-go@v5
# with:
# go-version: 1.23.x
# - name: Checkout code
# uses: actions/checkout@v4
# # Install any dependencies here (or delete this)
# # - name: Install postgres client
# # run: sudo apt install postgresql-client
# # Run any fixture setup here (or delete this)
# # - name: Import sql into postgres
# # run: psql -h localhost --user postgres -f environment.sql
# # env:
# # PGPASSWORD: secretpassword
# - name: Build baton-sql
# run: go build ./cmd/baton-sql
# - name: Run baton-sql
# run: ./baton-sql
#
# - name: Install baton
# run: ./scripts/get-baton.sh && mv baton /usr/local/bin
#
# - name: Check for grant before revoking
#
# run:
# baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\""
#
#
# - name: Revoke grants
# run: ./baton-sql --revoke-grant="${{ env.CONNECTOR_GRANT }}"
#
# - name: Check grant was revoked
# 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"
#
# - name: Grant entitlement
# # Change the grant arguments to the correct IDs for your test data
# run: ./baton-sql --grant-entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --grant-principal="${{ env.CONNECTOR_PRINCIPAL }}" --grant-principal-type="${{ env.CONNECTOR_PRINCIPAL_TYPE }}"
#
# - name: Check grant was re-granted
#
# run:
# baton grants --entitlement="${{ env.CONNECTOR_ENTITLEMENT }}" --output-format=json | jq --exit-status ".grants[].principal.id.resource == \"${{ env.CONNECTOR_PRINCIPAL }}\""
#
test:
runs-on: ubuntu-latest
services:
postgres:
image: postgres:16
ports:
- "5432:5432"
env:
POSTGRES_PASSWORD: secretpassword
POSTGRES_DB: batondb

env:
BATON_LOG_LEVEL: debug
BATON_CONFIG_PATH: ./examples/postgres-test.yml
DB_USER: postgres
DB_PASSWORD: secretpassword
DB_HOST: localhost
DB_PORT: 5432
DB_DATABASE: batondb
BATON_PROVISIONING: true
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Install Go
uses: actions/setup-go@v5
with:
go-version-file: go.mod
- name: Install postgres client
run: sudo apt install postgresql-client
- name: Import sql into postgres
run: psql -h localhost --user postgres -d batondb -f ./test/postgres-init.sql
env:
PGPASSWORD: secretpassword
- name: Build baton-sql
run: go build ./cmd/baton-sql
- name: Run sync tests
uses: ConductorOne/github-workflows/actions/sync-test@v2
with:
connector: ./baton-sql
baton-entitlement: 'role:admin:member'
baton-principal: john.smith
baton-principal-type: user
- name: Run account provisioning tests
uses: ConductorOne/github-workflows/actions/account-provisioning@v3
with:
connector: ./baton-sql
account-email: john.smith@example.com
account-login: john.smith
13 changes: 0 additions & 13 deletions .gon-amd64.json

This file was deleted.

13 changes: 0 additions & 13 deletions .gon-arm64.json

This file was deleted.

55 changes: 0 additions & 55 deletions .goreleaser.docker.yaml

This file was deleted.

102 changes: 0 additions & 102 deletions .goreleaser.yaml

This file was deleted.

4 changes: 2 additions & 2 deletions Dockerfile.test
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
FROM golang:1.24-alpine as builder
FROM golang:1.25-alpine as builder

WORKDIR /app

Expand All @@ -13,7 +13,7 @@ COPY . .
RUN go build -o baton-sql ./cmd/baton-sql

# Create final container
FROM alpine:3.18
FROM alpine:3.22

RUN apk add --no-cache ca-certificates bash curl

Expand Down
2 changes: 1 addition & 1 deletion docker-compose-postgres-test.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
# PostgreSQL Database for testing employee_id and last_login features
postgres:
image: postgres:14
image: postgres:16
container_name: baton-postgres-test
environment:
POSTGRES_USER: baton
Expand Down
Loading