|
1 | | -on: [push, pull_request] |
2 | 1 | name: release-please |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +permissions: |
| 5 | + contents: write |
| 6 | + pull-requests: write |
| 7 | + |
3 | 8 | jobs: |
4 | 9 | linting: |
5 | 10 | name: Linting |
@@ -28,138 +33,225 @@ jobs: |
28 | 33 | with: |
29 | 34 | commit_message: "style: style fixes by ruff and autoformatting by black" |
30 | 35 |
|
31 | | - continuous-integration: |
32 | | - name: Continuous integration ${{ matrix.os }} python ${{ matrix.python-version }} |
| 36 | + pip-build-sdist: |
| 37 | + name: Build SDist |
| 38 | + runs-on: ubuntu-latest |
| 39 | + steps: |
| 40 | + - uses: actions/checkout@v4 |
| 41 | + |
| 42 | + - name: Build SDist |
| 43 | + run: | |
| 44 | + pip install build |
| 45 | + python -m build |
| 46 | +
|
| 47 | + - uses: actions/upload-artifact@v4 |
| 48 | + with: |
| 49 | + name: loopprojectfile-dist |
| 50 | + path: dist/*.tar.gz |
| 51 | + compression-level: 0 |
| 52 | + |
| 53 | + pip-test-sdist: |
| 54 | + name: Test sdist |
| 55 | + needs: pip-build-sdist |
| 56 | + runs-on: ubuntu-latest |
| 57 | + steps: |
| 58 | + - name: Download sdist from artifacts |
| 59 | + uses: actions/download-artifact@v4 |
| 60 | + with: |
| 61 | + name: loopprojectfile-dist |
| 62 | + path: dist |
| 63 | + |
| 64 | + - name: Build LPF from sdist and install test dependencies |
| 65 | + shell: bash |
| 66 | + run: | |
| 67 | + python -m pip install --upgrade pip |
| 68 | + pip install --no-cache dist/*.tar.gz |
| 69 | + pip install netCDF4>=1.5.4 numpy pandas pytest |
| 70 | + pip list |
| 71 | + |
| 72 | + pip-build-wheels: |
| 73 | + needs: pip-test-sdist |
| 74 | + name: Build Wheels |
33 | 75 | runs-on: ${{ matrix.os }} |
34 | 76 | strategy: |
35 | 77 | fail-fast: false |
36 | 78 | matrix: |
37 | | - os: ${{ fromJSON(vars.BUILD_OS)}} |
38 | | - python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}} |
| 79 | + os: |
| 80 | + - ubuntu-latest |
| 81 | + |
39 | 82 | steps: |
40 | 83 | - uses: actions/checkout@v4 |
41 | | - - uses: conda-incubator/setup-miniconda@v3 |
42 | 84 |
|
43 | | - with: |
44 | | - python-version: ${{ matrix.python-version }} |
45 | | - - name: Installing dependencies |
46 | | - shell: bash -l {0} |
47 | | - run: | |
48 | | - conda install -c conda-forge -c loop3d --file requirements.txt -y |
49 | | - - name: Building and install |
50 | | - shell: bash -l {0} |
| 85 | + - name: Build Wheels |
51 | 86 | run: | |
52 | | - pip install . --user |
53 | | - # - name: Test verification |
54 | | - # shell: bash -l {0} |
55 | | - # run: | |
56 | | - # pytest |
| 87 | + python -m pip install --upgrade pip |
| 88 | + pip install netCDF4>=1.5.4 --only-binary :all: |
| 89 | + pip install build numpy pandas pytest |
| 90 | + python -m build --wheel |
57 | 91 |
|
58 | | - release-please: |
59 | | - runs-on: ubuntu-latest |
60 | | - if: github.ref == 'refs/heads/master' |
61 | | - steps: |
62 | | - - uses: actions/checkout@v4 |
63 | | - with: |
64 | | - fetch-depth: 0 # Fetch all history for all tags and branches |
65 | | - - uses: GoogleCloudPlatform/release-please-action@v4 |
66 | | - id: release |
| 92 | + - uses: actions/upload-artifact@v4 |
67 | 93 | with: |
68 | | - release-type: python |
69 | | - package-name: LoopProjectFile |
70 | | - version-file: LoopProjectFile/version.py |
71 | | - outputs: |
72 | | - release_created: ${{ steps.release.outputs.release_created }} |
73 | | - # if a release is created then run the deploy scripts for github.io, conda, pypi and docker |
74 | | - |
75 | | - conda-deploy: |
76 | | - name: Building conda package for python ${{ matrix.os }}) |
77 | | - needs: "continuous-integration" |
78 | | - runs-on: ${{matrix.os}} |
| 94 | + name: loopprojectfile-wheels-${{ matrix.os }} |
| 95 | + path: dist/*.whl |
| 96 | + compression-level: 0 |
| 97 | + |
| 98 | + pip-test-wheels: |
| 99 | + name: Test wheels on ${{ matrix.os }} (Python ${{ matrix.python-version }}) |
| 100 | + needs: pip-build-wheels |
| 101 | + runs-on: ${{ matrix.os }} |
79 | 102 | strategy: |
80 | 103 | fail-fast: false |
81 | 104 | matrix: |
82 | | - os: ["ubuntu-latest"] |
83 | | - python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}} |
| 105 | + os: |
| 106 | + - ubuntu-latest |
| 107 | + python-version: ["3.9", "3.10", "3.11", "3.12"] |
| 108 | + include: |
| 109 | + - os: "ubuntu-latest" |
| 110 | + artifact: loopprojectfile-wheels-ubuntu-latest |
84 | 111 | steps: |
85 | | - - uses: conda-incubator/setup-miniconda@v3 |
| 112 | + - name: Checkout |
| 113 | + uses: actions/checkout@v4 |
| 114 | + |
| 115 | + - name: Set up Python |
| 116 | + uses: actions/setup-python@v5 |
86 | 117 | with: |
87 | | - auto-update-conda: true |
88 | 118 | python-version: ${{ matrix.python-version }} |
| 119 | + allow-prereleases: true |
| 120 | + |
| 121 | + - name: Upgrade pip |
| 122 | + run: | |
| 123 | + python -m pip install --upgrade pip |
| 124 | +
|
| 125 | + - name: Download wheels from artifacts |
| 126 | + uses: actions/download-artifact@v4 |
| 127 | + with: |
| 128 | + name: ${{ matrix.artifact }} |
| 129 | + path: dist |
| 130 | + |
| 131 | + - name: Install dependencies and LoopProjectFile wheel |
| 132 | + shell: bash |
| 133 | + run: | |
| 134 | + pip install --upgrade pip |
| 135 | + pip install netCDF4>=1.5.4 --only-binary :all: |
| 136 | + pip install numpy pandas pytest |
| 137 | + pip install --no-cache --pre --no-index --find-links dist loopprojectfile |
| 138 | + pip list |
89 | 139 |
|
| 140 | + conda-build: |
| 141 | + name: Conda Build-Deploy ${{ matrix.os }} - Python Version-${{ matrix.python-version }} |
| 142 | + runs-on: ${{ matrix.os }} |
| 143 | + strategy: |
| 144 | + fail-fast: false |
| 145 | + matrix: |
| 146 | + os: |
| 147 | + - ubuntu-latest |
| 148 | + - macos-latest |
| 149 | + - windows-latest |
| 150 | + python-version: ["3.9", "3.10", "3.11", "3.12"] |
| 151 | + |
| 152 | + steps: |
90 | 153 | - uses: actions/checkout@v4 |
| 154 | + |
| 155 | + - name: Setup Miniforge |
| 156 | + uses: conda-incubator/setup-miniconda@v3 |
| 157 | + with: |
| 158 | + miniforge-version: latest |
| 159 | + activate-environment: anaconda-client-env |
| 160 | + use-only-tar-bz2: true |
| 161 | + |
| 162 | + # need to add cygwin action to remove cygpath warnings |
| 163 | + |
| 164 | + - name: Installing Dependencies |
| 165 | + shell: bash -l {0} |
| 166 | + run: | |
| 167 | + conda install -c conda-forge conda-build anaconda-client conda-verify -y |
| 168 | + conda install -c conda-forge -c loop3d --file requirements.txt -y |
| 169 | +
|
| 170 | + - name: Building and install |
| 171 | + shell: bash -l {0} |
| 172 | + run: | |
| 173 | + pip install . --user |
| 174 | + |
91 | 175 | - name: update submodules |
92 | | - # shell: bash -l {0} |
| 176 | + shell: bash |
93 | 177 | run: | |
94 | | - git submodule update --init --recursive |
95 | | - - name: Conda build |
| 178 | + git submodule update --init --recursive |
| 179 | + |
| 180 | + - name: Conda Build |
96 | 181 | env: |
97 | 182 | ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} |
| 183 | + path: ~/conda_pkgs_dir |
98 | 184 | shell: bash -l {0} |
99 | 185 | run: | |
100 | | - conda install --solver=classic -c conda-forge conda-build anaconda-client conda-libmamba-solver -y |
101 | | - conda build -c anaconda -c conda-forge -c loop3d --output-folder conda conda --python ${{ matrix.python-version }} |
102 | | - conda convert -p all conda/linux-64/*.tar.bz2 -f -o conda |
103 | | - conda install anaconda-client -y |
| 186 | + conda build -c anaconda -c conda-forge -c loop3d --output-folder conda conda --python ${{ matrix.python-version }} |
| 187 | + |
104 | 188 | - name: upload artifacts |
105 | 189 | uses: actions/upload-artifact@v4 |
106 | 190 | with: |
107 | | - name: conda-${{ matrix.os }}-${{ matrix.python-version }} |
| 191 | + name: loopprojectfile-conda-${{ matrix.os }}-${{ matrix.python-version }} |
108 | 192 | path: conda |
109 | 193 |
|
110 | | - make_sdist: |
111 | | - needs: "continuous-integration" |
112 | | - name: Make SDist |
| 194 | + release-please: |
| 195 | + needs: [pip-test-wheels, conda-build] |
113 | 196 | runs-on: ubuntu-latest |
| 197 | + if: github.ref == 'refs/heads/master' |
114 | 198 | steps: |
115 | 199 | - uses: actions/checkout@v4 |
116 | | - |
117 | | - - name: Build SDist |
118 | | - run: | |
119 | | - pip install build |
120 | | - python -m build |
121 | | -
|
122 | | - - uses: actions/upload-artifact@v4 |
| 200 | + - uses: googleapis/release-please-action@v4 |
| 201 | + id: release |
123 | 202 | with: |
124 | | - name: dist |
125 | | - path: dist/ |
| 203 | + config-file: 'release-please-config.json' |
| 204 | + manifest-file: '.release-please-manifest.json' |
| 205 | + outputs: |
| 206 | + release_created: ${{ steps.release.outputs.release_created }} |
| 207 | +#if a release is created then run the deploy scripts for github.io, conda, pypi and docker |
126 | 208 |
|
127 | | - upload_to_conda: |
128 | | - needs: ["release-please", "conda-deploy"] |
| 209 | + conda-upload: |
| 210 | + needs: [release-please, conda-build] |
129 | 211 | runs-on: ${{matrix.os}} |
130 | 212 | strategy: |
131 | 213 | fail-fast: false |
132 | 214 | matrix: |
133 | | - os: ["ubuntu-latest"] |
134 | | - python-version: ${{ fromJSON(vars.PYTHON_VERSIONS)}} |
| 215 | + os: |
| 216 | + - ubuntu-latest |
| 217 | + - macos-latest |
| 218 | + - windows-latest |
| 219 | + python-version: ["3.9", "3.10", "3.11", "3.12"] |
135 | 220 | if: ${{ needs.release-please.outputs.release_created }} |
136 | 221 | steps: |
137 | 222 | - uses: actions/download-artifact@v4 |
138 | 223 | with: |
139 | | - name: conda-${{ matrix.os }}-${{ matrix.python-version }} |
| 224 | + name: loopprojectfile-conda-${{ matrix.os }}-${{ matrix.python-version }} |
140 | 225 | path: conda |
141 | 226 | - uses: conda-incubator/setup-miniconda@v3 |
142 | 227 | - name: upload all files to conda-forge |
143 | 228 | shell: bash -l {0} |
144 | 229 | env: |
145 | 230 | ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_TOKEN }} |
| 231 | + with: |
| 232 | + skip-existing: true |
| 233 | + verbose: true |
146 | 234 | run: | |
147 | 235 | conda install -c anaconda anaconda-client -y |
148 | 236 | anaconda upload --label main conda/*/*.tar.bz2 |
149 | | -
|
150 | | - upload_to_pypi: |
151 | | - runs-on: "ubuntu-latest" |
152 | | - needs: ["release-please", "conda-deploy"] |
153 | | - if: ${{ needs.release-please.outputs.release_created }} |
154 | | - permissions: |
155 | | - # IMPORTANT: this permission is mandatory for trusted publishing |
156 | | - id-token: write |
157 | | - steps: |
158 | | - - uses: actions/download-artifact@v4 |
159 | | - with: |
160 | | - name: dist |
161 | | - path: dist |
162 | | - - uses: pypa/gh-action-pypi-publish@release/v1 |
163 | | - with: |
164 | | - skip-existing: true |
165 | | - verbose: true |
| 237 | + |
| 238 | + pypi-upload: |
| 239 | + needs: [release-please, pip-test-wheels] |
| 240 | + runs-on: |
| 241 | + - ubuntu-latest |
| 242 | + - macos-latest |
| 243 | + - windows-latest |
| 244 | + |
| 245 | + if: ${{ needs.release-please.outputs.release_created }} |
| 246 | + permissions: |
| 247 | + # IMPORTANT: this permission is mandatory for trusted publishing |
| 248 | + id-token: write |
| 249 | + steps: |
| 250 | + - uses: actions/download-artifact@v4 |
| 251 | + with: |
| 252 | + name: loopprojectfile-dist |
| 253 | + path: dist/ |
| 254 | + - uses: pypa/gh-action-pypi-publish@release/v1 |
| 255 | + with: |
| 256 | + skip-existing: true |
| 257 | + verbose: true |
0 commit comments