Skip to content

Commit

Permalink
Merge pull request #281 from GDATASoftwareAG/test_environment
Browse files Browse the repository at this point in the history
Test environment
  • Loading branch information
lennartdohmann authored Aug 18, 2023
2 parents 346a3ed + b743b97 commit 91da9ec
Show file tree
Hide file tree
Showing 22 changed files with 206 additions and 229 deletions.
35 changes: 14 additions & 21 deletions .github/workflows/ci-dotnet.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ on:
- "dotnet/**"
- ".github/workflows/ci-dotnet.yaml"
workflow_dispatch:
inputs:
environment:
type: choice
description: "Test environment"
options:
- production
- staging
default: "production"

env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/cs')) && secrets.CLIENT_SECRET || secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/cs')) && 'wss://gateway.production.vaas.gdatasecurity.de' || 'wss://gateway.staging.vaas.gdatasecurity.de' }}
TOKEN_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/cs')) && 'https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token' || 'https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token' }}

jobs:
build-dotnet:
Expand Down Expand Up @@ -52,37 +66,16 @@ jobs:
working-directory: dotnet/Vaas

- name: Test
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/cs')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
VAAS_URL: "wss://gateway.production.vaas.gdatasecurity.de"
TOKEN_URL: "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token"
run: dotnet test --no-restore --verbosity normal
working-directory: dotnet/Vaas

- name: Test staging
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/cs')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: "wss://gateway.staging.vaas.gdatasecurity.de"
TOKEN_URL: "https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token"
run: dotnet test --no-restore --verbosity normal
working-directory: dotnet/Vaas

- name: Run example FileScan
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
SCAN_PATH: "Program.cs"
run: dotnet run FileScan
working-directory: dotnet/examples/VaasExample

- name: Run example UrlScan
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
run: dotnet run UrlScan
working-directory: dotnet/examples/VaasExample

Expand Down
29 changes: 14 additions & 15 deletions .github/workflows/ci-golang.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ on:
- "golang/vaas/**"
- ".github/workflows/ci-golang.yaml"
workflow_dispatch:
inputs:
environment:
type: choice
description: "Test environment"
options:
- production
- staging
default: "production"

env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/go')) && secrets.CLIENT_SECRET || secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/go')) && 'wss://gateway.production.vaas.gdatasecurity.de' || 'wss://gateway.staging.vaas.gdatasecurity.de' }}
TOKEN_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/go')) && 'https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token' || 'https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token' }}

jobs:
build-golang:
Expand All @@ -27,22 +41,7 @@ jobs:
go-version: 1.20.5
cache: true
cache-dependency-path: golang/vaas/go.sum
- name: run tests staging
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/go')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: "wss://gateway.staging.vaas.gdatasecurity.de"
TOKEN_URL: "https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token"
run: go test ./...
working-directory: golang/vaas/
- name: run tests
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/go')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
VAAS_URL: "wss://gateway.production.vaas.gdatasecurity.de"
TOKEN_URL: "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token"
run: go test ./...
working-directory: golang/vaas/
- name: publish module
Expand Down
38 changes: 14 additions & 24 deletions .github/workflows/ci-java-legacy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ on:
- "java/**"
- ".github/workflows/ci-java-legacy.yaml"
workflow_dispatch:
inputs:
environment:
type: choice
description: "Test environment"
options:
- production
- staging
default: "production"

env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/java')) && secrets.CLIENT_SECRET || secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/java')) && 'wss://gateway.production.vaas.gdatasecurity.de' || 'wss://gateway.staging.vaas.gdatasecurity.de' }}
TOKEN_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/java')) && 'https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token' || 'https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token' }}

jobs:
build-java-legacy:
Expand All @@ -37,25 +51,6 @@ jobs:
gradle-version: "8.1"

- name: run tests
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/java')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
VAAS_URL: "wss://gateway.production.vaas.gdatasecurity.de"
TOKEN_URL: "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token"
uses: gradle/gradle-build-action@v2
with:
arguments: test
gradle-version: "8.1"
build-root-directory: java

- name: run tests staging
if: github.ref != 'refs/heads/main' && ! startsWith(github.ref, 'refs/tags/java')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: "wss://gateway.staging.vaas.gdatasecurity.de"
TOKEN_URL: "https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token"
uses: gradle/gradle-build-action@v2
with:
arguments: test
Expand All @@ -64,8 +59,6 @@ jobs:

#- name: run examples for file
# env:
# CLIENT_ID: ${{ secrets.CLIENT_ID }}
# CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
# SCAN_PATH: "src/main/java/de/gdata/vaasexample/Main.java"
# uses: gradle/gradle-build-action@v2
# with:
Expand All @@ -74,9 +67,6 @@ jobs:
# build-root-directory: java/examples/VaasExample

#- name: run examples for url
# env:
# CLIENT_ID: ${{ secrets.CLIENT_ID }}
# CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
# uses: gradle/gradle-build-action@v2
# with:
# arguments: urlScan
Expand Down
38 changes: 14 additions & 24 deletions .github/workflows/ci-java.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ on:
- "java/**"
- ".github/workflows/ci-java.yaml"
workflow_dispatch:
inputs:
environment:
type: choice
description: "Test environment"
options:
- production
- staging
default: "production"

