Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
9 changes: 8 additions & 1 deletion .github/workflows/code-check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@ name: Code quality checks

on:
workflow_call:
inputs:
branch:
required: false
type: string
description: 'Branch to run on'
push:
branches: [ main ]
branches: [ main, 0.x ]

jobs:
check-code:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
with:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What will happen if action is triggered automatically from a push to 0.x branch? Will inputs.branch have a correct value?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When empty it defaults to the "event" that triggered the run. In this case it will checkout 0.x branch.
https://github.com/actions/checkout#usage

ref: ${{ inputs.branch }}

- name: Set up Python 3.8
uses: actions/setup-python@v2
Expand Down
103 changes: 103 additions & 0 deletions .github/workflows/nightly-v0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,103 @@
name: v0.x Nightly code check
on:
workflow_dispatch:
schedule:
- cron: '0 4 * * *' # 4 am UTC every day
jobs:
code-check:
uses: ./.github/workflows/code-check.yml
with:
branch: 0.x
unit-tests:
uses: ./.github/workflows/unit-tests.yml
with:
branch: 0.x
secrets:
GIST_PAT: ${{ secrets.GIST_PAT }}
security-scan:
needs: [unit-tests]
uses: ./.github/workflows/security-scan.yml
with:
branch: 0.x
secrets:
FOSSA_TOKEN: ${{ secrets.FOSSA_TOKEN }}
SONARCLOUD_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}
tests:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false # finish all jobs even if one fails
max-parallel: 2
matrix:
os: ['ubuntu-latest', 'macos-latest', 'windows-latest']
python-version: ['3.7', '3.8', '3.9', '3.10']
steps:
- name: Check out code
uses: actions/checkout@v2

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}

- name: Install dependencies
run: |
python -m pip install --upgrade pip
python -m pip install ".[dev]"

- name: Test with pytest
run: |
pytest tests/unit

- name: Setup database and engine
id: setup
uses: firebolt-db/integration-testing-setup@v1
with:
firebolt-username: ${{ secrets.FIREBOLT_USERNAME }}
firebolt-password: ${{ secrets.FIREBOLT_PASSWORD }}
api-endpoint: "api.dev.firebolt.io"
region: "us-east-1"
db_suffix: ${{ format('{0}_{1}', matrix.os, matrix.python-version) }}

- 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 }}

- name: Run integration tests
env:
USER_NAME: ${{ secrets.FIREBOLT_USERNAME }}
PASSWORD: ${{ secrets.FIREBOLT_PASSWORD }}
SERVICE_ID: ${{ secrets.SERVICE_ID }}
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET }}
DATABASE_NAME: ${{ steps.setup.outputs.database_name }}
ENGINE_NAME: ${{ steps.setup.outputs.engine_name }}
ENGINE_URL: ${{ steps.setup.outputs.engine_url }}
STOPPED_ENGINE_NAME: ${{ steps.setup.outputs.stopped_engine_name }}
STOPPED_ENGINE_URL: ${{ steps.setup.outputs.stopped_engine_url }}
ACCOUNT_NAME: "firebolt"
FIREBOLT_BASE_URL: "api.dev.firebolt.io"
run: |
pytest --last-failed -o log_cli=true -o log_cli_level=INFO --junit-xml=report/junit.xml tests/integration

- 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: Slack Notify of failure
if: failure()
id: slack
uses: firebolt-db/action-slack-nightly-notify@v1
with:
os: ${{ matrix.os }}
programming-language: Python
language-version: ${{ matrix.python-version }}
notifications-channel: 'ecosystem-ci-notifications'
slack-api-key: ${{ secrets.SLACK_BOT_TOKEN }}
18 changes: 7 additions & 11 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -44,12 +44,12 @@ jobs:

