-
Notifications
You must be signed in to change notification settings - Fork 0
148 lines (128 loc) · 4.15 KB
/
release-kb-bert.yml
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
name: release
on:
push:
branches:
- main
tags:
- "word-prediction-kb-bert-v[0-9]+.[0-9]+.[0-9]+"
pull_request:
merge_group:
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions:
contents: read
env:
MINIMUM_PYTHON_VERSION: "3.9"
UV_VERSION: "0.5.1"
jobs:
build:
# This action builds distribution files for upload to PyPI
name: ubuntu / 3.9 / build
runs-on: ubuntu-latest
steps:
#----------------------------------------------
# check-out repo and set-up python
#----------------------------------------------
- name: Check out repository
uses: actions/checkout@v4
with:
submodules: true
#----------------------------------------------
# ----- setup python -----
#----------------------------------------------
- name: Set up the environment
uses: actions/setup-python@v5
id: setup-python
with:
python-version: ${{ env.MINIMUM_PYTHON_VERSION }}
#----------------------------------------------
# ----- setup uv and load cache -----
#----------------------------------------------
- name: Set up uv
uses: astral-sh/setup-uv@v3
with:
version: ${{ env.UV_VERSION }}
enable-cache: true
#----------------------------------------------
# ----- build distribution -----
#----------------------------------------------
- name: Build distribution
run: cd word-prediction-kb-bert && make build
#----------------------------------------------
# ----- upload artifacts -----
#----------------------------------------------
- uses: actions/upload-artifact@v4
with:
name: pypi_files
path: dist
test-build:
# This action runs the test suite on the built artifact in the `build` action.
# The default is to run this in ubuntu, macos and windows
name: ${{ matrix.os }} / 3.9 / test built artifact
needs: [build]
strategy:
fail-fast: false
matrix:
os:
- ubuntu
- macos
- windows
runs-on: ${{ matrix.os }}-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: set up python
uses: actions/setup-python@v5
with:
python-version: ${{ env.MINIMUM_PYTHON_VERSION }}
- name: get dist artifacts
uses: actions/download-artifact@v4
with:
name: pypi_files
path: dist
- run: rm -r word-prediction-kb-bert/src
- run: pip install typing-extensions
- run: pip install -r word-prediction-kb-bert/tests/requirements-testing.lock
- run: pip install sparv-sbx-word-prediction-kb-bert --no-index --no-deps --find-links dist --force-reinstall
- run: pytest word-prediction-kb-bert/tests
# https://github.com/marketplace/actions/alls-green#why used for branch protection checks
release-check:
if: always()
needs:
- build
- test-build
runs-on: ubuntu-latest
permissions: {}
steps:
- name: Decide whether the needed jobs succeeded or failed
uses: re-actors/alls-green@release/v1
with:
jobs: ${{ toJSON(needs) }}
# allowed-failures: coverage
publish:
# This action publishes the built and tested artifact to PyPI, but only on a tag
needs:
- test-build
if: success() && startsWith(github.ref, 'refs/tags/v')
runs-on: ubuntu-latest
environment: release
permissions:
# IMPORTANT: this permission is mandatory for trusted publishing
id-token: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Set up Python ${{ env.MINIMUM_PYTHON_VERSION }}
uses: actions/setup-python@v5
with:
python-version: ${{ env.MINIMUM_PYTHON_VERSION }}
- name: get dist artifacts
uses: actions/download-artifact@v4
with:
name: pypi_files
path: dist
- name: Publish package to PyPI
uses: pypa/gh-action-pypi-publish@release/v1