From 477ad5a0f54980862f65368c6de85c30daabfaa7 Mon Sep 17 00:00:00 2001 From: Amit Vikram Raj Date: Sat, 18 May 2024 14:03:28 +0530 Subject: [PATCH 1/9] modifed yaml file to run all the bash commands seperately for better logging --- .github/workflows/publish.yaml | 12 ++++++++---- run.sh | 2 +- 2 files changed, 9 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 1efbf0a..400e3c5 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -22,11 +22,15 @@ jobs: uses: actions/setup-python@v3 with: python-version: 3.8 - - name: Run + - name: Install Python Dependencies run: | - /bin/bash run.sh install - /bin/bash run.sh build - /bin/bash run.sh publish:test + /bin/bash -x run.sh install + - name: Build Python Package + run: | + /bin/bash -x run.sh build + # - name: Publish to Test PyPI + # run: | + # /bin/bash -x run.sh publish:test env: TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} diff --git a/run.sh b/run.sh index 0ef6e8e..cfbd4f4 100755 --- a/run.sh +++ b/run.sh @@ -11,7 +11,7 @@ function load-dotenv { # adding this if condition so that this does not fail in # github actions CI if [ ! -f "$THIS_DIR/.env" ]; then - echo "no .env file found" + echo "No .env file found" return 1 fi From 03d664013e033e96b53583106a58d887fcbccd9d Mon Sep 17 00:00:00 2001 From: Amit Vikram Raj Date: Sat, 18 May 2024 14:21:34 +0530 Subject: [PATCH 2/9] adding linting for ci(lint:ci) with SKIP=no-commit-to-branch in run.sh and adding same in pre-release ci yaml file --- .github/workflows/publish.yaml | 14 +++----------- run.sh | 6 +++++- 2 files changed, 8 insertions(+), 12 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 400e3c5..0ab4ef5 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -25,24 +25,16 @@ jobs: - name: Install Python Dependencies run: | /bin/bash -x run.sh install + - name: Lint, Format, and Other Static Code Quality Check + run: | + /bin/bash -x run.sh lint:ci - name: Build Python Package run: | /bin/bash -x run.sh build - # - name: Publish to Test PyPI - # run: | - # /bin/bash -x run.sh publish:test env: TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} PROD_PYPI_TOKEN: ${{ secrets.PROD_PYPI_TOKEN }} - - # - name: Install dependencies - # run: | - # python -m pip install --upgrade pip - # pip install pre-commit - # - name: Running pre-commit hooks - # run: | - # SKIP=no-commit-to-branch pre-commit run --all-files # https://docs.github.com/en/actions/learn-github-actions/contexts#example-printing-context-information-to-the-log diff --git a/run.sh b/run.sh index cfbd4f4..e071cbe 100755 --- a/run.sh +++ b/run.sh @@ -25,10 +25,14 @@ function install { python -m pip install --editable "${THIS_DIR}/[dev]" } -function lint { +function lint:ci { SKIP=no-commit-to-branch pre-commit run --all-files } +function lint { + pre-commit run --all-files +} + function build { python -m build --sdist --wheel "${THIS_DIR}" } From 12496369e84f6bd388f16121d576689e100cc035 Mon Sep 17 00:00:00 2001 From: Amit Vikram Raj Date: Sat, 18 May 2024 14:36:51 +0530 Subject: [PATCH 3/9] adding publish package to test and prod pypi to ci pipeline, only when push event occurs on main branch --- .github/workflows/publish.yaml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 0ab4ef5..8383ed1 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -31,7 +31,18 @@ jobs: - name: Build Python Package run: | /bin/bash -x run.sh build - + - name: Publish to Test PyPI + # setting -x in below publish:test will not leak any secrets as they are masked in github + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + run: | + /bin/bash -x run.sh publish:test + env: + TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} + PROD_PYPI_TOKEN: ${{ secrets.PROD_PYPI_TOKEN }} + - name: Publish to Prod PyPI + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + run: | + /bin/bash -x run.sh publish:prod env: TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} PROD_PYPI_TOKEN: ${{ secrets.PROD_PYPI_TOKEN }} From 6786e4ff3ea52573814e090513304045f1cf4f61 Mon Sep 17 00:00:00 2001 From: Amit Vikram Raj Date: Sat, 18 May 2024 19:56:11 +0530 Subject: [PATCH 4/9] adding git tags and avoiding duplicate releases --- .github/workflows/publish.yaml | 15 +++++++++++++-- 1 file changed, 13 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 8383ed1..2178eee 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -8,6 +8,7 @@ on: push: branches: - main + # Manually trigger a workflow # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch workflow_dispatch: @@ -18,10 +19,18 @@ jobs: steps: # github actions checksout, clones our repo, and checks out the branch we're working in - uses: actions/checkout@v3 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags + # fetching all tags so to aviod duplicate version tagging in 'Tag with the Release Version' + fetch-depth: 0 - name: Set up Python 3.8 uses: actions/setup-python@v3 with: python-version: 3.8 + # tagging the release version to avoid duplicate releases + - name: Tag with the Release Version + run: | + git tag $(cat version.txt) - name: Install Python Dependencies run: | /bin/bash -x run.sh install @@ -38,14 +47,16 @@ jobs: /bin/bash -x run.sh publish:test env: TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} - PROD_PYPI_TOKEN: ${{ secrets.PROD_PYPI_TOKEN }} - name: Publish to Prod PyPI if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} run: | /bin/bash -x run.sh publish:prod env: - TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} PROD_PYPI_TOKEN: ${{ secrets.PROD_PYPI_TOKEN }} + - name: Push Tags + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + run: | + git push origin --tags # https://docs.github.com/en/actions/learn-github-actions/contexts#example-printing-context-information-to-the-log From b08c50c51862bd82b8227eb8dc2e5b471c22c35a Mon Sep 17 00:00:00 2001 From: Amit Vikram Raj Date: Sat, 18 May 2024 20:04:05 +0530 Subject: [PATCH 5/9] updating readme and refactoring publish.toml file --- .github/workflows/publish.yaml | 12 ++++- README.md | 81 +++++++++++++++++++++++++++++++++- 2 files changed, 91 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 2178eee..1d15e60 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -15,7 +15,9 @@ on: jobs: build-test-and-publish: + runs-on: ubuntu-latest + steps: # github actions checksout, clones our repo, and checks out the branch we're working in - uses: actions/checkout@v3 @@ -23,23 +25,29 @@ jobs: # Number of commits to fetch. 0 indicates all history for all branches and tags # fetching all tags so to aviod duplicate version tagging in 'Tag with the Release Version' fetch-depth: 0 + - name: Set up Python 3.8 uses: actions/setup-python@v3 with: python-version: 3.8 - # tagging the release version to avoid duplicate releases + + # tagging the release version to avoid duplicate releases - name: Tag with the Release Version run: | git tag $(cat version.txt) + - name: Install Python Dependencies run: | /bin/bash -x run.sh install + - name: Lint, Format, and Other Static Code Quality Check run: | /bin/bash -x run.sh lint:ci + - name: Build Python Package run: | /bin/bash -x run.sh build + - name: Publish to Test PyPI # setting -x in below publish:test will not leak any secrets as they are masked in github if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} @@ -47,12 +55,14 @@ jobs: /bin/bash -x run.sh publish:test env: TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} + - name: Publish to Prod PyPI if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} run: | /bin/bash -x run.sh publish:prod env: PROD_PYPI_TOKEN: ${{ secrets.PROD_PYPI_TOKEN }} + - name: Push Tags if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} run: | diff --git a/README.md b/README.md index 11a07b4..e5aa496 100644 --- a/README.md +++ b/README.md @@ -774,4 +774,83 @@ twine upload --help ## Detailed CI/CD Workflow for Python Packages -![Detailed CI/CD Workflow for Python Packages](https://github.com/avr2002/python-packaging/blob/main/packaging_demo/assets/detailed-workflow.png?raw=true) \ No newline at end of file +![Detailed CI/CD Workflow for Python Packages](https://github.com/avr2002/python-packaging/blob/main/packaging_demo/assets/detailed-workflow.png?raw=true) + + +### GitHub CI/CD Workflow in worflows yaml file + +```toml +# .github/workflows/publish.yaml + +name: Build, Test, and Publish + +# triggers: whenever there is new changes pulled/pushed on this +# repo under given conditions, run the below jobs +on: + pull_request: + types: [opened, synchronize] + + push: + branches: + - main + + # Manually trigger a workflow + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch + workflow_dispatch: + +jobs: + + build-test-and-publish: + + runs-on: ubuntu-latest + + steps: + # github actions checksout, clones our repo, and checks out the branch we're working in + - uses: actions/checkout@v3 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags + # fetching all tags so to aviod duplicate version tagging in 'Tag with the Release Version' + fetch-depth: 0 + + - name: Set up Python 3.8 + uses: actions/setup-python@v3 + with: + python-version: 3.8 + + # tagging the release version to avoid duplicate releases + - name: Tag with the Release Version + run: | + git tag $(cat version.txt) + + - name: Install Python Dependencies + run: | + /bin/bash -x run.sh install + + - name: Lint, Format, and Other Static Code Quality Check + run: | + /bin/bash -x run.sh lint:ci + + - name: Build Python Package + run: | + /bin/bash -x run.sh build + + - name: Publish to Test PyPI + # setting -x in below publish:test will not leak any secrets as they are masked in github + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + run: | + /bin/bash -x run.sh publish:test + env: + TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} + + - name: Publish to Prod PyPI + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + run: | + /bin/bash -x run.sh publish:prod + env: + PROD_PYPI_TOKEN: ${{ secrets.PROD_PYPI_TOKEN }} + + - name: Push Tags + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} + run: | + git push origin --tags +``` \ No newline at end of file From 092371326cba494e124b1435f09dcc06b8a10feb Mon Sep 17 00:00:00 2001 From: Amit Vikram Raj Date: Sat, 18 May 2024 20:40:40 +0530 Subject: [PATCH 6/9] updating readme on github actions optimizations --- .github/workflows/publish.yaml | 8 ++++---- README.md | 32 +++++++++++++++++++++++++++++++- 2 files changed, 35 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 1d15e60..d3f5dd8 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -20,18 +20,18 @@ jobs: steps: # github actions checksout, clones our repo, and checks out the branch we're working in - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: # Number of commits to fetch. 0 indicates all history for all branches and tags # fetching all tags so to aviod duplicate version tagging in 'Tag with the Release Version' fetch-depth: 0 - name: Set up Python 3.8 - uses: actions/setup-python@v3 + uses: actions/setup-python@v4 with: python-version: 3.8 - # tagging the release version to avoid duplicate releases + # tagging the release version to avoid duplicate releases - name: Tag with the Release Version run: | git tag $(cat version.txt) @@ -62,7 +62,7 @@ jobs: /bin/bash -x run.sh publish:prod env: PROD_PYPI_TOKEN: ${{ secrets.PROD_PYPI_TOKEN }} - + - name: Push Tags if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} run: | diff --git a/README.md b/README.md index e5aa496..8a3aa14 100644 --- a/README.md +++ b/README.md @@ -853,4 +853,34 @@ jobs: if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} run: | git push origin --tags -``` \ No newline at end of file +``` + +### GitHub Actions Optimizations + +1. Locking Requirements + - It's not really recommended to pin exact versions of dependencies to avoid future conflict + - But it's good practice to store them in the requirements file for future debugging. + - Tools: + +2. Dependency Caching + - Whenever github actions gets executed in the github CI, everytime it's run on a fresh container. + Thus, everytime we'll have to download and re-install dependencies from pip again and again; + which is not a good as it's inefficeint and slows our workflow. + + - Thus we would want to install all the dependencies when the workflow ran first and use it every + time a new worflow is run. + + - GitHub Actions provide this functionality by caching the dependencies, it stores the installed + dependencies(`~/.cache/pip`) and downloads it everytime a new workflow is run. + [**Docs**](https://github.com/actions/cache/blob/main/examples.md#python---pip) + + ```toml + - uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + ``` + +3. Parallelization \ No newline at end of file From edc60ea6de6b5359d6a38a2e1522eab220389cda Mon Sep 17 00:00:00 2001 From: Amit Vikram Raj Date: Sat, 18 May 2024 21:16:52 +0530 Subject: [PATCH 7/9] adding parallelization to our worklfow --- .github/workflows/publish.yaml | 109 ++++++++++++++++++++++++++------- README.md | 66 ++++++++++++++------ pyproject.toml | 4 +- version.txt | 2 +- 4 files changed, 135 insertions(+), 46 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index d3f5dd8..07f0315 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -1,6 +1,6 @@ name: Build, Test, and Publish -# triggers: whenever there is new changes pulled/pushed on this +# triggers: whenever there is new changes pulled/pushed on this # repo under given conditions, run the below jobs on: pull_request: @@ -14,61 +14,124 @@ on: jobs: - build-test-and-publish: - + check-verison-txt: + runs-on: ubuntu-latest + steps: + # github actions checksout, clones our repo, and checks out the branch we're working in + - uses: actions/checkout@v4 + with: + # Number of commits to fetch. 0 indicates all history for all branches and tags + # fetching all tags so to aviod duplicate version tagging in 'Tag with the Release Version' + fetch-depth: 0 + # tagging the release version to avoid duplicate releases + - name: Tag with the Release Version + run: | + git tag $(cat version.txt) + + + lint-format-and-static-code-checks: runs-on: ubuntu-latest - steps: - # github actions checksout, clones our repo, and checks out the branch we're working in - uses: actions/checkout@v4 - with: - # Number of commits to fetch. 0 indicates all history for all branches and tags - # fetching all tags so to aviod duplicate version tagging in 'Tag with the Release Version' - fetch-depth: 0 - - name: Set up Python 3.8 uses: actions/setup-python@v4 with: python-version: 3.8 - - # tagging the release version to avoid duplicate releases - - name: Tag with the Release Version - run: | - git tag $(cat version.txt) - - - name: Install Python Dependencies + # caching dependencies + - uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install pre-commit run: | - /bin/bash -x run.sh install - + pip install pre-commit - name: Lint, Format, and Other Static Code Quality Check run: | /bin/bash -x run.sh lint:ci + + build-wheel-and-sdist: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.8 + uses: actions/setup-python@v4 + with: + python-version: 3.8 + - uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install build CLI + run: | + pip install build - name: Build Python Package run: | /bin/bash -x run.sh build + # uploading the built package to publish in the publish workflow + - name: Upload wheel and sdist + uses: actions/upload-artifact@v4 + with: + name: wheel-and-sdist-artifact + path: ./dist/* + + + publish: + needs: + - check-verison-txt + - lint-format-and-static-code-checks + - build-wheel-and-sdist + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Set up Python 3.8 + uses: actions/setup-python@v4 + with: + python-version: 3.8 + + # downloading the built package in 'build-wheel-and-sdist' workflow to publish + - name: Download wheel and sdist + uses: actions/download-artifact@v4 + with: + name: wheel-and-sdist-artifact + path: ./dist/ + + - uses: actions/cache@v3 + with: + path: ~/.cache/pip + key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} + restore-keys: | + ${{ runner.os }}-pip- + - name: Install twine CLI + run: | + pip install twine + - name: Publish to Test PyPI # setting -x in below publish:test will not leak any secrets as they are masked in github - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} run: | /bin/bash -x run.sh publish:test env: TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} - name: Publish to Prod PyPI - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} run: | /bin/bash -x run.sh publish:prod env: PROD_PYPI_TOKEN: ${{ secrets.PROD_PYPI_TOKEN }} - name: Push Tags - if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} run: | git push origin --tags + + + # https://docs.github.com/en/actions/learn-github-actions/contexts#example-printing-context-information-to-the-log dump_contexts_to_log: runs-on: ubuntu-latest @@ -102,4 +165,4 @@ jobs: SECRETS_CONTEXT: ${{ toJson(secrets) }} run: echo "$SECRETS_CONTEXT" - name: Dump Variables - run: echo "${{ toJson(vars) }}" \ No newline at end of file + run: echo "${{ toJson(vars) }}" diff --git a/README.md b/README.md index 8a3aa14..490bca4 100644 --- a/README.md +++ b/README.md @@ -784,16 +784,16 @@ twine upload --help name: Build, Test, and Publish -# triggers: whenever there is new changes pulled/pushed on this +# triggers: whenever there is new changes pulled/pushed on this # repo under given conditions, run the below jobs on: pull_request: types: [opened, synchronize] - + push: branches: - main - + # Manually trigger a workflow # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#workflow_dispatch workflow_dispatch: @@ -801,9 +801,9 @@ on: jobs: build-test-and-publish: - + runs-on: ubuntu-latest - + steps: # github actions checksout, clones our repo, and checks out the branch we're working in - uses: actions/checkout@v3 @@ -811,29 +811,29 @@ jobs: # Number of commits to fetch. 0 indicates all history for all branches and tags # fetching all tags so to aviod duplicate version tagging in 'Tag with the Release Version' fetch-depth: 0 - + - name: Set up Python 3.8 uses: actions/setup-python@v3 with: python-version: 3.8 - + # tagging the release version to avoid duplicate releases - name: Tag with the Release Version run: | git tag $(cat version.txt) - + - name: Install Python Dependencies run: | /bin/bash -x run.sh install - + - name: Lint, Format, and Other Static Code Quality Check run: | /bin/bash -x run.sh lint:ci - + - name: Build Python Package run: | /bin/bash -x run.sh build - + - name: Publish to Test PyPI # setting -x in below publish:test will not leak any secrets as they are masked in github if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} @@ -841,14 +841,14 @@ jobs: /bin/bash -x run.sh publish:test env: TEST_PYPI_TOKEN: ${{ secrets.TEST_PYPI_TOKEN }} - + - name: Publish to Prod PyPI if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} run: | /bin/bash -x run.sh publish:prod env: PROD_PYPI_TOKEN: ${{ secrets.PROD_PYPI_TOKEN }} - + - name: Push Tags if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} run: | @@ -860,20 +860,20 @@ jobs: 1. Locking Requirements - It's not really recommended to pin exact versions of dependencies to avoid future conflict - But it's good practice to store them in the requirements file for future debugging. - - Tools: + - Tools: 2. Dependency Caching - Whenever github actions gets executed in the github CI, everytime it's run on a fresh container. Thus, everytime we'll have to download and re-install dependencies from pip again and again; which is not a good as it's inefficeint and slows our workflow. - + - Thus we would want to install all the dependencies when the workflow ran first and use it every time a new worflow is run. - - - GitHub Actions provide this functionality by caching the dependencies, it stores the installed - dependencies(`~/.cache/pip`) and downloads it everytime a new workflow is run. + + - GitHub Actions provide this functionality by caching the dependencies, it stores the installed + dependencies(`~/.cache/pip`) and downloads it everytime a new workflow is run. [**Docs**](https://github.com/actions/cache/blob/main/examples.md#python---pip) - + ```toml - uses: actions/cache@v3 with: @@ -883,4 +883,30 @@ jobs: ${{ runner.os }}-pip- ``` -3. Parallelization \ No newline at end of file +3. Parallelization + + - We moved from above shown workflow to now a parallelized workflow as shown below. + - This helps in faster running of workflow, helping discover bugs in any steps + at the same time which was not possible in linear flow as earlier. + +```toml +# See .github/workflows/publish.yaml + +jobs: + + check-verison-txt: + ... + + lint-format-and-static-code-checks: + .... + + build-wheel-and-sdist: + ... + + publish: + needs: + - check-verison-txt + - lint-format-and-static-code-checks + - build-wheel-and-sdist + ... +``` diff --git a/pyproject.toml b/pyproject.toml index 67c85be..c846373 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -12,8 +12,8 @@ description = "Demo for Python Packaging" readme = "README.md" requires-python = ">=3.8" keywords = [ - "python", "bash", "makefile", "pypi", "ci-cd", "setuptools", "wheels", - "package-development", "github-actions", "pypi-package", "pre-commit-hooks", + "python", "bash", "makefile", "pypi", "ci-cd", "setuptools", "wheels", + "package-development", "github-actions", "pypi-package", "pre-commit-hooks", "pyproject-toml", "gitactions-workflow", "github-actions-enabled", "pre-commit-ci", "pre-commit-config" ] diff --git a/version.txt b/version.txt index 254a9f2..41a2819 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v0.0.6 \ No newline at end of file +v0.0.7 From 1e1f41a1c75184273da84536c0dbf53dfb807b5f Mon Sep 17 00:00:00 2001 From: Amit Vikram Raj Date: Sat, 18 May 2024 21:26:22 +0530 Subject: [PATCH 8/9] fixing bugs in publish.yaml and readme --- .github/workflows/publish.yaml | 1 + README.md | 4 ++-- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index 07f0315..c65d8b0 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -87,6 +87,7 @@ jobs: - lint-format-and-static-code-checks - build-wheel-and-sdist runs-on: ubuntu-latest + if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} steps: - uses: actions/checkout@v4 - name: Set up Python 3.8 diff --git a/README.md b/README.md index 490bca4..e9b11f3 100644 --- a/README.md +++ b/README.md @@ -779,7 +779,7 @@ twine upload --help ### GitHub CI/CD Workflow in worflows yaml file -```toml +```yaml # .github/workflows/publish.yaml name: Build, Test, and Publish @@ -889,7 +889,7 @@ jobs: - This helps in faster running of workflow, helping discover bugs in any steps at the same time which was not possible in linear flow as earlier. -```toml +```yaml # See .github/workflows/publish.yaml jobs: From e62944c3cf94e208e5e56b45be72e823a0a12797 Mon Sep 17 00:00:00 2001 From: Amit Vikram Raj Date: Sat, 18 May 2024 21:29:13 +0530 Subject: [PATCH 9/9] minor bug fixes --- .github/workflows/publish.yaml | 6 +++--- version.txt | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/publish.yaml b/.github/workflows/publish.yaml index c65d8b0..2361de0 100644 --- a/.github/workflows/publish.yaml +++ b/.github/workflows/publish.yaml @@ -38,7 +38,7 @@ jobs: with: python-version: 3.8 # caching dependencies - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} @@ -60,7 +60,7 @@ jobs: uses: actions/setup-python@v4 with: python-version: 3.8 - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} @@ -102,7 +102,7 @@ jobs: name: wheel-and-sdist-artifact path: ./dist/ - - uses: actions/cache@v3 + - uses: actions/cache@v4 with: path: ~/.cache/pip key: ${{ runner.os }}-pip-${{ hashFiles('**/requirements.txt') }} diff --git a/version.txt b/version.txt index 41a2819..3ce186f 100644 --- a/version.txt +++ b/version.txt @@ -1 +1 @@ -v0.0.7 +v0.0.8