- name: Setup database and engine
id: setup
uses: firebolt-db/integration-testing-setup@v1
uses: firebolt-db/integration-testing-setup@v2
with:
firebolt-username: ${{ secrets.FIREBOLT_USERNAME }}
firebolt-password: ${{ secrets.FIREBOLT_PASSWORD }}
firebolt-client-id: ${{ secrets.FIREBOLT_CLIENT_ID_NEW_IDN }}
firebolt-client-secret: ${{ secrets.FIREBOLT_CLIENT_SECRET_NEW_IDN }}
account: "developer"
api-endpoint: "api.dev.firebolt.io"
region: "us-east-1"
db_suffix: ${{ format('{0}_{1}', matrix.os, matrix.python-version) }}

- name: Restore cached failed tests
Expand All @@ -62,17 +62,13 @@ jobs:

- name: Run integration tests
env:
USER_NAME: ${{ secrets.FIREBOLT_USERNAME }}
PASSWORD: ${{ secrets.FIREBOLT_PASSWORD }}
SERVICE_ID: ${{ secrets.SERVICE_ID }}
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET }}
SERVICE_ID: ${{ secrets.FIREBOLT_CLIENT_ID_NEW_IDN }}
SERVICE_SECRET: ${{ secrets.FIREBOLT_CLIENT_SECRET_NEW_IDN }}
DATABASE_NAME: ${{ steps.setup.outputs.database_name }}
ENGINE_NAME: ${{ steps.setup.outputs.engine_name }}
ENGINE_URL: ${{ steps.setup.outputs.engine_url }}
STOPPED_ENGINE_NAME: ${{ steps.setup.outputs.stopped_engine_name }}
STOPPED_ENGINE_URL: ${{ steps.setup.outputs.stopped_engine_url }}
ACCOUNT_NAME: "firebolt"
FIREBOLT_BASE_URL: "api.dev.firebolt.io"
ACCOUNT_NAME: "developer"
run: |
pytest --last-failed -o log_cli=true -o log_cli_level=INFO --junit-xml=report/junit.xml tests/integration

Expand Down
74 changes: 74 additions & 0 deletions .github/workflows/python-integration-tests-v0.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
name: v0.x Integration tests

on:
workflow_dispatch:
workflow_call:
secrets:
FIREBOLT_USERNAME:
required: true
FIREBOLT_PASSWORD:
required: true
SERVICE_ID:
required: true
SERVICE_SECRET:
required: true

jobs:
integration-tests:
runs-on: ubuntu-latest
steps:
- name: Check out code
uses: actions/checkout@v2
with:
ref: 0.x

- name: Set up Python 3.7
uses: actions/setup-python@v2
with:
python-version: 3.7

- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install ".[dev]"

- name: Setup database and engine
id: setup
uses: firebolt-db/integration-testing-setup@v1
with:
firebolt-username: ${{ secrets.FIREBOLT_USERNAME }}
firebolt-password: ${{ secrets.FIREBOLT_PASSWORD }}
api-endpoint: "api.dev.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 }}

- name: Run integration tests
env:
USER_NAME: ${{ secrets.FIREBOLT_USERNAME }}
PASSWORD: ${{ secrets.FIREBOLT_PASSWORD }}
SERVICE_ID: ${{ secrets.SERVICE_ID }}
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET }}
DATABASE_NAME: ${{ steps.setup.outputs.database_name }}
ENGINE_NAME: ${{ steps.setup.outputs.engine_name }}
ENGINE_URL: ${{ steps.setup.outputs.engine_url }}
STOPPED_ENGINE_NAME: ${{ steps.setup.outputs.stopped_engine_name }}
STOPPED_ENGINE_URL: ${{ steps.setup.outputs.stopped_engine_url }}
FIREBOLT_BASE_URL: "api.dev.firebolt.io"
run: |
pytest --last-failed -o log_cli=true -o log_cli_level=INFO tests/integration

- 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 }}
59 changes: 47 additions & 12 deletions .github/workflows/python-integration-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,34 @@ name: Integration tests

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
branch:
required: false
type: string
description: 'Branch to run on'
secrets:
FIREBOLT_CLIENT_ID_STG_NEW_IDN:
required: true
FIREBOLT_CLIENT_SECRET_STG_NEW_IDN:
required: true
FIREBOLT_CLIENT_ID_NEW_IDN:
required: true
FIREBOLT_CLIENT_SECRET_NEW_IDN:
required: true

