diff --git a/.github/workflows/ci-test-suite.yml b/.github/workflows/ci-test-suite.yml new file mode 100644 index 000000000..ada117771 --- /dev/null +++ b/.github/workflows/ci-test-suite.yml @@ -0,0 +1,53 @@ +name: "CI test suite" + +on: + workflow_call: + inputs: + ref: + description: "The branch/tag/commit to run integration tests on" + type: string + required: true + archive-name: + description: "Name of the archive for build artifacts, used during a release" + type: string + default: "" + +permissions: read-all + +concurrency: + group: "${{ github.workflow }}-${{ github.event_name }}-${{ inputs.ref }}" + cancel-in-progress: true + +jobs: + code-quality: + name: "Run code quality" + uses: dbt-labs/actions/.github/workflows/code-quality.yml@add-hatch-actions + with: + ref: ${{ inputs.ref }} + check-command: "hatch run code-quality" + python-version: ${{ vars.DBT_PYTHON_VERSION }} + + unit-tests: + name: "Run unit tests" + uses: dbt-labs/actions/.github/workflows/unit-tests.yml@add-hatch-actions + with: + ref: ${{ inputs.ref }} + test-command: "hatch run unit-tests:all" + python-versions: ${{ vars.DBT_PYTHON_VERSIONS }} + + integration-tests: + name: "Run integration tests" + uses: dbt-labs/actions/.github/workflows/integration-tests.yml@add-hatch-actions + with: + ref: ${{ inputs.ref }} + test-command: "hatch run integration-tests:all" + python-versions-ubuntu: ${{ vars.DBT_PYTHON_VERSIONS }} + python-versions-macos: ${{ vars.DBT_PYTHON_VERSION }} + python-versions-windows: ${{ vars.DBT_PYTHON_VERSION }} + + build-artifacts: + name: "Verify build artifacts" + uses: dbt-labs/actions/.github/workflows/build-release-artifacts.yml@add-hatch-actions + with: + ref: ${{ inputs.ref }} + archive-name: ${{ needs.release-inputs.outputs.archive-name }} diff --git a/.github/workflows/daily-checks.yml b/.github/workflows/daily-checks.yml index 0ee4b5c99..35d39260c 100644 --- a/.github/workflows/daily-checks.yml +++ b/.github/workflows/daily-checks.yml @@ -1,61 +1,29 @@ # **what?** -# The purpose of this workflow is to trigger CI to run for each release -# branch on a regular cadence. If the CI workflow fails for a branch, it -# will post to dev-core-alerts to raise awareness. +# - run scheduled CI on protected branches +# - post a failure message in #dev-adapter-alerts for failures # # **why?** -# Ensures release branches are always shippable and not broken. -# Also, can catch any dependencies shifting beneath us that might -# introduce breaking changes (could also impact Cloud). - +# - ensure release branches are always shippable +# - raise awareness of dependencies shifting beneath us +# # **when?** -# - daily based on DBT_DAILY_CHECKS_SCHEDULE +# - daily at 5:00 AM UTC # - manually name: "Daily checks" on: schedule: - - cron: ${{ vars.DBT_DAILY_CHECKS_SCHEDULE }} + - cron: 0 5 * * * workflow_dispatch: permissions: read-all jobs: - code-quality: - name: "Code quality" - uses: ./.github/workflows/code-quality.yml - strategy: - matrix: - branch: ${{ fromJSON(vars.DBT_DAILY_CHECKS_BRANCHES) }} - with: - branch: ${{ matrix.branch }} - - unit-tests: - name: "Unit tests" - uses: ./.github/workflows/unit-tests.yml - strategy: - matrix: - branch: ${{ fromJSON(vars.DBT_DAILY_CHECKS_BRANCHES) }} - with: - branch: ${{ matrix.branch }} - - integration-tests: - name: "Integration tests" - uses: ./.github/workflows/integration-tests.yml - strategy: - matrix: - branch: ${{ fromJSON(vars.DBT_DAILY_CHECKS_BRANCHES) }} - with: - branch: ${{ matrix.branch }} - - build-artifacts: - name: "Build artifacts" - uses: dbt-labs/actions/.github/workflows/build-artifacts.yml@add-hatch-actions - strategy: - matrix: - branch: ${{ fromJSON(vars.DBT_DAILY_CHECKS_BRANCHES) }} + ci-test-suite: + name: "CI test suite" + uses: ./.github/workflows/ci-test-suite.yml with: - branch: ${{ matrix.branch }} + ref: "main" post-failure: runs-on: ubuntu-latest diff --git a/.github/workflows/pull-request-checks.yml b/.github/workflows/pull-request-checks.yml index 8c1637324..5ee639352 100644 --- a/.github/workflows/pull-request-checks.yml +++ b/.github/workflows/pull-request-checks.yml @@ -1,3 +1,12 @@ +# **what?** +# - run CI on all PRs against protected branches +# +# **why?** +# - ensure code is verified prior to being merged into a protected branch +# +# **when?** +# - a PR is opened against a protected branch +# - code is pushed to a PR against a protected branch name: "Pull request checks" on: @@ -13,32 +22,8 @@ concurrency: cancel-in-progress: true jobs: - code-quality: - name: "Run code quality" - uses: dbt-labs/actions/.github/workflows/code-quality.yml + ci-test-suite: + name: "CI test suite" + uses: ./.github/workflows/ci-test-suite.yml with: ref: ${{ github.event.pull_request.head.ref }} - check-command: "hatch run code-quality" - python-version: ${{ vars.DBT_PYTHON_VERSION }} - - unit-tests: - name: "Run unit tests" - uses: dbt-labs/actions/.github/workflows/unit-tests.yml - with: - ref: ${{ github.event.pull_request.head.ref }} - test-command: "hatch run unit-tests:all" - python-versions: ${{ vars.DBT_PYTHON_VERSIONS }} - - integration-tests: - name: "Run unit tests" - uses: dbt-labs/actions/.github/workflows/integration-tests.yml - with: - ref: ${{ github.event.pull_request.head.ref }} - test-command: "hatch run integration-tests:all" - python-versions-ubuntu: ${{ vars.DBT_PYTHON_VERSIONS }} - python-versions-macos: ${{ vars.DBT_PYTHON_VERSION }} - python-versions-windows: ${{ vars.DBT_PYTHON_VERSION }} - - verify-build-artifacts: - name: "Verify build artifacts" - uses: dbt-labs/actions/.github/workflows/build-artifacts.yml@add-hatch-actions diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 272bb9c07..768805ac2 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -135,56 +135,22 @@ jobs: version: ${{ inputs.version }} secrets: inherit - code-quality: - name: "Run code quality" - needs: - - release-branch - - version-bump - - changelog - uses: dbt-labs/actions/.github/workflows/code-quality.yml@add-hatch-actions - with: - branch: ${{ needs.release-branch.outputs.branch }} - check-command: "hatch run code-quality" - - unit-tests: - name: "Run unit tests" + ci-test-suite: + name: "Run code quality, unit tests, and integration tests, and build artifacts" needs: + - release-inputs - release-branch - version-bump - changelog - uses: dbt-labs/actions/.github/workflows/unit-tests.yml@add-hatch-actions + uses: ./.github/workflows/ci-test-suite.yml with: ref: ${{ needs.release-branch.outputs.branch }} - - integration-tests: - name: "Run unit tests" - needs: - - release-branch - - version-bump - - changelog - uses: dbt-labs/actions/.github/workflows/integration-tests.yml@add-hatch-actions - with: - branch: ${{ needs.release-branch.outputs.branch }} - test-command: "hatch run unit-tests:all" - - build-artifacts: - name: "Build artifacts" - if: ${{ !failure() && !cancelled() }} - needs: - - release-inputs - - release-branch - - code-quality - - unit-tests - - integration-tests - uses: dbt-labs/actions/.github/workflows/build-artifacts.yml@add-hatch-actions - with: - branch: ${{ needs.release-branch.outputs.branch }} archive-name: ${{ needs.release-inputs.outputs.archive-name }} merge-changes: name: "Merge the version bump and changelog updates" needs: - - build-artifacts + - ci-test-suite - release-branch runs-on: ubuntu-latest outputs: