From 3c28f4038e5de54adb45d9213c91ed34978158be Mon Sep 17 00:00:00 2001 From: Baudouin Raoult Date: Thu, 19 Nov 2020 12:29:40 +0000 Subject: Check --- .github/workflows/check-and-publish.yml | 86 +++++++++++++++++++++++++++++++++ .github/workflows/python-publish.yml | 31 ------------ 2 files changed, 86 insertions(+), 31 deletions(-) create mode 100644 .github/workflows/check-and-publish.yml delete mode 100644 .github/workflows/python-publish.yml (limited to '.github/workflows') diff --git a/.github/workflows/check-and-publish.yml b/.github/workflows/check-and-publish.yml new file mode 100644 index 0000000..11dce56 --- /dev/null +++ b/.github/workflows/check-and-publish.yml @@ -0,0 +1,86 @@ +name: Check and publish + +on: + push: + branches: [ master ] + + pull_request: + branches: [ master ] + + release: + types: [created] + + +jobs: + checks: + strategy: + fail-fast: false + matrix: + platform: [windows-latest, ubuntu-latest, macos-latest] + python-version: ["2.7", "3.6", "3.7", "3.8", "3.9"] + + name: Python ${{ matrix.python-version }} on ${{ matrix.platform }} + runs-on: ${{ matrix.platform }} + + timeout-minutes: 20 + + steps: + - uses: actions/checkout@v2 + + - uses: actions/setup-python@v2 + with: + python-version: ${{ matrix.python-version }} + + - name: Tokens + shell: python + env: + ECMWFAPIRC: ${{ secrets.CDSAPIRC }} + + run: | + import os + for n in ('CDSAPIRC',): + m = os.path.expanduser("~/." + n.lower()) + if os.environ[n]: + with open(m, "w") as f: + print(os.environ[n], file=f) + + - name: Tests + run: | + python setup.py develop + pip install pytest + pytest + + deploy: + + if: ${{ github.event_name == 'release' }} + + name: Upload to Pypi + needs: checks + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + - name: Set up Python + uses: actions/setup-python@v2 + with: + python-version: '3.8' + - name: Install dependencies + run: | + python -m pip install --upgrade pip + pip install setuptools wheel twine + - name: Build and publish + env: + TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} + TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} + run: | + python setup.py sdist + twine upload dist/* + + - name: Notify climetlab + uses: mvasigh/dispatch-action@main + with: + token: ${{ secrets.NOTIFY_ECMWFLIBS }} + repo: climetlab + owner: ecmwf + event_type: cdsapi-updated diff --git a/.github/workflows/python-publish.yml b/.github/workflows/python-publish.yml deleted file mode 100644 index 2b290d1..0000000 --- a/.github/workflows/python-publish.yml +++ /dev/null @@ -1,31 +0,0 @@ -# This workflows will upload a Python Package using Twine when a release is created -# For more information see: https://help.github.com/en/actions/language-and-framework-guides/using-python-with-github-actions#publishing-to-package-registries - -name: Upload Python Package - -on: - release: - types: [created] - -jobs: - deploy: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v2 - - name: Set up Python - uses: actions/setup-python@v2 - with: - 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: ${{ secrets.PYPI_USERNAME }} - TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} - run: | - python setup.py sdist - twine upload dist/* -- cgit v1.2.3