Functional Tests #715
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Functional Tests | |
on: | |
workflow_dispatch: | |
inputs: | |
runId: # Accessible through ${{ inputs.runId }} | |
description: 'Required "Build and release"" workflow run id (see id in browser URL for selected run) from which to get artifacts to be tested' | |
required: true | |
type: number | |
workflow_run: | |
workflows: [Build and release] | |
types: [completed] | |
jobs: | |
ft-core: | |
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest, windows-latest, macos-latest] | |
type: [java, jar, native] | |
runs-on: ${{ matrix.os }} | |
steps: | |
# Java is required for running the functional tests | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Get artifacts from triggering workflow | |
if: github.event_name == 'workflow_run' | |
uses: actions/download-artifact@v4 | |
with: | |
run-id: ${{ github.event.workflow_run.id }} | |
name: combined-artifacts | |
path: ./artifacts | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get artifacts from specified workflow | |
if: github.event_name == 'workflow_dispatch' | |
uses: actions/download-artifact@v4 | |
with: | |
run-id: ${{ inputs.runId }} | |
name: combined-artifacts | |
path: ./artifacts | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: List artifact contents | |
shell: bash | |
run: find ./artifacts | |
- name: Run Tests | |
shell: bash | |
run: | | |
mv artifacts/release-assets/* . | |
mv artifacts/fcli-ftest.jar . | |
case "${{ matrix.type }}" in | |
"java" ) | |
java -jar fcli-ftest.jar -Dft.fcli=build -Dft.run=core,config,tool ;; | |
"jar" ) | |
java -jar fcli-ftest.jar -Dft.fcli=fcli.jar -Dft.run=core,config,tool ;; | |
"native" ) | |
case "${{ matrix.os }}" in | |
"ubuntu-latest" ) | |
tar -zxvf fcli-linux.tgz | |
java -jar fcli-ftest.jar -Dft.fcli=./fcli -Dft.run=core,config,tool ;; | |
"windows-latest" ) | |
7z e fcli-windows.zip | |
java -jar fcli-ftest.jar -Dft.fcli=fcli.exe -Dft.run=core,config,tool ;; | |
"macos-latest" ) | |
tar -zxvf fcli-mac.tgz | |
java -jar fcli-ftest.jar -Dft.fcli=./fcli -Dft.run=core,config,tool ;; | |
esac ;; | |
esac | |
- name: Rename test log | |
if: always() | |
shell: bash | |
run: mv test.log "test-${{ matrix.os }}-${{ matrix.type }}.log" | |
- name: Publish test logs | |
if: failure() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-log-${{ matrix.os }}-${{ matrix.type }} | |
path: test-*.log | |
ft-product: | |
if: github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' | |
strategy: | |
fail-fast: false | |
matrix: | |
type: [fod, ssc, sc-sast, sc-dast, report] | |
runs-on: ubuntu-latest | |
steps: | |
# Java is required for running the functional tests | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
- name: Get artifacts from triggering workflow | |
if: github.event_name == 'workflow_run' | |
uses: actions/download-artifact@v4 | |
with: | |
run-id: ${{ github.event.workflow_run.id }} | |
name: combined-artifacts | |
path: ./artifacts | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Get artifacts from specified workflow | |
if: github.event_name == 'workflow_dispatch' | |
uses: actions/download-artifact@v4 | |
with: | |
run-id: ${{ inputs.runId }} | |
name: combined-artifacts | |
path: ./artifacts | |
github-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Run Tests | |
shell: bash | |
run: | | |
mv artifacts/release-assets/* . | |
mv artifacts/fcli-ftest.jar . | |
tar -zxvf fcli-linux.tgz | |
# Although we only run the current matrix entry type, we pass connection | |
# options for all session types, as some SC-SAST/SC-DAST tests may also | |
# require an SSC session. | |
java -jar fcli-ftest.jar -Dft.fcli=./fcli -Dft.run=$type \ | |
-Dft.fod.url=$fod_url -Dft.fod.tenant=$fod_tenant -Dft.fod.user=$fod_user -Dft.fod.password=$fod_pwd \ | |
-Dft.ssc.url=$ssc_url -Dft.ssc.user=$ssc_user -Dft.ssc.password=$ssc_pwd \ | |
-Dft.sc-sast.ssc-url=$ssc_url -Dft.sc-sast.ssc-user=$ssc_user -Dft.sc-sast.ssc-password=$ssc_pwd \ | |
-Dft.sc-dast.ssc-url=$ssc_url -Dft.sc-dast.ssc-user=$ssc_user -Dft.sc-dast.ssc-password=$ssc_pwd \ | |
-Dft.sc-sast.client-auth-token=$scsast_token | |
env: | |
type: ${{ matrix.type }} | |
fod_url: ${{ secrets.FCLI_FT_FOD_URL }} | |
fod_tenant: ${{ secrets.FCLI_FT_FOD_TENANT }} | |
fod_user: ${{ secrets.FCLI_FT_FOD_USER }} | |
fod_pwd: ${{ secrets.FCLI_FT_FOD_PWD }} | |
ssc_url: ${{ secrets.FCLI_FT_SSC_URL }} | |
ssc_user: ${{ secrets.FCLI_FT_SSC_USER }} | |
ssc_pwd: ${{ secrets.FCLI_FT_SSC_PWD }} | |
scsast_token: ${{ secrets.FCLI_FT_SCSAST_TOKEN }} | |
# Pass GitHub and GitLab tokens for use by NCD license report tests | |
FCLI_FT_GITHUB_TOKEN: ${{ secrets.FCLI_FT_GITHUB_TOKEN }} | |
FCLI_FT_GITLAB_TOKEN: ${{ secrets.FCLI_FT_GITLAB_TOKEN }} | |
- name: Rename test log | |
if: always() | |
shell: bash | |
run: mv test.log "test-${{ matrix.os }}-${{ matrix.type }}.log" | |
- name: Publish test logs | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-log-${{ matrix.type }} | |
path: test-*.log | |