Skip to content

Commit

Permalink
chore(cicd): Automate release creation on tag push
Browse files Browse the repository at this point in the history
These CI/CD improvements also bring test coverage tracking, and better
naming for test steps.
  • Loading branch information
tomasfarias committed Jan 22, 2022
1 parent bdaa841 commit b2e195b
Show file tree
Hide file tree
Showing 4 changed files with 70 additions and 17 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/pypi_deploy.yaml
@@ -1,20 +1,22 @@
name: PyPI deploy
on:
push:
tags: '*'
release:
types: [created]

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: 3.9
- uses: abatilo/actions-poetry@v2.1.3
- name: install
- name: Install Poetry
uses: abatilo/actions-poetry@v2.1.3
- name: Install redtape with Poetry
run: poetry install
- name: build
- name: Build redtape with Poetry
run: poetry build
- name: publish
- name: Publish redtape to Pypi with Poetry
run: poetry publish --username __token__ --password ${{ secrets.PYPI_API_TOKEN }}
38 changes: 38 additions & 0 deletions .github/workflows/tagged_release.yml
@@ -0,0 +1,38 @@
name: Tagged release

on:
push:
tags:
- "v*"

jobs:
gh_tagged_release:
runs-on: ubuntu-latest
steps:
- name: Wait for Tests to succeed
uses: fountainhead/action-wait-for-check@v1.0.0
id: wait-for-test
with:
token: ${{ secrets.PA_TOKEN }}
checkName: test
ref: ${{ github.sha }}
- uses: actions/checkout@v2.3.4
- name: Set up Python 3.9
uses: actions/setup-python@v2
with:
python-version: '3.9'
- name: Install Poetry
uses: abatilo/actions-poetry@v2.1.4
with:
poetry-version: 1.1.12
- name: Install redtape with Poetry
run: poetry install
- name: Build redtape with Poetry
run: poetry build
- name: Release new SemVer tag
uses: marvinpinto/action-automatic-releases@latest
with:
repo_token: "${{ secrets.PA_TOKEN }}"
prerelease: false
files: |
dist/*
32 changes: 22 additions & 10 deletions .github/workflows/test.yaml
@@ -1,7 +1,9 @@
name: Tests
name: Test
on:
push:
branches: [ master ]
tags:
- "v*"
pull_request:
branches:
- master
Expand All @@ -15,21 +17,31 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- uses: actions/setup-python@v2
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v2
with:
python-version: ${{ matrix.python-version }}
- uses: abatilo/actions-poetry@v2.1.4
- name: Install Poetry
uses: abatilo/actions-poetry@v2.1.4
with:
poetry-version: 1.1.12
- name: install
- name: Install airflow-dbt-python with Poetry
run: poetry install -E amazon -E postgres
- name: flake8
- name: Style guide enforcement with flake8
run: poetry run flake8 .
- name: mypy
- name: Static type checking with mypy
run: poetry run mypy .
- name: black
- name: Code formatting with black
run: poetry run black --check .
- name: init airflow db
- name: Initialize Airflow db for testing
run: poetry run airflow db init
- name: test
run: poetry run pytest -v tests/
- name: Run tests with pytest
run: poetry run pytest -v --cov=./airflow_dbt_python --cov-report=xml:./coverage.xml --cov-report term-missing tests/
- name: Upload code coverage
uses: codecov/codecov-action@v2
with:
token: ${{ secrets.CODECOV_TOKEN }}
file: ./coverage.xml
name: redtape
flags: unittests
env_vars: OS,PYTHON
1 change: 1 addition & 0 deletions README.md
Expand Up @@ -3,6 +3,7 @@
[![PyPI version](https://img.shields.io/pypi/v/airflow-dbt-python?style=plastic)](https://pypi.org/project/airflow-dbt-python/)
[![GitHub build status](https://github.com/tomasfarias/airflow-dbt-python/actions/workflows/test.yaml/badge.svg)](https://github.com/tomasfarias/airflow-dbt-python/actions)
[![Code style: black](https://img.shields.io/badge/code%20style-black-000000.svg)](https://github.com/psf/black)
[![Test coverage](https://codecov.io/gh/tomasfarias/airflow-dbt-python/branch/master/graph/badge.svg?token=HBKZ78F11F)](https://codecov.io/gh/tomasfarias/airflow-dbt-python)

An [Airflow](https://airflow.apache.org/) operator and hook to interface with the [`dbt-core`](https://pypi.org/project/dbt-core/) Python package.

Expand Down

0 comments on commit b2e195b

Please sign in to comment.