Skip to content

Break apart CI workflows into composite actions #5917

Break apart CI workflows into composite actions

Break apart CI workflows into composite actions #5917

Workflow file for this run

# **what?**
# Runs all unit tests, code quality checks, and build checks for supported OS's and Python versions.
#
# **why?**
# Check the functionality of dbt from a developer's perspective and attempt to catch implementation regressions.
#
# **how?**
# Run the workflow in Actions.
# Create a PR against a protected branch.
# This workflow cannot use any secrets since it runs for PRs from forked repos.
# By default, secrets are not passed to workflows running from a forked repo.
#
# **when?**
# A commit is pushed to a PR against a protected branch.
# A PR is merged into a protected branch.
# Manually triggered.
name: Tests and Code Checks
on:
push:
branches:
- "main"
- "develop"
- "*.latest"
- "releases/*"
pull_request:
workflow_dispatch:
permissions: read-all
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ contains(github.event_name, 'pull_request') && github.event.pull_request.head.ref || github.sha }}
cancel-in-progress: true
defaults:
run:
shell: bash
jobs:
code-quality:
name: Code Quality
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: ./.github/actions/run-code-quality
unit-tests:
name: Unit Tests / Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
if: github.event_name == 'pull_request_target'
with:
persist-credentials: false
ref: ${{ github.event.pull_request.head.sha }}
- uses: actions/checkout@v3
if: github.event_name != 'pull_request_target'
with:
persist-credentials: false
- uses: ./.github/actions/run-unit-tests
with:
python-version: ${{ matrix.python-version }}
- uses: ./.github/actions/archive-test-results
with:
python-version: ${{ matrix.python-version }}
file-name-stub: unit_results
build-artifacts:
name: Build Artifacts
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: ./.github/actions/build-artifacts
- uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
verify-artifacts:
name: Verify Artifacts / Python ${{ matrix.python-version }} / ${{ matrix.os }}
runs-on: ${{ matrix.os }}
needs: build-artifacts
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
python-version: ['3.8', '3.9', '3.10', '3.11']
steps:
- uses: actions/checkout@v3
with:
persist-credentials: false
- uses: ./.github/actions/verify-artifacts
with:
python-version: ${{ matrix.python-version }}