diff --git a/.github/workflows/code-check.yml b/.github/workflows/code-check.yml index e6d6f614a02..94cecfe8d66 100644 --- a/.github/workflows/code-check.yml +++ b/.github/workflows/code-check.yml @@ -2,8 +2,13 @@ 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: @@ -11,6 +16,8 @@ jobs: steps: - name: Check out code uses: actions/checkout@v2 + with: + ref: ${{ inputs.branch }} - name: Set up Python 3.8 uses: actions/setup-python@v2 diff --git a/.github/workflows/integration-tests.yml b/.github/workflows/integration-tests.yml index 4e661706b73..b9ae7f712c7 100644 --- a/.github/workflows/integration-tests.yml +++ b/.github/workflows/integration-tests.yml @@ -2,6 +2,11 @@ name: Integration tests on: workflow_dispatch: workflow_call: + inputs: + branch: + required: false + type: string + description: 'Branch to run on' secrets: FIREBOLT_USERNAME: required: true @@ -17,6 +22,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 diff --git a/.github/workflows/nightly-v0.yml b/.github/workflows/nightly-v0.yml new file mode 100644 index 00000000000..fd23cbb971d --- /dev/null +++ b/.github/workflows/nightly-v0.yml @@ -0,0 +1,10 @@ +name: v0.x Nightly code check +on: + workflow_dispatch: + schedule: + - cron: '0 3 * * *' # 3 am UTC every day +jobs: + code-check: + uses: ./.github/workflows/nightly-workflow.yml + with: + branch: 0.x diff --git a/.github/workflows/nightly-workflow.yml b/.github/workflows/nightly-workflow.yml new file mode 100644 index 00000000000..b241a6020ac --- /dev/null +++ b/.github/workflows/nightly-workflow.yml @@ -0,0 +1,91 @@ +name: Nightly workflow +on: + workflow_call: + inputs: + branch: + required: true + type: string + description: 'Branch to run on' +jobs: + code-check: + uses: ./.github/workflows/code-check.yml + with: + branch: ${{ inputs.branch }} + unit-tests: + uses: ./.github/workflows/unit-tests.yml + with: + branch: ${{ inputs.branch }} + secrets: + GIST_PAT: ${{ secrets.GIST_PAT }} + security-scan: + needs: [unit-tests] + uses: ./.github/workflows/security-scan.yml + with: + branch: ${{ inputs.branch }} + 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 + with: + ref: ${{ inputs.branch }} + + - 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: Unit test with pytest + run: | + pytest tests/unit + + - name: Setup database and engine + id: setup + uses: firebolt-db/integration-testing-setup@master + with: + firebolt-username: ${{ secrets.FIREBOLT_STG_USERNAME }} + firebolt-password: ${{ secrets.FIREBOLT_STG_PASSWORD }} + api-endpoint: "api.staging.firebolt.io" + region: "us-east-1" + db_suffix: ${{ format('{0}_{1}', matrix.os, matrix.python-version) }} + + - name: Run integration tests + env: + USER_NAME: ${{ secrets.FIREBOLT_STG_USERNAME }} + PASSWORD: ${{ secrets.FIREBOLT_STG_PASSWORD }} + SERVICE_ID: ${{ secrets.SERVICE_ID_STG }} + SERVICE_SECRET: ${{ secrets.SERVICE_SECRET_STG }} + 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" + API_ENDPOINT: "api.staging.firebolt.io" + run: | + pytest --timeout_method "thread" -o log_cli=true -o log_cli_level=INFO tests/integration + + - 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 }} diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 86ff292d336..992dfb8ab09 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -5,76 +5,6 @@ on: - cron: '0 3 * * *' # 3 am UTC every day jobs: code-check: - uses: ./.github/workflows/code-check.yml - unit-tests: - uses: ./.github/workflows/unit-tests.yml - secrets: - GIST_PAT: ${{ secrets.GIST_PAT }} - security-scan: - needs: [unit-tests] - uses: ./.github/workflows/security-scan.yml - 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: Unit test with pytest - run: | - pytest tests/unit - - - name: Setup database and engine - id: setup - uses: firebolt-db/integration-testing-setup@master - with: - firebolt-username: ${{ secrets.FIREBOLT_STG_USERNAME }} - firebolt-password: ${{ secrets.FIREBOLT_STG_PASSWORD }} - api-endpoint: "api.staging.firebolt.io" - region: "us-east-1" - db_suffix: ${{ format('{0}_{1}', matrix.os, matrix.python-version) }} - - - name: Run integration tests - env: - USER_NAME: ${{ secrets.FIREBOLT_STG_USERNAME }} - PASSWORD: ${{ secrets.FIREBOLT_STG_PASSWORD }} - SERVICE_ID: ${{ secrets.SERVICE_ID_STG }} - SERVICE_SECRET: ${{ secrets.SERVICE_SECRET_STG }} - 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" - API_ENDPOINT: "api.staging.firebolt.io" - run: | - pytest --timeout_method "thread" -o log_cli=true -o log_cli_level=INFO tests/integration - - - 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 }} + uses: ./.github/workflows/nightly-workflow.yml + with: + branch: main diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml index d19da4c30ab..9eab77e742d 100644 --- a/.github/workflows/pull-request.yml +++ b/.github/workflows/pull-request.yml @@ -2,7 +2,7 @@ name: Pull request on: pull_request: - branches: [ main ] + branches: [ main, 0.x ] jobs: check-title: diff --git a/.github/workflows/release-v0.yml b/.github/workflows/release-v0.yml new file mode 100644 index 00000000000..74ff77a8019 --- /dev/null +++ b/.github/workflows/release-v0.yml @@ -0,0 +1,45 @@ +name: v0.x Release new version + +on: + workflow_dispatch: + inputs: + pre-release-tag: + required: false + description: 'Tag for pre-release (optional)' + major-release: + required: false + description: 'Trigger a major release (optional). Leave empty for regular release.' + +jobs: + integration-tests: + uses: ./.github/workflows/integration-tests.yml + with: + branch: 0.x + secrets: + FIREBOLT_USERNAME: ${{ secrets.FIREBOLT_USERNAME }} + FIREBOLT_PASSWORD: ${{ secrets.FIREBOLT_PASSWORD }} + SERVICE_ID: ${{ secrets.SERVICE_ID }} + SERVICE_SECRET: ${{ secrets.SERVICE_SECRET }} + + publish: + runs-on: ubuntu-latest + permissions: + contents: write + needs: integration-tests + steps: + - name: Check out code + uses: actions/checkout@v2 + with: + fetch-depth: 0 + ref: 0.x + token: ${{ secrets.RELEASE_PAT }} + + - name: 'Publish action' + uses: firebolt-db/action-python-release@main + with: + pre-release-tag: ${{ inputs.pre-release-tag }} + major-release: ${{ inputs.major-release }} + pypi-username: ${{ secrets.PYPI_USERNAME }} + pypi-password: ${{ secrets.PYPI_PASSWORD }} + version-file-path: "src/firebolt/__init__.py" + main-branch: 0.x diff --git a/.github/workflows/security-scan.yml b/.github/workflows/security-scan.yml index fb8706108e3..0fdfabc3a8e 100644 --- a/.github/workflows/security-scan.yml +++ b/.github/workflows/security-scan.yml @@ -3,6 +3,11 @@ name: Firebolt Security Scan on: workflow_dispatch: workflow_call: + inputs: + branch: + required: false + type: string + description: 'Branch to run on' secrets: FOSSA_TOKEN: required: true @@ -15,6 +20,8 @@ jobs: steps: - name: "Checkout Code" uses: actions/checkout@v2 + with: + ref: ${{ inputs.branch }} - name: "Download coverage report" uses: actions/download-artifact@v2 diff --git a/.github/workflows/unit-tests.yml b/.github/workflows/unit-tests.yml index feed92fcbc7..e65fc7fb265 100644 --- a/.github/workflows/unit-tests.yml +++ b/.github/workflows/unit-tests.yml @@ -5,11 +5,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: @@ -19,6 +24,8 @@ jobs: steps: - name: Check out code uses: actions/checkout@v2 + with: + ref: ${{ github.event.inputs.branch }} - name: Set up Python 3.7 uses: actions/setup-python@v2