Skip to content

Commit b70b2c2

Browse files
authored
[Backport 1.9.latest] Combine the build and check build jobs into one job (#986) (#991)
* combine the build and check build jobs into one job, benefiting from the matrix and avoiding the need to upload and download the artifacts * install postgresql for macos build checks to get pg_config
1 parent 6d3d396 commit b70b2c2

File tree

1 file changed

+29
-82
lines changed

1 file changed

+29
-82
lines changed

.github/workflows/main.yml

Lines changed: 29 additions & 82 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,12 @@ jobs:
4343

4444
steps:
4545
- name: Check out the repository
46-
uses: actions/checkout@v3
46+
uses: actions/checkout@v4
4747
with:
4848
persist-credentials: false
4949

5050
- name: Set up Python
51-
uses: actions/setup-python@v4.3.0
51+
uses: actions/setup-python@v4
5252
with:
5353
python-version: '3.9'
5454

@@ -80,12 +80,12 @@ jobs:
8080

8181
steps:
8282
- name: Check out the repository
83-
uses: actions/checkout@v3
83+
uses: actions/checkout@v4
8484
with:
8585
persist-credentials: false
8686

8787
- name: Set up Python ${{ matrix.python-version }}
88-
uses: actions/setup-python@v4.3.0
88+
uses: actions/setup-python@v4
8989
with:
9090
python-version: ${{ matrix.python-version }}
9191

@@ -106,98 +106,45 @@ jobs:
106106
run: |
107107
echo "date=$(date +'%Y-%m-%dT%H_%M_%S')" >> $GITHUB_OUTPUT
108108
109-
build:
110-
name: build packages
111-
112-
runs-on: ubuntu-latest
113-
114-
outputs:
115-
is_alpha: ${{ steps.check-is-alpha.outputs.is_alpha }}
116-
117-
steps:
118-
- name: Check out the repository
119-
uses: actions/checkout@v3
120-
with:
121-
persist-credentials: false
122-
123-
- name: Set up Python
124-
uses: actions/[email protected]
125-
with:
126-
python-version: '3.9'
127-
128-
- name: Install python dependencies
129-
run: |
130-
python -m pip install --user --upgrade pip
131-
python -m pip install --upgrade setuptools wheel twine check-wheel-contents
132-
python -m pip --version
133-
134-
- name: Build distributions
135-
run: ./scripts/build-dist.sh
136-
137-
- name: Show distributions
138-
run: ls -lh dist/
139-
140-
- name: Check distribution descriptions
141-
run: |
142-
twine check dist/*
143-
144-
- name: Check wheel contents
145-
run: |
146-
check-wheel-contents dist/*.whl --ignore W007,W008
147-
148-
- name: Check if this is an alpha version
149-
id: check-is-alpha
150-
run: |
151-
export is_alpha=0
152-
if [[ "$(ls -lh dist/)" == *"a1"* ]]; then export is_alpha=1; fi
153-
echo "is_alpha=$is_alpha" >> $GITHUB_OUTPUT
154-
155109
test-build:
156110
name: verify packages / python ${{ matrix.python-version }} / ${{ matrix.os }}
157-
158-
if: needs.build.outputs.is_alpha == 0
159-
160-
needs: build
161-
162111
runs-on: ${{ matrix.os }}
163-
164112
strategy:
165113
fail-fast: false
166114
matrix:
167-
os: [ubuntu-latest, macos-14, windows-latest]
115+
os: [ubuntu-22.04, macos-14, windows-2022]
168116
python-version: ['3.9', '3.10', '3.11']
117+
dist-type: ["whl", "gz"]
169118
exclude:
170119
# psycopg2-binary doesn't have a precompiled wheel for python 3.9 for mac
171120
- os: macos-14
172121
python-version: '3.9'
173-
174122
steps:
175-
- name: Set up Python ${{ matrix.python-version }}
176-
uses: actions/[email protected]
123+
- uses: actions/checkout@v4
177124
with:
178-
python-version: ${{ matrix.python-version }}
179-
125+
persist-credentials: false
126+
- uses: actions/setup-python@v4
127+
with:
128+
python-version: '3.9'
180129
- name: Install python dependencies
181130
run: |
182-
python -m pip install --user --upgrade pip
183-
python -m pip install --upgrade wheel
131+
python -m pip install --user --upgrade pip
132+
python -m pip install --upgrade setuptools wheel twine check-wheel-contents
184133
python -m pip --version
185-
186-
- name: Show distributions
187-
run: ls -lh dist/
188-
189-
- name: Install wheel distributions
190-
run: |
191-
find ./dist/*.whl -maxdepth 1 -type f | xargs python -m pip install --force-reinstall --find-links=dist/
192-
193-
- name: Check wheel distributions
194-
run: |
195-
dbt --version
196-
197-
- name: Install source distributions
198-
run: |
199-
find ./dist/*.gz -maxdepth 1 -type f | xargs python -m pip install --force-reinstall --find-links=dist/
200-
201-
- name: Check source distributions
134+
- if: matrix.os == 'macos-14'
135+
run: brew install postgresql@14
136+
- run: ./scripts/build-dist.sh
137+
- run: ls -lh dist/
138+
- run: twine check dist/*
139+
- run: check-wheel-contents dist/*.whl --ignore W007,W008
140+
- id: check-is-alpha
202141
run: |
203-
dbt --version
142+
export is_alpha=0
143+
if [[ "$(ls -lh dist/)" == *"a1"* ]]; then export is_alpha=1; fi
144+
echo "is_alpha=$is_alpha" >> $GITHUB_OUTPUT
145+
- name: Install ${{ matrix.dist-type }} distributions
146+
if: ${{ steps.check-is-alpha.outputs.is_alpha == 0 }}
147+
run: find ./dist/*.${{ matrix.dist-type }} -maxdepth 1 -type f | xargs python -m pip install --force-reinstall --find-links=dist/
148+
- name: Check ${{ matrix.dist-type }} distributions
149+
if: ${{ steps.check-is-alpha.outputs.is_alpha == 0 }}
150+
run: python -c "import dbt.adapters.redshift"

0 commit comments

Comments
 (0)