-
Notifications
You must be signed in to change notification settings - Fork 2
151 lines (126 loc) · 3.93 KB
/
workflow.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
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-minor-version:
- "7"
- "8"
- "9"
- "10"
steps:
- uses: actions/checkout@v2
- name: Set up Python ${{ matrix.python-minor-version }}
uses: actions/setup-python@v2
with:
python-version: 3.${{ matrix.python-minor-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 "^(?!3\.${{ matrix.python-minor-version }}).*"
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