From c1b86ad78954871f0db18ead747a71b71e880a06 Mon Sep 17 00:00:00 2001 From: NADIM KHAN Date: Wed, 1 Jan 2025 02:15:14 +0100 Subject: [PATCH] Update CI workflow to publish on version tags; remove deprecated python-package.yml workflow --- .github/workflows/python-ci.yml | 3 +- .github/workflows/python-package.yml | 41 ---------------------------- github/workflows/python-ci.yml | 1 + 3 files changed, 2 insertions(+), 43 deletions(-) delete mode 100644 .github/workflows/python-package.yml create mode 100644 github/workflows/python-ci.yml diff --git a/.github/workflows/python-ci.yml b/.github/workflows/python-ci.yml index 1d2860d..7029e63 100644 --- a/.github/workflows/python-ci.yml +++ b/.github/workflows/python-ci.yml @@ -45,7 +45,7 @@ jobs: publish: needs: build runs-on: ubuntu-latest - if: github.event_name == 'push' && github.ref == 'refs/heads/main' + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v') steps: - uses: actions/checkout@v3 @@ -64,7 +64,6 @@ jobs: run: python -m build - name: Publish to PyPI - if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags') env: TWINE_USERNAME: __token__ TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} diff --git a/.github/workflows/python-package.yml b/.github/workflows/python-package.yml deleted file mode 100644 index 425ee51..0000000 --- a/.github/workflows/python-package.yml +++ /dev/null @@ -1,41 +0,0 @@ -# This workflow will install Python dependencies, run tests and lint with a variety of Python versions -# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python - -name: Python package - -on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] - -jobs: - build: - - runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - python-version: ["3.9", "3.10", "3.11"] - - steps: - - uses: actions/checkout@v4 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v3 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - python -m pip install --upgrade pip - pip install flake8 pytest pytest-cov numpy pandas matplotlib seaborn scipy Pillow openpyxl - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - pip install -e . - - name: Lint with flake8 - run: | - # stop the build if there are Python syntax errors or undefined names - flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics - # exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide - flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics - - name: Test with pytest - run: | - pytest --cov=dgNova --cov-report=xml diff --git a/github/workflows/python-ci.yml b/github/workflows/python-ci.yml new file mode 100644 index 0000000..0519ecb --- /dev/null +++ b/github/workflows/python-ci.yml @@ -0,0 +1 @@ + \ No newline at end of file