-
Notifications
You must be signed in to change notification settings - Fork 383
66 lines (52 loc) · 1.9 KB
/
build-wheel.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
name: Build and Test Python Wheel
on:
push:
branches: ["feature/poetry"]
pull_request:
branches: ["feature/poetry"]
env:
POETRY_VERSION: "1.8.2"
PYTHON_VERSION: "3.11"
RUNNER_OS: "ubuntu-latest"
jobs:
build-wheel:
runs-on: ${{ env.RUNNER_OS }}
steps:
- uses: actions/checkout@v4
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: ${{ env.PYTHON_VERSION }}
- name: Extract Version Tag
id: get_version
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
- name: Get full Python version
id: full-python-version
run: echo "version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")" >> $GITHUB_OUTPUT
- name: Bootstrap poetry
run: |
curl -sSL https://install.python-poetry.org | POETRY_VERSION=${{ env.POETRY_VERSION }} python -
- name: Update PATH (Linux and macOS)
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Configure poetry
run: poetry config virtualenvs.in-project true
- name: Set up cache
uses: actions/cache@v3
id: cache
with:
path: .venv
key: venv-${{ env.RUNNER_OS }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
- name: Ensure cache is healthy
if: steps.cache.outputs.cache-hit == 'true'
run: timeout 10s poetry run pip --version || rm -rf .venv
- name: Make build script executable
run: chmod +x ./.github/scripts/build.sh
- name: Build Wheel
run: |
./.github/scripts/build.sh
echo "WHEEL_FILE=$(ls dist/*.whl)" >> $GITHUB_ENV
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: nemoguardrails-${{ env.VERSION }}.whl
path: dist/nemoguardrails-${{ env.VERSION }}-py3-none-any.whl