Skip to content

Test data upload script, triggered by bo changes or schedule #1371

Test data upload script, triggered by bo changes or schedule

Test data upload script, triggered by bo changes or schedule #1371

# Triggered on a schedule and manually via a dispatch event.
# This workflow test if the script is still working with the latest bo versions ('test').
# It also tests custom definable older script versions to determine if they still work
name: Test data upload script, triggered by bo changes or schedule
on:
schedule:
# Executes this workflow on a schedule (always uses the latest version on the default branch
# (see: https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule))
# Execution on weekdays at 02:27 UTC
- cron: "27 2 * * 1-5"
workflow_dispatch:
jobs:
# Short test on windows using PS7
integration_test_short_windows_ps7:
name: Short, Windows, PS7, version '${{ matrix.version }}'
runs-on: windows-2019
strategy:
matrix:
version:
- ${{fromJson(vars.VERSION_MATRIX)}}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.version }}
- name: Status
run: |
echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
echo "The ${{ github.repository }} repository has been cloned to the runner."
echo "The workflow is now ready to test your code on the runner."
- name: Execute test
shell: pwsh
run: |
echo "Test CSV import"
./business_objects_upload/test/TestWrapperScript.ps1 -short -dbType csv -baseUri ${{ secrets.BO_BASE_URI_TEST }} -apiKey "${{ secrets.BO_API_KEY_TEST }}" -configTemplatePath ./business_objects_upload/test/csv/ScriptConfig.template.json
# Short test on windows using PS5
integration_test_short_windows_ps5:
name: Short, Windows, PS5, version '${{ matrix.version }}'
runs-on: windows-2019
strategy:
matrix:
version:
- ${{fromJson(vars.VERSION_MATRIX)}}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.version }}
- name: Status
run: |
echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
echo "The ${{ github.repository }} repository has been cloned to the runner."
echo "The workflow is now ready to test your code on the runner."
- name: Execute test
shell: powershell
run: |
echo "Test CSV import"
./business_objects_upload/test/TestWrapperScript.ps1 -short -dbType csv -baseUri ${{ secrets.BO_BASE_URI_TEST }} -apiKey "${{ secrets.BO_API_KEY_TEST }}" -configTemplatePath ./business_objects_upload/test/csv/ScriptConfig.template.json
# Long test on ubuntu using PS7
integration_test_short_ubuntu_ps7_mssql:
name: Short, Ubuntu, PS7, mssql data source, version '${{ matrix.version }}'
runs-on: ubuntu-20.04
strategy:
matrix:
version:
- ${{fromJson(vars.VERSION_MATRIX)}}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.version }}
- name: Status
run: |
echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
echo "The ${{ github.repository }} repository has been cloned to the runner."
echo "The workflow is now ready to test your code on the runner."
- name: Execute test
shell: pwsh
run: |
echo "Test MSSQL import"
./.github/workflows/setup-mssql-db.ps1 -dbPassword ${{ secrets.MSSQL_DB_PASSWORD_TEST }}
./business_objects_upload/test/TestWrapperScript.ps1 -dbPassword ${{ secrets.MSSQL_DB_PASSWORD_TEST }} -dbType mssql -baseUri ${{ secrets.BO_BASE_URI_TEST }} -apiKey "${{ secrets.BO_API_KEY_TEST }}" -configTemplatePath ./business_objects_upload/test/mssql/ScriptConfig.template.json
# Long test on ubuntu using PS7
integration_test_long_ubuntu_ps7:
name: Long, Ubuntu, PS7, version, batching enabled '${{ matrix.version }}'
runs-on: ubuntu-20.04
strategy:
matrix:
version:
- ${{fromJson(vars.VERSION_MATRIX)}}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.version }}
- name: Status
run: |
echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
echo "The ${{ github.repository }} repository has been cloned to the runner."
echo "The workflow is now ready to test your code on the runner."
- name: Execute test
shell: pwsh
run: |
echo "Test CSV import"
./business_objects_upload/test/TestWrapperScript.ps1 -dbType csv -baseUri ${{ secrets.BO_BASE_URI_TEST }} -apiKey "${{ secrets.BO_API_KEY_TEST }}" -configTemplatePath ./business_objects_upload/test/csv/ScriptConfig.template.json
# Short test on ubuntu using PS7
integration_test_short_ubuntu_ps7_no_batching:
name: Short, Ubuntu, PS7, version, batching disabled '${{ matrix.version }}'
runs-on: ubuntu-20.04
strategy:
matrix:
version:
- ${{fromJson(vars.VERSION_MATRIX)}}
steps:
- uses: actions/checkout@v4
with:
ref: ${{ matrix.version }}
- name: Status
run: |
echo "The name of your branch is ${{ github.ref }} and your repository is ${{ github.repository }}."
echo "The ${{ github.repository }} repository has been cloned to the runner."
echo "The workflow is now ready to test your code on the runner."
- name: Execute test
shell: pwsh
run: |
echo "Test CSV import"
./business_objects_upload/test/TestWrapperScript.ps1 -short -noBatching -dbType csv -baseUri ${{ secrets.BO_BASE_URI_TEST }} -apiKey "${{ secrets.BO_API_KEY_TEST }}" -configTemplatePath ./business_objects_upload/test/csv/ScriptConfig.template.json
notify-teams:
runs-on: ubuntu-latest
if: ${{ always() && contains(join(needs.*.result, ','), 'failure') }}
needs:
[
integration_test_long_ubuntu_ps7,
integration_test_short_windows_ps5,
integration_test_short_windows_ps7,
integration_test_short_ubuntu_ps7_mssql,
integration_test_short_ubuntu_ps7_no_batching,
]
steps:
- uses: actions/checkout@v4
- name: Sending teams notification
run: |
chmod +x ./.github/workflows/notification.sh
echo "Sending teams notification"
./.github/workflows/notification.sh ${{ secrets.TEAMS_WEBHOOK }}