|
12 | 12 | run-all-tests: |
13 | 13 | name: ${{ matrix.name }} |
14 | 14 | runs-on: ${{ matrix.os }} |
15 | | - defaults: |
16 | | - run: |
17 | | - shell: bash |
18 | 15 | concurrency: |
19 | 16 | group: ${{ github.workflow }}-${{ github.ref }}-${{ matrix.name }} |
20 | 17 | cancel-in-progress: true |
@@ -72,33 +69,88 @@ jobs: |
72 | 69 | run: | |
73 | 70 | pytest -v |
74 | 71 |
|
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 |
76 | 84 | run: | |
77 | | - python -m pip install --upgrade build |
| 85 | + python -m pip install --upgrade build twine |
78 | 86 | python -m build |
79 | | - ls -1 dist |
| 87 | + twine check dist/* |
80 | 88 |
|
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/ |
84 | 94 |
|
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 |
89 | 97 |
|
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/ |
94 | 103 |
|
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 |
100 | 152 |
|
101 | | - - name: Run tests in the virtual environment |
| 153 | + - name: Install pytest and run tests |
102 | 154 | run: | |
103 | 155 | python -m pip install pytest |
104 | 156 | pytest -v |
0 commit comments