Skip to content

Commit d7526b5

Browse files
Update GH actions release workflow (#145)
Notes: - added changes for poetry build cycle and push to test-pypi - updated test_cov script to properly fail with failed tests --------- Co-authored-by: Tyler Hutcherson <[email protected]>
1 parent 7faaf4e commit d7526b5

File tree

6 files changed

+157
-103
lines changed

6 files changed

+157
-103
lines changed

.github/workflows/lint.yml

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11

2-
name: check
2+
name: Lint
33

44
on:
55
pull_request:

.github/workflows/publish.yml

-44
This file was deleted.

.github/workflows/release.yml

+143
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,143 @@
1+
name: Release
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
version:
7+
description: 'Version of this deployment'
8+
required: true
9+
10+
env:
11+
PYTHON_VERSION: "3.11"
12+
POETRY_VERSION: "1.4.2"
13+
14+
jobs:
15+
build:
16+
runs-on: ubuntu-latest
17+
18+
steps:
19+
- uses: actions/checkout@v4
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: ${{ env.PYTHON_VERSION }}
25+
26+
- name: Install Poetry
27+
uses: snok/install-poetry@v1
28+
29+
- name: Set Version
30+
run: poetry version ${{ github.event.inputs.version }}
31+
32+
- name: Build package
33+
run: poetry build
34+
35+
- name: Upload build
36+
uses: actions/upload-artifact@v4
37+
with:
38+
name: dist
39+
path: dist/
40+
41+
# test-pypi-publish:
42+
# needs: build
43+
# runs-on: ubuntu-latest
44+
45+
# steps:
46+
# - uses: actions/checkout@v4
47+
48+
# - name: Set up Python
49+
# uses: actions/setup-python@v4
50+
# with:
51+
# python-version: ${{ env.PYTHON_VERSION }}
52+
53+
# - name: Install Poetry
54+
# uses: snok/install-poetry@v1
55+
56+
# - uses: actions/download-artifact@v4
57+
# with:
58+
# name: dist
59+
# path: dist/
60+
61+
# - name: Publish to TestPyPI
62+
# env:
63+
# POETRY_PYPI_TOKEN_TESTPYPI: ${{ secrets.TESTPYPI }}
64+
# run: poetry config repositories.test-pypi https://test.pypi.org/legacy/; poetry config pypi-token.test-pypi $POETRY_PYPI_TOKEN_TESTPYPI; poetry publish --repository test-pypi
65+
66+
# pre-release-checks:
67+
# needs: test-pypi-publish
68+
# runs-on: ubuntu-latest
69+
70+
# steps:
71+
# - uses: actions/checkout@v4
72+
73+
# - name: Set up Python
74+
# uses: actions/setup-python@v4
75+
# with:
76+
# python-version: ${{ env.PYTHON_VERSION }}
77+
78+
# - name: Install Poetry
79+
# uses: snok/install-poetry@v1
80+
81+
# - name: Install dependencies
82+
# run: |
83+
# poetry install --all-extras
84+
85+
# - name: Install published package from TestPyPI
86+
# env:
87+
# OPENAI_API_KEY: ${{ secrets.OPENAI_KEY }}
88+
# GCP_LOCATION: ${{ secrets.GCP_LOCATION }}
89+
# GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
90+
# COHERE_API_KEY: ${{ secrets.COHERE_API_KEY }}
91+
# AZURE_OPENAI_API_KEY: ${{secrets.AZURE_OPENAI_API_KEY}}
92+
# AZURE_OPENAI_ENDPOINT: ${{secrets.AZURE_OPENAI_ENDPOINT}}
93+
# AZURE_OPENAI_DEPLOYMENT_NAME: ${{secrets.AZURE_OPENAI_DEPLOYMENT_NAME}}
94+
# OPENAI_API_VERSION: ${{secrets.OPENAI_API_VERSION}}
95+
# run:
96+
# poetry run pip install --index-url https://test.pypi.org/simple/ --no-deps redisvl-test; poetry run test-cov
97+
98+
publish:
99+
needs: build #pre-release-checks
100+
runs-on: ubuntu-latest
101+
102+
steps:
103+
- uses: actions/checkout@v4
104+
105+
- name: Set up Python
106+
uses: actions/setup-python@v4
107+
with:
108+
python-version: ${{ env.PYTHON_VERSION }}
109+
110+
- name: Install Poetry
111+
uses: snok/install-poetry@v1
112+
113+
- uses: actions/download-artifact@v4
114+
with:
115+
name: dist
116+
path: dist/
117+
118+
- name: Publish to PyPI
119+
env:
120+
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI }}
121+
run: poetry publish
122+
123+
create-release:
124+
needs: publish
125+
runs-on: ubuntu-latest
126+
127+
steps:
128+
- uses: actions/checkout@v4
129+
130+
- uses: actions/download-artifact@v4
131+
with:
132+
name: dist
133+
path: dist/
134+
135+
- name: Create Release
136+
uses: ncipollo/release-action@v1
137+
with:
138+
artifacts: "dist/*"
139+
token: ${{ secrets.GITHUB_TOKEN }}
140+
draft: false
141+
generateReleaseNotes: true
142+
tag: ${{ github.event.inputs.version }}
143+
commit: main

