Skip to content

Commit c81e648

Browse files
author
Dmytro Parfeniuk
committed
👷 neuralmagic/nm-actions/actions/publisher is used for distributions
dev, staging, nightly and release workflows are prepared
1 parent 48c2389 commit c81e648

File tree

4 files changed

+119
-74
lines changed

4 files changed

+119
-74
lines changed

.github/workflows/development.yml

Lines changed: 20 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,10 @@
11
name: Development
22

33
on:
4+
push:
5+
branches:
6+
- "main"
7+
48
pull_request:
59
branches:
610
- "**"
@@ -20,9 +24,11 @@ jobs:
2024
with:
2125
python-version: ${{ matrix.python }}
2226
- name: Install dependencies
23-
run: pip install tox
27+
run: |
28+
python -m pip install tox
2429
- name: Run unit tests
25-
run: tox -e test-unit -- -m "smoke or sanity"
30+
run: |
31+
python -m tox -e test-unit -- -m "smoke or sanity"
2632
2733
integration-tests:
2834
runs-on: ubuntu-latest
@@ -36,27 +42,25 @@ jobs:
3642
with:
3743
python-version: ${{ matrix.python }}
3844
- name: Install dependencies
39-
run: pip install tox
45+
run: python -m pip install tox
4046
- name: Run integration tests
4147
run: python -m tox -e test-integration -- -m smoke
4248

