Skip to content

Commit 5ace4f7

Browse files
committed
Try a different test workflow structure
1 parent 208ee8c commit 5ace4f7

File tree

1 file changed

+75
-23
lines changed

1 file changed

+75
-23
lines changed

.github/workflows/run_all_tests.yml

Lines changed: 75 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -12,9 +12,6 @@ jobs:
1212
run-all-tests:
1313
name: ${{ matrix.name }}
1414
runs-on: ${{ matrix.os }}
15-
defaults:
16-
run:
17-
shell: bash
1815
concurrency:
1916
group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.name }}
2017
cancel-in-progress: true
@@ -72,33 +69,88 @@ jobs:
7269
run: |
7370
pytest -v
7471
75-
- name: Build wheel and source distribution
72+
build:
73+
runs-on: ubuntu-latest
74+
steps:
75+
- uses: actions/checkout@v4
76+
with:
77+
fetch-depth: 0 # tags are required to determine the version
78+
79+
- uses: actions/setup-python@v5
80+
with:
81+
python-version: "3.x" # use the latest stable version of Python
82+
83+
- name: Build and check wheel and source distribution
7684
run: |
77-
python -m pip install --upgrade build
85+
python -m pip install --upgrade build twine
7886
python -m build
79-
ls -1 dist
87+
twine check dist/*
8088
81-
- name: Create virtual environment for testing installation from the wheel
82-
run: |
83-
python -m venv test-wheel-env
89+
- name: Upload wheel and sdist artifacts
90+
uses: actions/upload-artifact@v4
91+
with:
92+
name: dist
93+
path: dist/
8494

85-
- name: Activate virtual environment for testing installation from the wheel (POSIX)
86-
if: ${{ matrix.os != 'windows-latest' }}
87-
run: |
88-
source test-wheel-env/bin/activate
95+
- name: Build git archive
96+
run: mkdir archive && git archive -v -o archive/archive.tgz HEAD
8997

90-
- name: Activate virtual environment for testing installation from the wheel (Windows)
91-
if: ${{ matrix.os == 'windows-latest' }}
92-
run: |
93-
source test-wheel-env/Scripts/activate
98+
- name: Upload git archive artifact
99+
uses: actions/upload-artifact@v4
100+
with:
101+
name: archive
102+
path: archive/
94103

95-
- name: Install the package from the wheel and check import
96-
run: |
97-
python -m pip list
98-
python -m pip install dist/*-none-any.whl
99-
python -c "import ndx_franklab_novela"
104+
test-package:
105+
runs-on: ubuntu-latest
106+
needs: [build]
107+
strategy:
108+
matrix:
109+
package: ["wheel", "sdist", "archive"]
110+
steps:
111+
- name: Download sdist and wheel artifacts
112+
if: matrix.package != 'archive'
113+
uses: actions/download-artifact@v4
114+
with:
115+
name: dist
116+
path: dist/
117+
118+
- name: Download git archive artifact
119+
if: matrix.package == 'archive'
120+
uses: actions/download-artifact@v4
121+
with:
122+
name: archive
123+
path: archive/
124+
125+
- uses: actions/setup-python@v5
126+
with:
127+
python-version: "3.x" # use the latest stable version of Python
128+
129+
- name: Display Python version
130+
run: python -c "import sys; print(sys.version)"
131+
132+
- name: Update pip
133+
run: python -m pip install --upgrade pip
134+
135+
- name: Install wheel
136+
if: matrix.package == 'wheel'
137+
run: python -m pip install dist/*.whl
138+
139+
- name: Install sdist
140+
if: matrix.package == 'sdist'
141+
run: python -m pip install dist/*.tar.gz
142+
143+
- name: Install archive
144+
if: matrix.package == 'archive'
145+
run: python -m pip install archive/archive.tgz
146+
147+
- name: Check installed package
148+
run: python -c "import ndx_franklab_novela"
149+
150+
- name: Checkout repo to access tests
151+
uses: actions/checkout@v4
100152

101-
- name: Run tests in the virtual environment
153+
- name: Install pytest and run tests
102154
run: |
103155
python -m pip install pytest
104156
pytest -v

0 commit comments

Comments
 (0)