|
1 | 1 | name: build |
2 | 2 |
|
3 | 3 | on: |
4 | | - push: |
5 | | - tags: |
6 | | - - v* |
7 | | - branches: |
8 | | - - main |
| 4 | + push: |
| 5 | + tags: |
| 6 | + - v* |
| 7 | + branches: |
| 8 | + - main |
9 | 9 |
|
10 | 10 | permissions: |
11 | | - contents: write |
12 | | - id-token: write |
| 11 | + contents: write |
| 12 | + id-token: write |
13 | 13 |
|
14 | 14 | concurrency: |
15 | | - group: ${{ github.workflow }}-${{ github.sha }} |
16 | | - cancel-in-progress: true |
| 15 | + group: ${{ github.workflow }}-${{ github.sha }} |
| 16 | + cancel-in-progress: true |
17 | 17 |
|
18 | 18 | defaults: |
19 | | - run: |
20 | | - shell: bash |
| 19 | + run: |
| 20 | + shell: bash |
21 | 21 |
|
22 | 22 | jobs: |
23 | | - validate: |
24 | | - name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} |
25 | | - runs-on: ${{ matrix.os }} |
26 | | - strategy: |
27 | | - fail-fast: false |
28 | | - matrix: |
29 | | - os: [ubuntu-latest, windows-latest, macos-latest] |
30 | | - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
31 | | - |
32 | | - steps: |
33 | | - - uses: actions/checkout@v4 |
34 | | - |
35 | | - - name: Install llvm |
36 | | - if: startsWith(matrix.os, 'macos') |
37 | | - run: | |
38 | | - brew remove --ignore-dependencies python |
39 | | - rm -rf /usr/local/bin/2to3* |
40 | | - rm -rf /usr/local/bin/idle3* |
41 | | - rm -rf /usr/local/bin/pydoc3* |
42 | | - rm -rf /usr/local/bin/python* |
43 | | - brew cleanup |
44 | | - brew update -f |
45 | | - brew install libomp llvm |
46 | | - echo " |
47 | | - export PATH=\"$(brew --prefix)/opt/llvm/bin:\$PATH\" |
48 | | - export DYLD_LIBRARY_PATH=\"$(brew --prefix)/lib:$DYLD_LIBRARY_PATH\" |
49 | | - export LDFLAGS=\"-L$(brew --prefix)/opt/llvm/lib\" |
50 | | - export CPPFLAGS=\"-I$(brew --prefix)/opt/llvm/include\" |
51 | | - export LD=ld.lld |
52 | | - export AR=llvm-ar |
53 | | - export RANLIB=llvm-ranlib |
54 | | -
|
55 | | - " >> $HOME/.bash_profile |
56 | | -
|
57 | | - - uses: actions/setup-go@v5 |
58 | | - with: |
59 | | - go-version: stable |
60 | | - |
61 | | - - name: Install Task |
62 | | - run: | |
63 | | - go install github.com/go-task/task/v3/cmd/task@latest |
64 | | -
|
65 | | - - uses: hecrj/setup-rust-action@v2 |
66 | | - with: |
67 | | - rust-version: stable |
68 | | - |
69 | | - - uses: cargo-bins/cargo-binstall@main |
70 | | - |
71 | | - - name: Install jaq |
72 | | - run: | |
73 | | - cargo binstall -y jaq |
74 | | -
|
75 | | - - name: Set up Python ${{ matrix.python-version }} |
76 | | - uses: actions/setup-python@v5 |
77 | | - with: |
78 | | - python-version: ${{ matrix.python-version }} |
79 | | - |
80 | | - - name: Install Hatch |
81 | | - run: | |
82 | | - pip install --upgrade pip |
83 | | - pip install --upgrade hatch |
84 | | -
|
85 | | - - name: Run tests |
86 | | - run: hatch run cov |
87 | | - |
88 | | - - name: Test src lib compilation |
89 | | - shell: bash |
90 | | - run: | |
91 | | - task example |
92 | | -
|
93 | | - - name: Test simple lib compilation |
94 | | - shell: bash |
95 | | - run: | |
96 | | - task simple-structure |
97 | | -
|
98 | | - - name: Test build target directives |
99 | | - shell: bash |
100 | | - run: | |
101 | | - task only-included |
102 | | -
|
103 | | - sdist: |
104 | | - needs: [validate] |
105 | | - runs-on: ubuntu-latest |
106 | | - steps: |
107 | | - - uses: actions/checkout@v4 |
108 | | - - name: Set up Python |
109 | | - uses: actions/setup-python@v5 |
110 | | - - name: Install dependencies |
111 | | - run: | |
112 | | - python -m pip install --upgrade pip |
113 | | - pip install hatch |
114 | | - - name: Build package |
115 | | - run: hatch build -t sdist |
116 | | - - name: Upload sdist |
117 | | - uses: actions/upload-artifact@v4 |
118 | | - with: |
119 | | - name: hatch-cython-sdist |
120 | | - path: ./dist/ |
121 | | - |
122 | | - wheel: |
123 | | - needs: [validate] |
124 | | - runs-on: ${{ matrix.os }} |
125 | | - strategy: |
126 | | - matrix: |
127 | | - python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
128 | | - os: [ubuntu-latest, windows-latest, macos-latest] |
129 | | - steps: |
130 | | - - uses: actions/checkout@v4 |
131 | | - - name: Set up Python ${{ matrix.python-version }} |
132 | | - uses: actions/setup-python@v5 |
133 | | - with: |
134 | | - python-version: ${{ matrix.python-version }} |
135 | | - - name: Install dependencies |
136 | | - run: | |
137 | | - python -m pip install --upgrade pip |
138 | | - pip install hatch |
139 | | - - name: Build package |
140 | | - run: hatch build -t wheel |
141 | | - - name: Upload wheel |
142 | | - uses: actions/upload-artifact@v4 |
143 | | - with: |
144 | | - name: wheel-${{ matrix.python-version }}-${{ matrix.os }} |
145 | | - path: ./dist/ |
146 | | - |
147 | | - release: |
148 | | - needs: [sdist, wheel] |
149 | | - runs-on: ubuntu-latest |
150 | | - if: startsWith(github.ref, 'refs/tags/') |
151 | | - environment: |
152 | | - name: pypi |
153 | | - url: https://pypi.org/p/hatch-cython |
154 | | - steps: |
155 | | - - name: Download all workflow run artifacts |
156 | | - uses: actions/download-artifact@v4 |
157 | | - with: |
158 | | - path: dist/ |
159 | | - merge-multiple: true |
160 | | - - name: Display downloaded files |
161 | | - run: ls -R ./dist |
162 | | - - name: Release |
163 | | - uses: softprops/action-gh-release@v2 |
164 | | - with: |
165 | | - generate_release_notes: true |
166 | | - fail_on_unmatched_files: true |
167 | | - prerelease: ${{ contains(github.ref, 'rc') }} |
168 | | - files: |- |
169 | | - dist/* |
170 | | - - name: Publish package |
171 | | - uses: pypa/gh-action-pypi-publish@release/v1 |
| 23 | + validate: |
| 24 | + name: Python ${{ matrix.python-version }} on ${{ startsWith(matrix.os, 'macos-') && 'macOS' || startsWith(matrix.os, 'windows-') && 'Windows' || 'Linux' }} |
| 25 | + runs-on: ${{ matrix.os }} |
| 26 | + strategy: |
| 27 | + fail-fast: false |
| 28 | + matrix: |
| 29 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 30 | + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12'] |
| 31 | + |
| 32 | + steps: |
| 33 | + - uses: actions/checkout@v4 |
| 34 | + |
| 35 | + - name: Install llvm |
| 36 | + if: startsWith(matrix.os, 'macos') |
| 37 | + run: | |
| 38 | + brew remove --ignore-dependencies python |
| 39 | + rm -rf /usr/local/bin/2to3* |
| 40 | + rm -rf /usr/local/bin/idle3* |
| 41 | + rm -rf /usr/local/bin/pydoc3* |
| 42 | + rm -rf /usr/local/bin/python* |
| 43 | + brew cleanup |
| 44 | + brew update -f |
| 45 | + brew install libomp llvm |
| 46 | + echo " |
| 47 | + export PATH=\"$(brew --prefix)/opt/llvm/bin:\$PATH\" |
| 48 | + export DYLD_LIBRARY_PATH=\"$(brew --prefix)/lib:$DYLD_LIBRARY_PATH\" |
| 49 | + export LDFLAGS=\"-L$(brew --prefix)/opt/llvm/lib\" |
| 50 | + export CPPFLAGS=\"-I$(brew --prefix)/opt/llvm/include\" |
| 51 | + export LD=ld.lld |
| 52 | + export AR=llvm-ar |
| 53 | + export RANLIB=llvm-ranlib |
| 54 | +
|
| 55 | + " >> $HOME/.bash_profile |
| 56 | +
|
| 57 | + - uses: actions/setup-go@v5 |
| 58 | + with: |
| 59 | + go-version: stable |
| 60 | + |
| 61 | + - name: Install Task |
| 62 | + run: | |
| 63 | + go install github.com/go-task/task/v3/cmd/task@latest |
| 64 | +
|
| 65 | + - uses: hecrj/setup-rust-action@v2 |
| 66 | + with: |
| 67 | + rust-version: stable |
| 68 | + |
| 69 | + - uses: cargo-bins/cargo-binstall@main |
| 70 | + |
| 71 | + - name: Install jaq |
| 72 | + run: | |
| 73 | + cargo binstall -y jaq |
| 74 | +
|
| 75 | + - name: Set up Python ${{ matrix.python-version }} |
| 76 | + uses: actions/setup-python@v5 |
| 77 | + with: |
| 78 | + python-version: ${{ matrix.python-version }} |
| 79 | + |
| 80 | + - name: Install Hatch |
| 81 | + run: | |
| 82 | + pip install --upgrade pip |
| 83 | + pip install --upgrade hatch |
| 84 | +
|
| 85 | + - name: Run tests |
| 86 | + run: hatch run cov |
| 87 | + |
| 88 | + - name: Test src lib compilation |
| 89 | + shell: bash |
| 90 | + run: | |
| 91 | + task example |
| 92 | +
|
| 93 | + - name: Test simple lib compilation |
| 94 | + shell: bash |
| 95 | + run: | |
| 96 | + task simple-structure |
| 97 | +
|
| 98 | + - name: Test build target directives |
| 99 | + shell: bash |
| 100 | + run: | |
| 101 | + task only-included |
| 102 | +
|
| 103 | + sdist: |
| 104 | + needs: [validate] |
| 105 | + runs-on: ubuntu-latest |
| 106 | + steps: |
| 107 | + - uses: actions/checkout@v4 |
| 108 | + - name: Set up Python |
| 109 | + uses: actions/setup-python@v5 |
| 110 | + - name: Install dependencies |
| 111 | + run: | |
| 112 | + python -m pip install --upgrade pip |
| 113 | + pip install hatch |
| 114 | + - name: Build package |
| 115 | + run: hatch build -t sdist |
| 116 | + - name: Upload sdist |
| 117 | + uses: actions/upload-artifact@v7 |
| 118 | + with: |
| 119 | + name: hatch-cython-sdist |
| 120 | + path: ./dist/ |
| 121 | + |
| 122 | + wheel: |
| 123 | + needs: [validate] |
| 124 | + runs-on: ${{ matrix.os }} |
| 125 | + strategy: |
| 126 | + matrix: |
| 127 | + python-version: ['3.8', '3.9', '3.10', '3.11', '3.12', '3.13'] |
| 128 | + os: [ubuntu-latest, windows-latest, macos-latest] |
| 129 | + steps: |
| 130 | + - uses: actions/checkout@v4 |
| 131 | + - name: Set up Python ${{ matrix.python-version }} |
| 132 | + uses: actions/setup-python@v5 |
| 133 | + with: |
| 134 | + python-version: ${{ matrix.python-version }} |
| 135 | + - name: Install dependencies |
| 136 | + run: | |
| 137 | + python -m pip install --upgrade pip |
| 138 | + pip install hatch |
| 139 | + - name: Build package |
| 140 | + run: hatch build -t wheel |
| 141 | + - name: Upload wheel |
| 142 | + uses: actions/upload-artifact@v7 |
| 143 | + with: |
| 144 | + name: wheel-${{ matrix.python-version }}-${{ matrix.os }} |
| 145 | + path: ./dist/ |
| 146 | + |
| 147 | + release: |
| 148 | + needs: [sdist, wheel] |
| 149 | + runs-on: ubuntu-latest |
| 150 | + if: startsWith(github.ref, 'refs/tags/') |
| 151 | + environment: |
| 152 | + name: pypi |
| 153 | + url: https://pypi.org/p/hatch-cython |
| 154 | + steps: |
| 155 | + - name: Download all workflow run artifacts |
| 156 | + uses: actions/download-artifact@v7 |
| 157 | + with: |
| 158 | + path: dist/ |
| 159 | + merge-multiple: true |
| 160 | + - name: Display downloaded files |
| 161 | + run: ls -R ./dist |
| 162 | + - name: Release |
| 163 | + uses: softprops/action-gh-release@v2 |
| 164 | + with: |
| 165 | + generate_release_notes: true |
| 166 | + fail_on_unmatched_files: true |
| 167 | + prerelease: ${{ contains(github.ref, 'rc') }} |
| 168 | + files: |- |
| 169 | + dist/* |
| 170 | + - name: Publish package |
| 171 | + uses: pypa/gh-action-pypi-publish@release/v1 |
0 commit comments