Run integration tests V1 #12
Workflow file for this run
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: Run integration tests V1 | |
on: | |
workflow_dispatch: | |
inputs: | |
environment: | |
description: 'Environment to run the tests against' | |
type: choice | |
required: true | |
default: 'dev' | |
options: | |
- dev | |
- staging | |
workflow_call: | |
inputs: | |
environment: | |
default: 'staging' | |
required: false | |
type: string | |
secrets: | |
FIREBOLT_STG_USERNAME: | |
required: true | |
FIREBOLT_STG_PASSWORD: | |
required: true | |
FIREBOLT_USERNAME: | |
required: true | |
FIREBOLT_PASSWORD: | |
required: true | |
jobs: | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out code | |
uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install ".[dev]" --no-cache-dir | |
- name: Determine env variables | |
run: | | |
if [ "${{ inputs.environment }}" == 'staging' ]; then | |
echo "USERNAME=${{ secrets.FIREBOLT_STG_USERNAME }}" >> "$GITHUB_ENV" | |
sanitized_pass=$(echo '${{ secrets.FIREBOLT_STG_PASSWORD }}' | sed -e 's/\\/\\\\/g' -e 's/\//\\\//g' -e 's/\$/%24/g') | |
echo "PASSWORD=$sanitized_pass" >> "$GITHUB_ENV" | |
else | |
echo "USERNAME=${{ secrets.FIREBOLT_USERNAME }}" >> "$GITHUB_ENV" | |
echo "PASSWORD=${{ secrets.FIREBOLT_PASSWORD }}" >> "$GITHUB_ENV" | |
fi | |
- name: Keep environment name in the summary | |
run: echo '### Ran integration tests against ${{ inputs.environment }} ' >> $GITHUB_STEP_SUMMARY | |
- name: Setup database and engine | |
id: setup | |
uses: firebolt-db/integration-testing-setup@v1 | |
with: | |
firebolt-username: ${{ env.USERNAME }} | |
firebolt-password: '${{ env.PASSWORD }}' | |
api-endpoint: "api.${{ inputs.environment }}.firebolt.io" | |
region: "us-east-1" | |
- name: Restore cached failed tests | |
id: cache-tests-restore | |
uses: actions/cache/restore@v3 | |
with: | |
path: | | |
.pytest_cache/v/cache/lastfailed | |
key: ${{ runner.os }}-pytest-restore-failed-${{ github.ref }}-${{ github.sha }}-v1 | |
- name: Run integration tests | |
env: | |
USER_NAME: ${{ env.USERNAME }} | |
PASSWORD: ${{ env.PASSWORD }} | |
DATABASE_NAME: ${{ steps.setup.outputs.database_name }} | |
ENGINE_NAME: ${{ steps.setup.outputs.engine_name }} | |
API_ENDPOINT: "api.${{ inputs.environment }}.firebolt.io" | |
ACCOUNT_NAME: "firebolt" | |
run: | | |
pytest --last-failed -o log_cli=true -o log_cli_level=INFO tests/functional/ --alluredir=allure-results | |
- name: Save failed tests | |
id: cache-tests-save | |
uses: actions/cache/save@v3 | |
if: failure() | |
with: | |
path: | | |
.pytest_cache/v/cache/lastfailed | |
key: ${{ steps.cache-tests-restore.outputs.cache-primary-key }} | |
- name: Get Allure history | |
uses: actions/checkout@v2 | |
if: always() | |
continue-on-error: true | |
with: | |
ref: gh-pages | |
path: gh-pages | |
- name: Allure Report | |
uses: firebolt-db/action-allure-report@v1 | |
if: always() | |
with: | |
github-key: ${{ secrets.GITHUB_TOKEN }} | |
test-type: integration-v1 |