-
Notifications
You must be signed in to change notification settings - Fork 45
160 lines (137 loc) · 4.86 KB
/
release.yml
File metadata and controls
160 lines (137 loc) · 4.86 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
# This workflow will install Python dependencies, run tests and lint with a variety of Python versions
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python
# TODO: In the future we ought to perform linting and code coverage checks
name: Release
on:
workflow_dispatch:
jobs:
test:
name: Tests
timeout-minutes: 120
runs-on: ${{ matrix.operating-system }}
strategy:
fail-fast: true
matrix:
# Python 3.9->3.11 on Ubuntu, Windows and MacOS
operating-system: [ubuntu-latest, windows-latest, macos-latest]
python-version: ['3.10', '3.11', '3.12']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
cache: "pip" # caching pip dependencies
- name: CPU PyTorch (Windows/MacOS)
if: matrix.operating-system == 'windows-latest' || matrix.operating-system == 'macos-latest'
run: python -m pip install torch torchvision
- name: CPU PyTorch (Linux)
if: matrix.operating-system == 'ubuntu-latest'
run: python -m pip install torch torchvision --index-url https://download.pytorch.org/whl/cpu
- name: Install dependencies
run: python -m pip install ".[dev]"
- name: PyTest
run: python -m invoke test.pytest
- name: Doctest
run: python -m invoke test.doctest
- name: Notebooks
run: python -m invoke test.nb
documentation:
name: Documentation
timeout-minutes: 10
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.11
cache: 'pip' # caching pip dependencies
- name: Install Dependencies
run: |
sudo apt-get install -y pandoc
python -m pip install torch~=2.9.1 torchvision~=0.24.1 --index-url https://download.pytorch.org/whl/cpu
python -m pip install -U ".[dev,doc]"
- name: Build Documentation
run: python -m invoke docs.build
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: docs/_build
release_pypi:
name: Release / PyPi
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
concurrency: release
needs: [test, documentation]
permissions:
id-token: write
contents: write
outputs:
released: ${{ steps.release.outputs.released }}
tag: ${{ steps.release.outputs.tag }}
steps:
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: 3.12
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install Hatch
run: python3 -m pip install hatch~=1.9.7
- name: Python Semantic Release
id: release
uses: python-semantic-release/python-semantic-release@v10.4.1
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
- name: Build Package
if: steps.release.outputs.released == 'true'
run: python3 -m hatch build
- name: Publish package distributions to PyPI
uses: pypa/gh-action-pypi-publish@release/v1
if: steps.release.outputs.released == 'true'
- name: Publish package distributions to GitHub Releases
uses: python-semantic-release/upload-to-gh-release@0f96c02a48278aff14251e9f1a0d73122a8c638b
if: steps.release.outputs.released == 'true'
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
release_docker:
name: Release / Docker
environment: release
runs-on: ubuntu-latest
needs: [release_pypi]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64,linux/arm64
file: docker/dockerfile
tags: >-
${{ secrets.DOCKERHUB_USERNAME }}/jupyter-capymoa:${{ needs.release_pypi.outputs.tag }},
${{ secrets.DOCKERHUB_USERNAME }}/jupyter-capymoa:latest
build-args: CAPYMOA_VERSION=${{ needs.release_pypi.outputs.tag }}
website:
name: Website
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
permissions:
pages: write
id-token: write
runs-on: ubuntu-latest
needs: [release_pypi, documentation]
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4