From ac70c0760ed4ac7208306cbc8a0df5432ab036e9 Mon Sep 17 00:00:00 2001 From: Dmytro Parfeniuk Date: Wed, 14 Aug 2024 15:41:22 +0300 Subject: [PATCH 1/8] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F=20B?= =?UTF-8?q?uilds=20are=20updated=20according=20to=20a=20new=20infrastructu?= =?UTF-8?q?re=20injector?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 💄 inject_build_props.py imports are sorted --- .github/workflows/development.yml | 27 ++++++++++++++++--- .github/workflows/nightly.yml | 35 +++++++++++++++++++++++- .github/workflows/publish.yml | 40 ---------------------------- .github/workflows/quality.yml | 2 +- .github/workflows/release.yml | 44 +++++++++++++++++++++++++++++++ 5 files changed, 102 insertions(+), 46 deletions(-) delete mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index f8604d0..e2715e7 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -3,7 +3,7 @@ name: Development on: pull_request: branches: - - '**' + - "**" jobs: unit-tests: @@ -28,9 +28,7 @@ jobs: runs-on: ubuntu-latest strategy: matrix: - python: - - "3.12" - - "3.8" + python: ["3.12", "3.8"] steps: - uses: actions/checkout@v4 - name: Set up Python @@ -41,3 +39,24 @@ jobs: run: pip install tox - name: Run integration tests run: tox -e test-integration -- -m smoke + + publish-dev: + needs: [unit-tests, integration-tests] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Install pypa/build and pypa/twine + run: python3 -m pip install build twine --user + - name: Build a binary wheel & Inject build props + run: python3 -m tox -e build + - name: Publish to Internal PyPI + env: + GUIDELLM_BUILD_TYPE: dev + GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }} + TWINE_USERNAME: ${{ secrets.INTERNAL_PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.INTERNAL_PYPI_PASSWORD }} + run: python -m twine upload --repository-url ${{ secrets.INTERNAL_PYPI_REPOSITORY_URL }} dist/* diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index bf7f34c..1ce89b3 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -2,7 +2,7 @@ name: Nightly on: schedule: - - cron: '0 0 * * *' # Runs at midnight every night + - cron: "0 0 * * *" jobs: unit-tests: @@ -67,3 +67,36 @@ jobs: run: pip install tox - name: Run e2e tests run: tox -e test-e2e -- -m smoke + + publish-nightly: + needs: [unit-tests, integration-tests, e2e-tests] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Install pypa/build and pypa/twine + run: python3 -m pip install build twine --user + - name: Build a binary wheel & Inject build props + run: python3 -m tox -e build + - name: Publish to Internal PyPI + env: + GUIDELLM_BUILD_TYPE: nightly + GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }} + TWINE_USERNAME: ${{ secrets.INTERNAL_PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.INTERNAL_PYPI_PASSWORD }} + run: python -m twine upload --repository-url ${{ secrets.INTERNAL_PYPI_REPOSITORY_URL }} dist/* + + - name: Publish to Public PyPI + if: success() + env: + env: + GUIDELLM_BUILD_TYPE: nightly + GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }} + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + DATE=$(date +%Y%m%d) + python -m twine upload dist/* diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml deleted file mode 100644 index 4ea5d8a..0000000 --- a/.github/workflows/publish.yml +++ /dev/null @@ -1,40 +0,0 @@ -name: Publish Python distribution to PyPI - -on: - push: - tags: - - v* - -jobs: - build: - name: Build distribution - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v4 - - - name: Set up Python - uses: actions/setup-python@v5 - with: - python-version: "3.8" - - - name: Install pypa/build nad pypa/twine - run: >- - python3 -m pip install build twine --user - - - name: Build a binary wheel - run: python3 -m build - - publish-to-pypi: - name: Publish Python distribution to PyPI - needs: - - build - if: startsWith(github.ref, 'refs/tags/v') - runs-on: ubuntu-latest - steps: - - name: 🚀📦 Publish to PyPI - env: - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - - run: python -m twine upload dist/* diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 95d44af..62999a3 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -6,7 +6,7 @@ on: - main pull_request: branches: - - '**' + - "**" jobs: quality-check: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d4fe249..77a6b22 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -68,3 +68,47 @@ jobs: run: pip install tox - name: Run e2e tests run: tox -e test-e2e -- --cov-report=term-missing --cov --cov-fail-under=75 + + publish-release-candidate: + name: Publish Release Candidate + needs: [unit-tests, integration-tests, e2e-tests] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Install pypa/build and pypa/twine + run: python3 -m pip install build twine --user + - name: Build a binary wheel & Inject build props + run: python3 -m tox -e build + - name: Publish to Internal PyPI + env: + GUIDELLM_BUILD_TYPE: dev + GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }} + TWINE_USERNAME: ${{ secrets.INTERNAL_PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.INTERNAL_PYPI_PASSWORD }} + run: python -m twine upload --repository-url ${{ secrets.INTERNAL_PYPI_REPOSITORY_URL }} dist/* + + publish-final-release: + name: Publish Final Release + if: github.ref == 'refs/tags/v*' + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Install pypa/build and pypa/twine + run: python3 -m pip install build twine --user + - name: Build a binary wheel & Inject build props + run: python3 -m tox build + - name: Publish to Public PyPI + env: + GUIDELLM_BUILD_TYPE: release + GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }} + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: python -m twine upload dist/* From 48c2389ab957214d500ab0bf38aae8349d6162c7 Mon Sep 17 00:00:00 2001 From: Dmytro Parfeniuk Date: Fri, 26 Jul 2024 14:03:36 +0300 Subject: [PATCH 2/8] =?UTF-8?q?=F0=9F=92=9A=20`tox`=20is=20added=20to=20th?= =?UTF-8?q?e=20installation=20process?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/development.yml | 4 ++-- .github/workflows/nightly.yml | 2 +- .github/workflows/release.yml | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index e2715e7..c5b178a 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -38,7 +38,7 @@ jobs: - name: Install dependencies run: pip install tox - name: Run integration tests - run: tox -e test-integration -- -m smoke + run: python -m tox -e test-integration -- -m smoke publish-dev: needs: [unit-tests, integration-tests] @@ -50,7 +50,7 @@ jobs: with: python-version: "3.8" - name: Install pypa/build and pypa/twine - run: python3 -m pip install build twine --user + run: python3 -m pip install tox build twine --user - name: Build a binary wheel & Inject build props run: python3 -m tox -e build - name: Publish to Internal PyPI diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 1ce89b3..736ce1f 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -78,7 +78,7 @@ jobs: with: python-version: "3.8" - name: Install pypa/build and pypa/twine - run: python3 -m pip install build twine --user + run: python3 -m pip install tox build twine --user - name: Build a binary wheel & Inject build props run: python3 -m tox -e build - name: Publish to Internal PyPI diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 77a6b22..488af81 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -80,7 +80,7 @@ jobs: with: python-version: "3.8" - name: Install pypa/build and pypa/twine - run: python3 -m pip install build twine --user + run: python3 -m pip install tox build twine --user - name: Build a binary wheel & Inject build props run: python3 -m tox -e build - name: Publish to Internal PyPI @@ -102,7 +102,7 @@ jobs: with: python-version: "3.8" - name: Install pypa/build and pypa/twine - run: python3 -m pip install build twine --user + run: python3 -m pip install tox build twine --user - name: Build a binary wheel & Inject build props run: python3 -m tox build - name: Publish to Public PyPI From c81e6485b755eaa5c3bdd2625208f69d9f16fe2c Mon Sep 17 00:00:00 2001 From: Dmytro Parfeniuk Date: Thu, 15 Aug 2024 00:37:25 +0300 Subject: [PATCH 3/8] =?UTF-8?q?=F0=9F=91=B7=20neuralmagic/nm-actions/actio?= =?UTF-8?q?ns/publisher=20is=20used=20for=20distributions=20dev,=20staging?= =?UTF-8?q?,=20nightly=20and=20release=20workflows=20are=20prepared?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/development.yml | 36 ++++++++------ .github/workflows/nightly.yml | 32 +++--------- .github/workflows/release.yml | 42 +++------------- .github/workflows/staging.yml | 83 +++++++++++++++++++++++++++++++ 4 files changed, 119 insertions(+), 74 deletions(-) create mode 100644 .github/workflows/staging.yml diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index c5b178a..5d726d5 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -1,6 +1,10 @@ name: Development on: + push: + branches: + - "main" + pull_request: branches: - "**" @@ -20,9 +24,11 @@ jobs: with: python-version: ${{ matrix.python }} - name: Install dependencies - run: pip install tox + run: | + python -m pip install tox - name: Run unit tests - run: tox -e test-unit -- -m "smoke or sanity" + run: | + python -m tox -e test-unit -- -m "smoke or sanity" integration-tests: runs-on: ubuntu-latest @@ -36,12 +42,14 @@ jobs: with: python-version: ${{ matrix.python }} - name: Install dependencies - run: pip install tox + run: python -m pip install tox - name: Run integration tests run: python -m tox -e test-integration -- -m smoke - publish-dev: - needs: [unit-tests, integration-tests] + publish: + if: github.event_name == 'pull_request' || github.event_name == 'push' && github.ref == 'refs/heads/main' + name: Build & Publish the distribution + needs: [unit-tests, integration-tests, e2e-tests] runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 @@ -49,14 +57,10 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.8" - - name: Install pypa/build and pypa/twine - run: python3 -m pip install tox build twine --user - - name: Build a binary wheel & Inject build props - run: python3 -m tox -e build - - name: Publish to Internal PyPI - env: - GUIDELLM_BUILD_TYPE: dev - GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }} - TWINE_USERNAME: ${{ secrets.INTERNAL_PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.INTERNAL_PYPI_PASSWORD }} - run: python -m twine upload --repository-url ${{ secrets.INTERNAL_PYPI_REPOSITORY_URL }} dist/* + - name: Build and Publish Final Release + uses: neuralmagic/nm-actions/actions/publisher@main + with: + publish_pypi: false + publish_pypi_internal: true + timestamp: true + prefix: "-dev" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 736ce1f..bd124da 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -68,7 +68,7 @@ jobs: - name: Run e2e tests run: tox -e test-e2e -- -m smoke - publish-nightly: + publish: needs: [unit-tests, integration-tests, e2e-tests] runs-on: ubuntu-latest steps: @@ -77,26 +77,10 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.8" - - name: Install pypa/build and pypa/twine - run: python3 -m pip install tox build twine --user - - name: Build a binary wheel & Inject build props - run: python3 -m tox -e build - - name: Publish to Internal PyPI - env: - GUIDELLM_BUILD_TYPE: nightly - GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }} - TWINE_USERNAME: ${{ secrets.INTERNAL_PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.INTERNAL_PYPI_PASSWORD }} - run: python -m twine upload --repository-url ${{ secrets.INTERNAL_PYPI_REPOSITORY_URL }} dist/* - - - name: Publish to Public PyPI - if: success() - env: - env: - GUIDELLM_BUILD_TYPE: nightly - GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }} - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - DATE=$(date +%Y%m%d) - python -m twine upload dist/* + - name: Build and Publish a Candidate Release + uses: neuralmagic/nm-actions/actions/publisher@main + with: + publish_pypi_internal: true + publish_pypi: true + timestamp: true + prefix: "nightly-" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 488af81..af52eaf 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,6 +2,8 @@ name: Release on: push: + tags: + - v* branches: - release/** @@ -69,8 +71,8 @@ jobs: - name: Run e2e tests run: tox -e test-e2e -- --cov-report=term-missing --cov --cov-fail-under=75 - publish-release-candidate: - name: Publish Release Candidate + publish: + name: Build & Publish the distribution needs: [unit-tests, integration-tests, e2e-tests] runs-on: ubuntu-latest steps: @@ -79,36 +81,8 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.8" - - name: Install pypa/build and pypa/twine - run: python3 -m pip install tox build twine --user - - name: Build a binary wheel & Inject build props - run: python3 -m tox -e build - - name: Publish to Internal PyPI - env: - GUIDELLM_BUILD_TYPE: dev - GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }} - TWINE_USERNAME: ${{ secrets.INTERNAL_PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.INTERNAL_PYPI_PASSWORD }} - run: python -m twine upload --repository-url ${{ secrets.INTERNAL_PYPI_REPOSITORY_URL }} dist/* - - publish-final-release: - name: Publish Final Release - if: github.ref == 'refs/tags/v*' - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Set up Python - uses: actions/setup-python@v5 + - name: Build and Publish Final Release + uses: neuralmagic/nm-actions/actions/publisher@main with: - python-version: "3.8" - - name: Install pypa/build and pypa/twine - run: python3 -m pip install tox build twine --user - - name: Build a binary wheel & Inject build props - run: python3 -m tox build - - name: Publish to Public PyPI - env: - GUIDELLM_BUILD_TYPE: release - GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number }} - TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: python -m twine upload dist/* + publish_pypi_internal: true + publish_pypi: true diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml new file mode 100644 index 0000000..06e2b68 --- /dev/null +++ b/.github/workflows/staging.yml @@ -0,0 +1,83 @@ +name: Staging + +on: + push: + branches: + - release/** + +jobs: + unit-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python: + - "3.12" + - "3.11" + - "3.10" + - "3.9" + - "3.8" + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install tox + - name: Run unit tests + run: tox -e test-unit -- --cov-report=term-missing --cov --cov-fail-under=75 + + integration-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python: + - "3.12" + - "3.11" + - "3.10" + - "3.9" + - "3.8" + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install tox + - name: Run integration tests + run: tox -e test-integration -- --cov-report=term-missing --cov --cov-fail-under=75 + + e2e-tests: + runs-on: ubuntu-latest + strategy: + matrix: + python: + - "3.12" + - "3.11" + - "3.10" + - "3.9" + - "3.8" + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: ${{ matrix.python }} + - name: Install dependencies + run: pip install tox + - name: Run e2e tests + run: tox -e test-e2e -- --cov-report=term-missing --cov --cov-fail-under=75 + + publish: + name: Build & Publish the distribution + needs: [unit-tests, integration-tests, e2e-tests] + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python + uses: actions/setup-python@v5 + with: + python-version: "3.8" + - name: Build and Publish a Candidate Release + uses: neuralmagic/nm-actions/actions/publisher@main From 6ca56d304c985a75dba21ec20072cf8488ea3e8b Mon Sep 17 00:00:00 2001 From: Dmytro Parfeniuk Date: Fri, 16 Aug 2024 15:46:08 +0300 Subject: [PATCH 4/8] =?UTF-8?q?=F0=9F=91=B7=E2=80=8D=E2=99=82=EF=B8=8F=20'?= =?UTF-8?q?build=5Ftype'=20is=20used=20for=20renaming=20the=20build=20name?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/development.yml | 7 +++---- .github/workflows/nightly.yml | 7 +++---- .github/workflows/release.yml | 5 +++-- .github/workflows/staging.yml | 6 +++++- 4 files changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 5d726d5..914df24 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -57,10 +57,9 @@ jobs: uses: actions/setup-python@v5 with: python-version: "3.8" - - name: Build and Publish Final Release - uses: neuralmagic/nm-actions/actions/publisher@main + - name: Build and Publish Candidate Release + uses: neuralmagic/nm-actions/actions/publish_pypi@main with: publish_pypi: false publish_pypi_internal: true - timestamp: true - prefix: "-dev" + build_type: "dev" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index bd124da..86cbddf 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -78,9 +78,8 @@ jobs: with: python-version: "3.8" - name: Build and Publish a Candidate Release - uses: neuralmagic/nm-actions/actions/publisher@main + uses: neuralmagic/nm-actions/actions/publish_pypi@main with: - publish_pypi_internal: true publish_pypi: true - timestamp: true - prefix: "nightly-" + publish_pypi_internal: true + build_type: "nightly" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index af52eaf..fac9898 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -82,7 +82,8 @@ jobs: with: python-version: "3.8" - name: Build and Publish Final Release - uses: neuralmagic/nm-actions/actions/publisher@main + uses: neuralmagic/nm-actions/actions/publish_pypi@main with: - publish_pypi_internal: true publish_pypi: true + publish_pypi_internal: true + build_type: "release" diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 06e2b68..44ec439 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -80,4 +80,8 @@ jobs: with: python-version: "3.8" - name: Build and Publish a Candidate Release - uses: neuralmagic/nm-actions/actions/publisher@main + uses: neuralmagic/nm-actions/actions/publish_pypi@main + with: + publish_pypi: false + publish_pypi_internal: true + build_type: "release" From 2c340ec7b54b4f8c8d489fe17e83588b9aa26b4c Mon Sep 17 00:00:00 2001 From: Dmytro Parfeniuk Date: Wed, 21 Aug 2024 22:00:55 +0300 Subject: [PATCH 5/8] =?UTF-8?q?=F0=9F=91=B7=20utils/inject=5Fbuild=5Fprops?= =?UTF-8?q?.py=20controls=20the=20dist=20names?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/development.yml | 4 +++- .github/workflows/nightly.yml | 4 +++- .github/workflows/release.yml | 4 +++- .github/workflows/staging.yml | 4 +++- 4 files changed, 12 insertions(+), 4 deletions(-) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 914df24..3f51ee9 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -51,6 +51,9 @@ jobs: name: Build & Publish the distribution needs: [unit-tests, integration-tests, e2e-tests] runs-on: ubuntu-latest + env: + GUIDELLM_BUILD_TYPE: dev + GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number || github.run_number }} steps: - uses: actions/checkout@v4 - name: Set up Python @@ -62,4 +65,3 @@ jobs: with: publish_pypi: false publish_pypi_internal: true - build_type: "dev" diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 86cbddf..1b53026 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -71,6 +71,9 @@ jobs: publish: needs: [unit-tests, integration-tests, e2e-tests] runs-on: ubuntu-latest + env: + GUIDELLM_BUILD_TYPE: nightly + GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number || github.run_number }} steps: - uses: actions/checkout@v4 - name: Set up Python @@ -82,4 +85,3 @@ jobs: with: publish_pypi: true publish_pypi_internal: true - build_type: "nightly" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fac9898..fd0975e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -75,6 +75,9 @@ jobs: name: Build & Publish the distribution needs: [unit-tests, integration-tests, e2e-tests] runs-on: ubuntu-latest + env: + GUIDELLM_BUILD_TYPE: release + GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number || github.run_number }} steps: - uses: actions/checkout@v4 - name: Set up Python @@ -86,4 +89,3 @@ jobs: with: publish_pypi: true publish_pypi_internal: true - build_type: "release" diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 44ec439..572e2d9 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -73,6 +73,9 @@ jobs: name: Build & Publish the distribution needs: [unit-tests, integration-tests, e2e-tests] runs-on: ubuntu-latest + env: + GUIDELLM_BUILD_TYPE: release + GUIDELLM_BUILD_NUMBER: ${{ github.event.pull_request.number || github.run_number }} steps: - uses: actions/checkout@v4 - name: Set up Python @@ -84,4 +87,3 @@ jobs: with: publish_pypi: false publish_pypi_internal: true - build_type: "release" From a174a8e72203bf249bd7803097c70294c4ba2f31 Mon Sep 17 00:00:00 2001 From: Dmytro Parfeniuk Date: Thu, 22 Aug 2024 18:57:23 +0300 Subject: [PATCH 6/8] =?UTF-8?q?=F0=9F=94=A5=20utils/inject=5Fbuild=5Fprops?= =?UTF-8?q?=20->=20/nm-actions=20repository?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- tox.ini | 1 - utils/__init__.py | 0 utils/inject_build_props.py | 79 ------------------------------------- 3 files changed, 80 deletions(-) delete mode 100644 utils/__init__.py delete mode 100644 utils/inject_build_props.py diff --git a/tox.ini b/tox.ini index 076f7b8..5387b53 100644 --- a/tox.ini +++ b/tox.ini @@ -69,7 +69,6 @@ deps = loguru toml commands = - python utils/inject_build_props.py python -m build diff --git a/utils/__init__.py b/utils/__init__.py deleted file mode 100644 index e69de29..0000000 diff --git a/utils/inject_build_props.py b/utils/inject_build_props.py deleted file mode 100644 index 74000dd..0000000 --- a/utils/inject_build_props.py +++ /dev/null @@ -1,79 +0,0 @@ -import os -import re -from datetime import datetime -from pathlib import Path - -import toml -from loguru import logger - - -def get_build_type(): - return os.getenv("GUIDELLM_BUILD_TYPE", "dev") - - -def get_build_number(): - return os.getenv("GUIDELLM_BUILD_NUMBER", "0") - - -def construct_project_name_and_version(build_type, build_number, current_version): - if not re.match(r"^\d+\.\d+\.\d+$", current_version): - raise ValueError( - f"Version '{current_version}' does not match the " - f"semantic versioning pattern '#.#.#'", - ) - - if build_type == "dev": - project_name = "guidellm_dev" - version = f"{current_version}.dev{build_number}" - elif build_type == "nightly": - project_name = "guidellm_nightly" - date_str = datetime.now().strftime("%Y%m%d") - version = f"{current_version}.{date_str}" - elif build_type == "release": - project_name = "guidellm" - version = current_version - else: - raise ValueError(f"Unknown build type: {build_type}") - - return project_name, version - - -def update_pyproject_toml(project_name, version): - try: - with Path("pyproject.toml").open() as file: - data = toml.load(file) - - data["project"]["name"] = project_name - data["project"]["version"] = version - - with Path("pyproject.toml").open("w") as file: - toml.dump(data, file) - - logger.info( - f"Updated project name to: {project_name} and version to: {version}", - ) - except (FileNotFoundError, toml.TomlDecodeError) as e: - logger.error(f"Error reading or writing pyproject.toml: {e}") - raise - - -def main(): - build_type = get_build_type() - build_number = get_build_number() - - with Path("pyproject.toml").open() as file: - pyproject_data = toml.load(file) - - current_version = pyproject_data["project"]["version"] - project_name, version = construct_project_name_and_version( - build_type, - build_number, - current_version, - ) - - if build_type != "release": - update_pyproject_toml(project_name, version) - - -if __name__ == "__main__": - main() From ac53fc7d4ecfea35f09c1157b04c1a5f68148fdd Mon Sep 17 00:00:00 2001 From: Dmytro Parfeniuk Date: Thu, 22 Aug 2024 19:09:14 +0300 Subject: [PATCH 7/8] OpenAI API Key is added to Github Actions --- .github/workflows/development.yml | 2 ++ .github/workflows/nightly.yml | 2 ++ .github/workflows/release.yml | 2 ++ .github/workflows/staging.yml | 2 ++ 4 files changed, 8 insertions(+) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index 3f51ee9..ebf885e 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -35,6 +35,8 @@ jobs: strategy: matrix: python: ["3.12", "3.8"] + env: + GUIDELLM__OPENAI__API_KEY: ${{secrets.openai-automation-token}} steps: - uses: actions/checkout@v4 - name: Set up Python diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 1b53026..4cfcc65 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -36,6 +36,8 @@ jobs: - "3.10" - "3.9" - "3.8" + env: + GUIDELLM__OPENAI__API_KEY: ${{secrets.openai-automation-token}} steps: - uses: actions/checkout@v4 - name: Set up Python diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fd0975e..36f8997 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,6 +39,8 @@ jobs: - "3.10" - "3.9" - "3.8" + env: + GUIDELLM__OPENAI__API_KEY: ${{secrets.openai-automation-token}} steps: - uses: actions/checkout@v4 - name: Set up Python diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 572e2d9..44d868d 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -37,6 +37,8 @@ jobs: - "3.10" - "3.9" - "3.8" + env: + GUIDELLM__OPENAI__API_KEY: ${{secrets.openai-automation-token}} steps: - uses: actions/checkout@v4 - name: Set up Python From cd2d4448d0c517a3bdc21c2bc1d0ed42885349f5 Mon Sep 17 00:00:00 2001 From: Dmytro Parfeniuk Date: Thu, 22 Aug 2024 19:21:24 +0300 Subject: [PATCH 8/8] Google secrets authorization is added --- .github/workflows/development.yml | 9 +++++++++ .github/workflows/nightly.yml | 11 +++++++++-- .github/workflows/release.yml | 11 +++++++++-- .github/workflows/staging.yml | 11 +++++++++-- 4 files changed, 36 insertions(+), 6 deletions(-) diff --git a/.github/workflows/development.yml b/.github/workflows/development.yml index ebf885e..2567702 100644 --- a/.github/workflows/development.yml +++ b/.github/workflows/development.yml @@ -38,6 +38,15 @@ jobs: env: GUIDELLM__OPENAI__API_KEY: ${{secrets.openai-automation-token}} steps: + - name: Authenticate to GCP + uses: google-github-actions/auth@v2.1.3 + with: + project_id: ${{ secrets.GCP_PROJECT }} + workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} + service_account: ${{ secrets.NM_PYPI_SA }} + - name: Access OpenAI API Key from Secret Manager + run: | + echo "GUIDELLM__OPENAI__API_KEY=$(gcloud secrets versions access latest --secret=openai-automation-token)" >> $GITHUB_ENV - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 4cfcc65..6f5ce85 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -36,9 +36,16 @@ jobs: - "3.10" - "3.9" - "3.8" - env: - GUIDELLM__OPENAI__API_KEY: ${{secrets.openai-automation-token}} steps: + - name: Authenticate to GCP + uses: google-github-actions/auth@v2.1.3 + with: + project_id: ${{ secrets.GCP_PROJECT }} + workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} + service_account: ${{ secrets.NM_PYPI_SA }} + - name: Access OpenAI API Key from Secret Manager + run: | + echo "GUIDELLM__OPENAI__API_KEY=$(gcloud secrets versions access latest --secret=openai-automation-token)" >> $GITHUB_ENV - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 36f8997..03255de 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -39,9 +39,16 @@ jobs: - "3.10" - "3.9" - "3.8" - env: - GUIDELLM__OPENAI__API_KEY: ${{secrets.openai-automation-token}} steps: + - name: Authenticate to GCP + uses: google-github-actions/auth@v2.1.3 + with: + project_id: ${{ secrets.GCP_PROJECT }} + workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} + service_account: ${{ secrets.NM_PYPI_SA }} + - name: Access OpenAI API Key from Secret Manager + run: | + echo "GUIDELLM__OPENAI__API_KEY=$(gcloud secrets versions access latest --secret=openai-automation-token)" >> $GITHUB_ENV - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5 diff --git a/.github/workflows/staging.yml b/.github/workflows/staging.yml index 44d868d..2fa4c1f 100644 --- a/.github/workflows/staging.yml +++ b/.github/workflows/staging.yml @@ -37,9 +37,16 @@ jobs: - "3.10" - "3.9" - "3.8" - env: - GUIDELLM__OPENAI__API_KEY: ${{secrets.openai-automation-token}} steps: + - name: Authenticate to GCP + uses: google-github-actions/auth@v2.1.3 + with: + project_id: ${{ secrets.GCP_PROJECT }} + workload_identity_provider: ${{ secrets.GCP_WORKLOAD_IDENTITY_PROVIDER }} + service_account: ${{ secrets.NM_PYPI_SA }} + - name: Access OpenAI API Key from Secret Manager + run: | + echo "GUIDELLM__OPENAI__API_KEY=$(gcloud secrets versions access latest --secret=openai-automation-token)" >> $GITHUB_ENV - uses: actions/checkout@v4 - name: Set up Python uses: actions/setup-python@v5