Skip to content

Fix: Make integration tests conditional on credentials availability #1

Fix: Make integration tests conditional on credentials availability

Fix: Make integration tests conditional on credentials availability #1

Workflow file for this run

# This workflow will build a golang project

Check failure on line 1 in .github/workflows/go-dev.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/go-dev.yml

Invalid workflow file

(Line: 43, Col: 13): Unrecognized named-value: 'secrets'. Located at position 24 within expression: vars.TMN_HOST != '' && secrets.OAUTH_CLIENTID != '', (Line: 58, Col: 13): Unrecognized named-value: 'secrets'. Located at position 24 within expression: vars.TMN_HOST == '' || secrets.OAUTH_CLIENTID == ''
# For more information see:
# https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go
# https://docs.docker.com/build/ci/github-actions/
name: Test (Dev)
permissions:
contents: read
on:
workflow_dispatch:
push:
branches:
- develop
paths-ignore:
- "docs/**"
- "licenses/**"
- "*.md"
- ".gitignore"
- ".gitattributes"
- ".gitattributes"
- "LICENSE"
- "NOTICE"
- ".github/**"
jobs:
test_and_build_go:
runs-on: ubuntu-latest
steps:
- name: Check out Git repository
uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: "go.mod"
- name: Test
run: |
go test -p 1 -coverpkg=./... -coverprofile=c.out -v ./...
go tool cover -html=c.out -o coverage.html
if: vars.TMN_HOST != '' && secrets.OAUTH_CLIENTID != ''
env:
FLASHPIPE_DEBUG: true
FLASHPIPE_TMN_HOST: ${{ vars.TMN_HOST }}
FLASHPIPE_OAUTH_HOST: ${{ vars.OAUTH_HOST }}
FLASHPIPE_OAUTH_PATH: /oauth/token
FLASHPIPE_OAUTH_CLIENTID: ${{ secrets.OAUTH_CLIENTID }}
FLASHPIPE_OAUTH_CLIENTSECRET: ${{ secrets.OAUTH_CLIENTSECRET }}
FLASHPIPE_TMN_PASSWORD: ${{ secrets.BASIC_PASSWORD }}
FLASHPIPE_TMN_USERID: ${{ secrets.BASIC_USERID }}
FLASHPIPE_APIPORTAL_HOST: ${{ vars.APIPORTAL_OAUTH_HOST }}
FLASHPIPE_APIPORTAL_OAUTH_CLIENTID: ${{ secrets.APIPORTAL_OAUTH_CLIENTID }}
FLASHPIPE_APIPORTAL_OAUTH_CLIENTSECRET: ${{ secrets.APIPORTAL_OAUTH_CLIENTSECRET }}
- name: Skip Tests (No Credentials)
if: vars.TMN_HOST == '' || secrets.OAUTH_CLIENTID == ''
run: |
echo "⚠️ Skipping integration tests - SAP CPI credentials not available"
echo "Running unit tests only..."
go test -short -v ./...
- name: Save output as artifact
uses: actions/upload-artifact@v4
with:
name: results
path: coverage.html