.github/workflows/test-publish.yml

-46
This file was deleted.

.gitignore

+2-1
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,5 @@ scratch
99
wiki_schema.yaml
1010
docs/_build/
1111
.venv
12-
coverage.xml
12+
coverage.xml
13+
dist/

scripts.py

+11-11
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,39 @@
11
import subprocess
22

33
def format():
4-
subprocess.run(["isort", "./redisvl", "./tests/", "--profile", "black"])
5-
subprocess.run(["black", "./redisvl", "./tests/"])
4+
subprocess.run(["isort", "./redisvl", "./tests/", "--profile", "black"], check=True)
5+
subprocess.run(["black", "./redisvl", "./tests/"], check=True)
66

77
def check_format():
8-
subprocess.run(["black", "--check", "./redisvl"])
8+
subprocess.run(["black", "--check", "./redisvl"], check=True)
99

1010
def sort_imports():
11-
subprocess.run(["isort", "./redisvl", "./tests/", "--profile", "black"])
11+
subprocess.run(["isort", "./redisvl", "./tests/", "--profile", "black"], check=True)
1212

1313
def check_sort_imports():
14-
subprocess.run(["isort", "./redisvl", "--check-only", "--profile", "black"])
14+
subprocess.run(["isort", "./redisvl", "--check-only", "--profile", "black"], check=True)
1515

1616
def check_lint():
17-
subprocess.run(["pylint", "--rcfile=.pylintrc", "./redisvl"])
17+
subprocess.run(["pylint", "--rcfile=.pylintrc", "./redisvl"], check=True)
1818

1919
def mypy():
20-
subprocess.run(["python", "-m", "mypy", "./redisvl"])
20+
subprocess.run(["python", "-m", "mypy", "./redisvl"], check=True)
2121

2222
def test():
23-
subprocess.run(["python", "-m", "pytest", "--log-level=CRITICAL"])
23+
subprocess.run(["python", "-m", "pytest", "--log-level=CRITICAL"], check=True)
2424

2525
def test_verbose():
26-
subprocess.run(["python", "-m", "pytest", "-vv", "-s", "--log-level=CRITICAL"])
26+
subprocess.run(["python", "-m", "pytest", "-vv", "-s", "--log-level=CRITICAL"], check=True)
2727

2828
def test_cov():
2929
subprocess.run(["python", "-m", "pytest", "-vv", "--cov=./redisvl", "--cov-report=xml", "--log-level=CRITICAL"], check=True)
3030

3131
def cov():
32-
subprocess.run(["coverage", "html"])
32+
subprocess.run(["coverage", "html"], check=True)
3333
print("If data was present, coverage report is in ./htmlcov/index.html")
3434

3535
def test_notebooks():
36-
subprocess.run(["cd", "docs/", "&&", "poetry run treon", "-v"])
36+
subprocess.run(["cd", "docs/", "&&", "poetry run treon", "-v"], check=True)
3737

3838
def build_docs():
3939
subprocess.run("cd docs/ && make html", shell=True)

0 commit comments

Comments
 (0)