43-
publish-dev:
44-
needs: [unit-tests, integration-tests]
49+
publish:
50+
if: github.event_name == 'pull_request' || github.event_name == 'push' && github.ref == 'refs/heads/main'
51+
name: Build & Publish the distribution
52+
needs: [unit-tests, integration-tests, e2e-tests]
4553
runs-on: ubuntu-latest
4654
steps:
4755
- uses: actions/checkout@v4
4856
- name: Set up Python
4957
uses: actions/setup-python@v5
5058
with:
5159
python-version: "3.8"
52-
- name: Install pypa/build and pypa/twine
53-
run: python3 -m pip install tox build twine --user
54-
- name: Build a binary wheel & Inject build props
55-
run: python3 -m tox -e build
56-
- name: Publish to Internal PyPI
57-
env:
58-
GUIDELLM_BUILD_TYPE: dev
59-
GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }}
60-
TWINE_USERNAME: ${{ secrets.INTERNAL_PYPI_USERNAME }}
61-
TWINE_PASSWORD: ${{ secrets.INTERNAL_PYPI_PASSWORD }}
62-
run: python -m twine upload --repository-url ${{ secrets.INTERNAL_PYPI_REPOSITORY_URL }} dist/*
60+
- name: Build and Publish Final Release
61+
uses: neuralmagic/nm-actions/actions/publisher@main
62+
with:
63+
publish_pypi: false
64+
publish_pypi_internal: true
65+
timestamp: true
66+
prefix: "-dev"

.github/workflows/nightly.yml

Lines changed: 8 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ jobs:
6868
- name: Run e2e tests
6969
run: tox -e test-e2e -- -m smoke
7070

71-
publish-nightly:
71+
publish:
7272
needs: [unit-tests, integration-tests, e2e-tests]
7373
runs-on: ubuntu-latest
7474
steps:
@@ -77,26 +77,10 @@ jobs:
7777
uses: actions/setup-python@v5
7878
with:
7979
python-version: "3.8"
80-
- name: Install pypa/build and pypa/twine
81-
run: python3 -m pip install tox build twine --user
82-
- name: Build a binary wheel & Inject build props
83-
run: python3 -m tox -e build
84-
- name: Publish to Internal PyPI
85-
env:
86-
GUIDELLM_BUILD_TYPE: nightly
87-
GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }}
88-
TWINE_USERNAME: ${{ secrets.INTERNAL_PYPI_USERNAME }}
89-
TWINE_PASSWORD: ${{ secrets.INTERNAL_PYPI_PASSWORD }}
90-
run: python -m twine upload --repository-url ${{ secrets.INTERNAL_PYPI_REPOSITORY_URL }} dist/*
91-
92-
- name: Publish to Public PyPI
93-
if: success()
94-
env:
95-
env:
96-
GUIDELLM_BUILD_TYPE: nightly
97-
GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }}
98-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
99-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
100-
run: |
101-
DATE=$(date +%Y%m%d)
102-
python -m twine upload dist/*
80+
- name: Build and Publish a Candidate Release
81+
uses: neuralmagic/nm-actions/actions/publisher@main
82+
with:
83+
publish_pypi_internal: true
84+
publish_pypi: true
85+
timestamp: true
86+
prefix: "nightly-"

.github/workflows/release.yml

Lines changed: 8 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@ name: Release
22

33
on:
44
push:
5+
tags:
6+
- v*
57
branches:
68
- release/**
79

@@ -69,8 +71,8 @@ jobs:
6971
- name: Run e2e tests
7072
run: tox -e test-e2e -- --cov-report=term-missing --cov --cov-fail-under=75
7173

72-
publish-release-candidate:
73-
name: Publish Release Candidate
74+
publish:
75+
name: Build & Publish the distribution
7476
needs: [unit-tests, integration-tests, e2e-tests]
7577
runs-on: ubuntu-latest
7678
steps:
@@ -79,36 +81,8 @@ jobs:
7981
uses: actions/setup-python@v5
8082
with:
8183
python-version: "3.8"
82-
- name: Install pypa/build and pypa/twine
83-
run: python3 -m pip install tox build twine --user
84-
- name: Build a binary wheel & Inject build props
85-
run: python3 -m tox -e build
86-
- name: Publish to Internal PyPI
87-
env:
88-
GUIDELLM_BUILD_TYPE: dev
89-
GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }}
90-
TWINE_USERNAME: ${{ secrets.INTERNAL_PYPI_USERNAME }}
91-
TWINE_PASSWORD: ${{ secrets.INTERNAL_PYPI_PASSWORD }}
92-
run: python -m twine upload --repository-url ${{ secrets.INTERNAL_PYPI_REPOSITORY_URL }} dist/*
93-
94-
publish-final-release:
95-
name: Publish Final Release
96-
if: github.ref == 'refs/tags/v*'
97-
runs-on: ubuntu-latest
98-
steps:
99-
- uses: actions/checkout@v4
100-
- name: Set up Python
101-
uses: actions/setup-python@v5
84+
- name: Build and Publish Final Release
85+
uses: neuralmagic/nm-actions/actions/publisher@main
10286
with:
103-
python-version: "3.8"
104-
- name: Install pypa/build and pypa/twine
105-
run: python3 -m pip install tox build twine --user
106-
- name: Build a binary wheel & Inject build props
107-
run: python3 -m tox build
108-
- name: Publish to Public PyPI
109-
env:
110-
GUIDELLM_BUILD_TYPE: release
111-
GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }}
112-
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
113-
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
114-
run: python -m twine upload dist/*
87+
publish_pypi_internal: true
88+
publish_pypi: true

.github/workflows/staging.yml

Lines changed: 83 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,83 @@
1+
name: Staging
2+
3+
on:
4+
push:
5+
branches:
6+
- release/**
7+
8+
jobs:
9+
unit-tests:
10+
runs-on: ubuntu-latest
11+
strategy:
12+
matrix:
13+
python:
14+
- "3.12"
15+
- "3.11"
16+
- "3.10"
17+
- "3.9"
18+
- "3.8"
19+
steps:
20+
- uses: actions/checkout@v4
21+
- name: Set up Python
22+
uses: actions/setup-python@v5
23+
with:
24+
python-version: ${{ matrix.python }}
25+
- name: Install dependencies
26+
run: pip install tox
27+
- name: Run unit tests
28+
run: tox -e test-unit -- --cov-report=term-missing --cov --cov-fail-under=75
29+
30+
integration-tests:
31+
runs-on: ubuntu-latest
32+
strategy:
33+
matrix:
34+
python:
35+
- "3.12"
36+
- "3.11"
37+
- "3.10"
38+
- "3.9"
39+
- "3.8"
40+
steps:
41+
- uses: actions/checkout@v4
42+
- name: Set up Python
43+
uses: actions/setup-python@v5
44+
with:
45+
python-version: ${{ matrix.python }}
46+
- name: Install dependencies
47+
run: pip install tox
48+
- name: Run integration tests
49+
run: tox -e test-integration -- --cov-report=term-missing --cov --cov-fail-under=75
50+
51+
e2e-tests:
52+
runs-on: ubuntu-latest
53+
strategy:
54+
matrix:
55+
python:
56+
- "3.12"
57+
- "3.11"
58+
- "3.10"
59+
- "3.9"
60+
- "3.8"
61+
steps:
62+
- uses: actions/checkout@v4
63+
- name: Set up Python
64+
uses: actions/setup-python@v5
65+
with:
66+
python-version: ${{ matrix.python }}
67+
- name: Install dependencies
68+
run: pip install tox
69+
- name: Run e2e tests
70+
run: tox -e test-e2e -- --cov-report=term-missing --cov --cov-fail-under=75
71+
72+
publish:
73+
name: Build & Publish the distribution
74+
needs: [unit-tests, integration-tests, e2e-tests]
75+
runs-on: ubuntu-latest
76+
steps:
77+
- uses: actions/checkout@v4
78+
- name: Set up Python
79+
uses: actions/setup-python@v5
80+
with:
81+
python-version: "3.8"
82+
- name: Build and Publish a Candidate Release
83+
uses: neuralmagic/nm-actions/actions/publisher@main

0 commit comments

Comments
 (0)