From bb5a1dc6efc22b267157b338141e7a068867602c Mon Sep 17 00:00:00 2001 From: kadirnar Date: Thu, 23 Nov 2023 22:12:31 +0300 Subject: [PATCH] Update GitHub Actions workflows --- .github/workflows/ci.yml | 17 +++++-- .github/workflows/package_testing.yml | 67 ++++++++++++++------------- .github/workflows/publish_pypi.yml | 47 ++++++++----------- 3 files changed, 66 insertions(+), 65 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5f1a60b..690aaac 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,8 +3,15 @@ name: Python package CI on: push: branches: [main] + paths-ignore: + - '**.md' + - '**.ipynb' + pull_request: branches: [main] + paths-ignore: + - '**.md' + - '**.ipynb' jobs: build: @@ -18,15 +25,15 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v2 + uses: actions/checkout@v3 - name: Set up Python - uses: actions/setup-python@v2 + uses: actions/setup-python@v4 with: python-version: ${{ matrix.python-version }} - name: Restore Ubuntu cache - uses: actions/cache@v2 + uses: actions/cache@v3 if: matrix.operating-system == 'ubuntu-latest' with: path: ~/.cache/pip @@ -34,7 +41,7 @@ jobs: restore-keys: ${{ matrix.operating-system }}-${{ matrix.python-version }}- - name: Restore MacOS cache - uses: actions/cache@v2 + uses: actions/cache@v3 if: matrix.operating-system == 'macos-latest' with: path: ~/Library/Caches/pip @@ -42,7 +49,7 @@ jobs: restore-keys: ${{ matrix.operating-system }}-${{ matrix.python-version }}- - name: Restore Windows cache - uses: actions/cache@v2 + uses: actions/cache@v3 if: matrix.operating-system == 'windows-latest' with: path: ~\AppData\Local\pip\Cache diff --git a/.github/workflows/package_testing.yml b/.github/workflows/package_testing.yml index bf5e799..ab1be93 100644 --- a/.github/workflows/package_testing.yml +++ b/.github/workflows/package_testing.yml @@ -13,49 +13,50 @@ jobs: strategy: matrix: operating-system: [ubuntu-latest, windows-latest, macos-latest] - python-version: [3.8, 3.9, 3.10, 3.11] + python-version: [3.8, 3.9, 3.10, 3.11, 3.12] torch-version: [2.1.0, 2.1.1] fail-fast: false steps: - - name: Checkout - uses: actions/checkout@v2 + - name: Checkout + uses: actions/checkout@v3 - - name: Set up Python - uses: actions/setup-python@v2 - with: - python-version: ${{ matrix.python-version }} + - name: Set up Python + uses: actions/setup-python@v4 + with: + python-version: ${{ matrix.python-version }} - - name: Restore Ubuntu cache - uses: actions/cache@v2 - if: matrix.operating-system == 'ubuntu-latest' - with: - path: ~/.cache/pip - key: ${{ matrix.operating-system }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}} - restore-keys: ${{ matrix.operating-system }}-${{ matrix.python-version }}- + - name: Restore Ubuntu cache + uses: actions/cache@v3 + if: matrix.operating-system == 'ubuntu-latest' + with: + path: ~/.cache/pip + key: ${{ matrix.operating-system }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}} + restore-keys: ${{ matrix.operating-system }}-${{ matrix.python-version }}- - - name: Restore MacOS cache - uses: actions/cache@v2 - if: matrix.operating-system == 'macos-latest' - with: - path: ~/Library/Caches/pip - key: ${{ matrix.operating-system }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}} - restore-keys: ${{ matrix.operating-system }}-${{ matrix.python-version }}- + - name: Restore MacOS cache + uses: actions/cache@v3 + if: matrix.operating-system == 'macos-latest' + with: + path: ~/Library/Caches/pip + key: ${{ matrix.operating-system }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}} + restore-keys: ${{ matrix.operating-system }}-${{ matrix.python-version }}- - - name: Restore Windows cache - uses: actions/cache@v2 - if: matrix.operating-system == 'windows-latest' - with: - path: ~\AppData\Local\pip\Cache - key: ${{ matrix.operating-system }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}} - restore-keys: ${{ matrix.operating-system }}-${{ matrix.python-version }}- + - name: Restore Windows cache + uses: actions/cache@v3 + if: matrix.operating-system == 'windows-latest' + with: + path: ~\AppData\Local\pip\Cache + key: ${{ matrix.operating-system }}-${{ matrix.python-version }}-${{ hashFiles('**/setup.py')}} + restore-keys: ${{ matrix.operating-system }}-${{ matrix.python-version }}- - - name: Update pip - run: python -m pip install --upgrade pip + - name: Update pip + run: python -m pip install --upgrade pip - - name: Install Numpy - run: > - pip install numpy + - name: Check styling with pre-commit + run: | + pre-commit install + pre-commit run --all-files - name: Install PyTorch on Linux and Windows if: > diff --git a/.github/workflows/publish_pypi.yml b/.github/workflows/publish_pypi.yml index fd5cc4c..3abdec2 100644 --- a/.github/workflows/publish_pypi.yml +++ b/.github/workflows/publish_pypi.yml @@ -1,34 +1,27 @@ -name: Publish Python distributions to PyPI +name: Publish Python Package on: - push: - branches: [ master ] + release: + types: [created] jobs: - build-n-publish: - name: Build and publish Python distributions to PyPI - runs-on: ubuntu-latest + deploy: + runs-on: ubuntu-20.04 steps: - - uses: actions/checkout@v2 - - name: Set up Python 3.8 - uses: actions/setup-python@v2 + - uses: actions/checkout@v3 + - name: Set up Python + uses: actions/setup-python@v4 with: - python-version: 3.8 - - name: Install pypa/build - run: >- - python -m - pip install - build - - name: Build a binary wheel and a source tarball - run: >- - python -m - build - --sdist - --wheel - --outdir dist/ - - name: Publish distribution 📦 to PyPI - uses: pypa/gh-action-pypi-publish@master - with: - user: __token__ - password: ${{ secrets.PYPI_WHISPERPLUS_API_KEY }} + python-version: '3.x' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: __token__ + TWINE_PASSWORD: ${{ secrets.PYPI_WHISPERPLUS_API_KEY }} + run: | + python setup.py sdist bdist_wheel + twine upload dist/*