Skip to content

testing

testing #548

name: Lint, Format, and Test
on:
workflow_call:
workflow_dispatch:
pull_request:
push:
branches:
- PSG-5780-sdk-test-go
env:
PASSAGE_APP_ID: ${{ secrets.PASSAGE_APP_ID }}
PASSAGE_API_KEY: ${{ secrets.PASSAGE_API_KEY }}
PASSAGE_USER_ID: ${{ secrets.PASSAGE_USER_ID }}
PASSAGE_AUTH_TOKEN: ${{ secrets.PASSAGE_AUTH_TOKEN }}
jobs:
# lint:
# name: Lint
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v5
# with:
# go-version: '1.21'
# - name: Lint
# uses: golangci/golangci-lint-action@v6
# with:
# version: v1.60
# format:
# name: Format
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v5
# with:
# go-version: '1.21'
# - name: Format
# run: |
# if [[ $(gofmt -s -d .) ]]; then
# echo "Run 'gofmt -s -w .' to format code."
# exit 1
# fi
# test:
# name: Test
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4
# - uses: actions/setup-go@v5
# with:
# go-version: '1.21'
# - name: Test
# run: go test ./...
# - name: Test with race detector
# run: go test -race -run TestAppJWKSCacheWriteConcurrency
test-e2e:
name: Test E2E
runs-on: ubuntu-latest
steps:
- uses: actions-cool/check-user-permission@v2
with:
require: write
id: check_permission
- name: Get SDK version
id: get_sdk_version
if: ${{ steps.check_permission.outputs.require-result == 'true' }}
run: |
line=$(head -n 1 go.mod)
go_mod_version=${line##*/v}
manifest_version=$(jq -r '."."' .release-please-manifest.json | cut -d. -f1)
version=''
if [[ $go_mod_version -gt $manifest_version ]]; then
version=$go_mod_version
fi
echo "version=$version" >> $GITHUB_OUTPUT
- name: Trigger E2E Workflow in backend-sdk-tests and Wait
if: ${{ steps.check_permission.outputs.require-result == 'true' }}
uses: convictional/[email protected]
with:
owner: passageidentity
repo: backend-sdk-tests
workflow_file_name: integration-tests-complete.yml
github_token: ${{ secrets.BE_SDK_PAT }}
# github.head_ref is only available on PR events, while github.ref_name provides the branch name on other events
client_payload: >-
{
"target_sdk":"go",
"use_test_release":true,
"sdk_branch_ref":"${{ github.head_ref || github.ref_name }}",
"test_release_version":"${{ steps.get_sdk_version.outputs.version }}"
}