jobs:
integration-tests:
Expand All @@ -20,14 +48,24 @@ jobs:
python -m pip install --upgrade pip
pip install ".[dev]"

- name: Determine env variables
run: |
if [ "${{ inputs.environment }}" == 'staging' ]; then
echo "CLIENT_ID=${{ secrets.FIREBOLT_CLIENT_ID_STG_NEW_IDN }}" >> "$GITHUB_ENV"
echo "CLIENT_SECRET=${{ secrets.FIREBOLT_CLIENT_SECRET_STG_NEW_IDN }}" >> "$GITHUB_ENV"
else
echo "CLIENT_ID=${{ secrets.FIREBOLT_CLIENT_ID_NEW_IDN }}" >> "$GITHUB_ENV"
echo "CLIENT_SECRET=${{ secrets.FIREBOLT_CLIENT_SECRET_NEW_IDN }}" >> "$GITHUB_ENV"
fi

- name: Setup database and engine
id: setup
uses: firebolt-db/integration-testing-setup@v1
uses: firebolt-db/integration-testing-setup@v2
with:
firebolt-username: ${{ secrets.FIREBOLT_USERNAME }}
firebolt-password: ${{ secrets.FIREBOLT_PASSWORD }}
api-endpoint: "api.dev.firebolt.io"
region: "us-east-1"
firebolt-client-id: ${{ env.CLIENT_ID }}
firebolt-client-secret: ${{ env.CLIENT_SECRET }}
account: "developer"
api-endpoint: "api.${{ inputs.environment }}.firebolt.io"

- name: Restore cached failed tests
id: cache-tests-restore
Expand All @@ -39,16 +77,13 @@ jobs:

- name: Run integration tests
env:
USER_NAME: ${{ secrets.FIREBOLT_USERNAME }}
PASSWORD: ${{ secrets.FIREBOLT_PASSWORD }}
SERVICE_ID: ${{ secrets.SERVICE_ID }}
SERVICE_SECRET: ${{ secrets.SERVICE_SECRET }}
SERVICE_ID: ${{ env.CLIENT_ID }}
SERVICE_SECRET: ${{ env.CLIENT_SECRET }}
DATABASE_NAME: ${{ steps.setup.outputs.database_name }}
ENGINE_NAME: ${{ steps.setup.outputs.engine_name }}
ENGINE_URL: ${{ steps.setup.outputs.engine_url }}
STOPPED_ENGINE_NAME: ${{ steps.setup.outputs.stopped_engine_name }}
STOPPED_ENGINE_URL: ${{ steps.setup.outputs.stopped_engine_url }}
FIREBOLT_BASE_URL: "api.dev.firebolt.io"
FIREBOLT_BASE_URL: "api.${{ inputs.environment }}.firebolt.io"
ACCOUNT_NAME: "developer"
run: |
pytest --last-failed -o log_cli=true -o log_cli_level=INFO tests/integration

Expand Down
7 changes: 7 additions & 0 deletions .github/workflows/security-scan.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@ name: Firebolt Security Scan

on:
workflow_call:
inputs:
branch:
required: false
type: string
description: 'Branch to run on'
secrets:
FOSSA_TOKEN:
required: true
Expand All @@ -14,6 +19,8 @@ jobs:
steps:
- name: "Checkout Code"
uses: actions/checkout@v2
with:
ref: ${{ inputs.branch }}

- name: "Download coverage report"
uses: actions/download-artifact@v2
Expand Down
9 changes: 8 additions & 1 deletion .github/workflows/unit-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,16 @@ name: Unit tests

on:
workflow_call:
inputs:
branch:
required: false
type: string
description: 'Branch to run on'
secrets:
GIST_PAT:
required: true
push:
branches: [ main ]
branches: [ main, 0.x ]

jobs:
unit-tests:
Expand All @@ -16,6 +21,8 @@ jobs:
steps:
- name: Check out code
uses: actions/checkout@v2
with:
ref: ${{ inputs.branch }}

- name: Set up Python 3.7
uses: actions/setup-python@v2
Expand Down
Loading