env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/java')) && secrets.CLIENT_SECRET || secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/java')) && 'wss://gateway.production.vaas.gdatasecurity.de' || 'wss://gateway.staging.vaas.gdatasecurity.de' }}
TOKEN_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/java')) && 'https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token' || 'https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token' }}

jobs:
build-java:
Expand All @@ -37,25 +51,6 @@ jobs:
gradle-version: "8.1"

- name: run tests
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/java')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
VAAS_URL: "wss://gateway.production.vaas.gdatasecurity.de"
TOKEN_URL: "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token"
uses: gradle/gradle-build-action@v2
with:
arguments: test
gradle-version: "8.1"
build-root-directory: java

- name: run tests staging
if: github.ref != 'refs/heads/main' && ! startsWith(github.ref, 'refs/tags/java')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: "wss://gateway.staging.vaas.gdatasecurity.de"
TOKEN_URL: "https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token"
uses: gradle/gradle-build-action@v2
with:
arguments: test
Expand All @@ -64,8 +59,6 @@ jobs:

- name: run examples for file
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
SCAN_PATH: "src/main/java/de/gdata/vaasexample/Main.java"
uses: gradle/gradle-build-action@v2
with:
Expand All @@ -74,9 +67,6 @@ jobs:
build-root-directory: java/examples/VaasExample

- name: run examples for url
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
uses: gradle/gradle-build-action@v2
with:
arguments: urlScan
Expand Down
38 changes: 14 additions & 24 deletions .github/workflows/ci-php.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ on:
- "php/**"
- ".github/workflows/ci-php.yaml"
workflow_dispatch:
inputs:
environment:
type: choice
description: "Test environment"
options:
- production
- staging
default: "production"

env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/php')) && secrets.CLIENT_SECRET || secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/php')) && 'wss://gateway.production.vaas.gdatasecurity.de' || 'wss://gateway.staging.vaas.gdatasecurity.de' }}
TOKEN_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/php')) && 'https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token' || 'https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token' }}

jobs:
build-php:
Expand All @@ -39,22 +53,6 @@ jobs:
php_version: ${{ matrix.version }}

- name: run tests
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/php')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
VAAS_URL: "wss://gateway.production.vaas.gdatasecurity.de"
TOKEN_URL: "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token"
run: ./vendor/bin/phpunit --colors --testdox
working-directory: php/tests/vaas

- name: run tests staging
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/php')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: "wss://gateway.staging.vaas.gdatasecurity.de"
TOKEN_URL: "https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token"
run: ./vendor/bin/phpunit --colors --testdox
working-directory: php/tests/vaas

Expand All @@ -64,23 +62,15 @@ jobs:

- name: run example (scan file)
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
SCAN_PATH: "GetVerdictByFile.php"
run: php GetVerdictByFile.php
working-directory: php/examples/VaasExample

- name: run example (scan url)
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
run: php GetVerdictByUrl.php
working-directory: php/examples/VaasExample

- name: run example (scan hash)
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
run: php GetVerdictByHash.php
working-directory: php/examples/VaasExample

Expand Down
35 changes: 14 additions & 21 deletions .github/workflows/ci-python.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ on:
- "python/**"
- ".github/workflows/ci-python.yaml"
workflow_dispatch:
inputs:
environment:
type: choice
description: "Test environment"
options:
- production
- staging
default: "production"

env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/py')) && secrets.CLIENT_SECRET || secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/py')) && 'wss://gateway.production.vaas.gdatasecurity.de' || 'wss://gateway.staging.vaas.gdatasecurity.de' }}
TOKEN_URL: ${{ (inputs.environment == 'production' || github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/py')) && 'https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token' || 'https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token' }}

jobs:
build-python:
Expand All @@ -34,22 +48,6 @@ jobs:
working-directory: python

- name: run tests
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/py')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
VAAS_URL: "wss://gateway.production.vaas.gdatasecurity.de"
TOKEN_URL: "https://account.gdata.de/realms/vaas-production/protocol/openid-connect/token"
run: python -m unittest -v tests/test_*
working-directory: python

- name: run tests staging
if: github.ref != 'refs/heads/main' && !startsWith(github.ref, 'refs/tags/py')
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.STAGING_CLIENT_SECRET }}
VAAS_URL: "wss://gateway.staging.vaas.gdatasecurity.de"
TOKEN_URL: "https://account-staging.gdata.de/realms/vaas-staging/protocol/openid-connect/token"
run: python -m unittest -v tests/test_*
working-directory: python

Expand All @@ -59,16 +57,11 @@ jobs:

- name: run example scan file
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
SCAN_PATH: "main.py"
run: python main.py
working-directory: python/examples/VaasExample

- name: run example scan url
env:
CLIENT_ID: ${{ secrets.CLIENT_ID }}
CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }}
run: python main_url.py
working-directory: python/examples/VaasExample

Expand Down
Loading

0 comments on commit 91da9ec

Please sign in to comment.