Skip to content

Handle dbt flags based on version #172

Handle dbt flags based on version

Handle dbt flags based on version #172

Workflow file for this run

name: CI pipeline
on:
pull_request:
push:
branches:
- main
tags:
- '*'
workflow_dispatch:
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install pre-commit
shell: bash
run: |
python -m pip install --upgrade pip
python -m pip install pre-commit
- name: Run pre-commit hooks
shell: bash
run: pre-commit run --all-file
tests:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
python-version:
- "3.7"
- "3.8"
- "3.9"
- "3.10"
- "3.11"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
sudo apt-get install libsasl2-dev
python -m pip install --upgrade pip
python -m pip install tox
- name: Test with tox
run: tox --skip-env "^py(?!${{ matrix.python-version }}).*"
- name: Test docs with tox
run: tox -e docs
test-release:
if: contains(github.ref, 'refs/tags/')
runs-on: ubuntu-latest
needs:
- tests
- "pre-commit"
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
sudo apt-get install libsasl2-dev
python -m pip install --upgrade pip
python -m pip install twine wheel setuptools setuptools-scm
- name: Test release
run: |
python setup.py sdist bdist_wheel
pip install dist/pytest-dbt-core-*.tar.gz
pip install dist/pytest_dbt_core-*-py3-none-any.whl
twine check dist/pytest_dbt_core-*-py3-none-any.whl dist/pytest-dbt-core-*.tar.gz
github-release:
runs-on: ubuntu-latest
needs: test-release
steps:
- 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
python -m pip install setuptools-scm
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::$(python setup.py --version)
- name: Find release type
id: get_release_type
env:
IS_PRERELEASE: ${{ contains(env.version_number, 'rc') || contains(env.version_number, 'b') }}
run: echo ::set-output name=isPrerelease::$IS_PRERELEASE
- name: Create GitHub release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: pytest-dbt-core ${{ steps.get_version.outputs.VERSION }}
prerelease: ${{ steps.get_release_type.outputs.IS_PRERELEASE }}
body: ${{ github.event.head_commit.message }}
pypi-release:
runs-on: ubuntu-latest
needs: test-release
steps:
- uses: actions/checkout@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- name: Install dependencies
run: |
sudo apt-get install libsasl2-dev
python -m pip install --upgrade pip
python -m pip install twine wheel setuptools setuptools-scm
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::$(python setup.py --version)
- name: Release to pypi
env:
TWINE_USERNAME: __token__
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
run: |
python setup.py sdist bdist_wheel
twine upload --skip-existing --non-interactive dist/pytest_dbt_core-${{ steps.get_version.outputs.VERSION }}-py3-none-any.whl dist/pytest-dbt-core-${{ steps.get_version.outputs.VERSION }}.tar.gz