Skip to content

Commit 5c3c504

Browse files
committed
update workflows
1 parent afb7759 commit 5c3c504

File tree

5 files changed

+41
-16
lines changed

5 files changed

+41
-16
lines changed

.github/workflows/_test.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -60,10 +60,10 @@ jobs:
6060
run: timeout 10s poetry run pip --version || rm -rf .venv
6161

6262
- name: Install dependencies
63-
run: poetry install --with github-actions
63+
run: poetry install --with dev
6464

65-
- name: Run mypy
66-
run: poetry run mypy
65+
- name: Run pre commit hooks
66+
run: poetry run make pre_commit
6767

6868
- name: Run pytest
6969
run: poetry run pytest -v

.github/workflows/build-wheel.yml

Lines changed: 27 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ on:
88
env:
99
POETRY_VERSION: "1.8.2"
1010
PYTHON_VERSION: "3.11"
11+
RUNNER_OS: "ubuntu-latest"
1112

1213
jobs:
1314
build-wheel:
14-
runs-on: ubuntu-latest
15+
runs-on: ${{ env.RUNNER_OS }}
1516
steps:
1617
- uses: actions/checkout@v4
1718

@@ -24,10 +25,32 @@ jobs:
2425
id: get_version
2526
run: echo "VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV
2627

27-
- name: Install Poetry ${{ env.POETRY_VERSION }}
28-
uses: abatilo/actions-poetry@v2
28+
- name: Get full Python version
29+
id: full-python-version
30+
run: echo "version=$(python -c "import sys; print('-'.join(str(v) for v in sys.version_info))")" >> $GITHUB_OUTPUT
2931

30-
- name: Set execute permissions for build script
32+
- name: Bootstrap poetry
33+
run: |
34+
curl -sSL https://install.python-poetry.org | POETRY_VERSION=${{ env.POETRY_VERSION }} python -
35+
36+
- name: Update PATH (Linux and macOS)
37+
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
38+
39+
- name: Configure poetry
40+
run: poetry config virtualenvs.in-project true
41+
42+
- name: Set up cache
43+
uses: actions/cache@v3
44+
id: cache
45+
with:
46+
path: .venv
47+
key: venv-${{ env.RUNNER_OS }}-${{ steps.full-python-version.outputs.version }}-${{ hashFiles('**/poetry.lock') }}
48+
49+
- name: Ensure cache is healthy
50+
if: steps.cache.outputs.cache-hit == 'true'
51+
run: timeout 10s poetry run pip --version || rm -rf .venv
52+
53+
- name: Make build script executable
3154
run: chmod +x ./.github/scripts/build.sh
3255

3356
- name: Build Wheel

.github/workflows/full-tests.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ jobs:
1515
strategy:
1616
matrix:
1717
os: [ubuntu-latest, windows-latest, macos-latest]
18-
python-version: ["3.9", "3.10", "3.11", "3.12"]
18+
python-version: ["3.9", "3.10", "3.11"]
1919
fail-fast: false
2020

2121
uses: ./.github/workflows/_test.yml

.github/workflows/pr-tests.yml

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,4 @@
11
name: PR Tests
2-
env:
3-
PYTHON_VERSION: 3.11
42

53
on:
64
pull_request:
@@ -9,7 +7,12 @@ on:
97

108
jobs:
119
call-tests:
10+
strategy:
11+
matrix:
12+
os: [ubuntu-latest]
13+
python-version: ["3.9", "3.10", "3.11"]
14+
fail-fast: false
1215
uses: ./.github/workflows/_test.yml
1316
with:
14-
os: ubuntu-latest
15-
python-version: "3.10"
17+
os: ${{ matrix.os }}
18+
python-version: ${{ matrix.python-version }}

.github/workflows/test-wheel.yml

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ on:
77

88
jobs:
99
test-wheel:
10-
needs: build-wheel # Ensures build-wheel job completes successfully
10+
needs: build-wheel
1111
runs-on: ubuntu-latest
1212
strategy:
1313
matrix:
@@ -31,11 +31,10 @@ jobs:
3131
with:
3232
name: nemoguardrails-${{ env.VERSION }}.whl
3333

34-
# Install the downloaded wheel
3534
- name: Install Wheel
3635
run: |
37-
pip install nemoguardrails-${{ env.VERSION }}-py3-none-any.whl
38-
pip install nemoguardrails-${{ env.VERSION }}-py3-none-any.whl[dev]
36+
pip install --user nemoguardrails-${{ env.VERSION }}-py3-none-any.whl
37+
pip install --user nemoguardrails-${{ env.VERSION }}-py3-none-any.whl[dev]
3938
4039
# Run additional tests as needed
4140
- name: Run Tests

0 commit comments

Comments
 (0)