From e1c440e8565bb577246e31929a7fbbf1def823f5 Mon Sep 17 00:00:00 2001 From: Ratan Kulshreshtha Date: Mon, 9 Dec 2019 14:36:49 +1100 Subject: [PATCH 1/6] Add gh actions for CI on macos --- .github/workflows/ci.yml | 94 +++++++++++++++++++++++++---------- .github/workflows/publish.yml | 27 ++++++++++ .travis.yml | 31 +----------- _travis/deploy.sh | 7 --- 4 files changed, 96 insertions(+), 63 deletions(-) create mode 100644 .github/workflows/publish.yml delete mode 100755 _travis/deploy.sh diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index ab2f78ec..7443ac35 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,38 +1,80 @@ +--- name: CI on: [push, pull_request] jobs: - Windows: + lint: + runs-on: ubuntu-latest - runs-on: windows-latest + steps: + - name: Checkout Repository + uses: actions/checkout@v1 + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python3.7 -m pip install nox + - name: Lint the code + run: nox -s lint + + docs: + runs-on: ubuntu-latest + + steps: + - name: Checkout Repository + uses: actions/checkout@v1 + - name: Set up Python 3.7 + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Install dependencies + run: | + python3.7 -m pip install nox + - name: Build the docs + run: nox -s docs + + test: + runs-on: ${{ matrix.platform }} strategy: fail-fast: false matrix: + platform: [macos-latest, windows-latest] python-version: [2.7, 3.5, 3.6, 3.7, 3.8] steps: - - uses: actions/checkout@v1 - - name: Set up Python 3.7 to run nox - uses: actions/setup-python@v1 - with: - python-version: 3.7 - - name: Set up Python ${{ matrix.python-version }} - if: matrix.python_version != '3.7' - uses: actions/setup-python@v1 - with: - python-version: ${{ matrix.python-version }} - - name: Install dependencies - run: | - # Work around https://github.com/theacodes/nox/issues/250 - Remove-Item C:\ProgramData\Chocolatey\bin\python2.7.exe - py -3.7 -m pip install nox - - name: Test - run: | - nox -s test-${{ matrix.python-version }} - - name: Coverage upload - env: - CODECOV_TOKEN: 3bb38a90-137e-4efe-9627-ca66de472c13 - run: | - python.exe -m pip install codecov - python.exe -m codecov -f coverage.xml + - name: Checkout Repository + uses: actions/checkout@v1 + - name: Set Up Python 3.7 to run nox + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Set Up Python - ${{ matrix.python-version }} + if: matrix.python_version != '3.7' + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install dependencies (Windows) + if: matrix.platform == 'windows-latest' + run: | + # Work around https://github.com/theacodes/nox/issues/250 + Remove-Item C:\ProgramData\Chocolatey\bin\python2.7.exe + py -3.7 -m pip install nox + - name: Install Dependencies + if: matrix.platform != 'windows-latest' + run: | + python3.7 -m pip install --upgrade nox + - name: Run Tests + run: | + nox -s test-${{ matrix.python-version }} + - name: Upload Coverage + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} + file: ./coverage.xml + flags: unittests + name: codecov-umbrella + yml: ./codecov.yml + fail_ci_if_error: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 00000000..846540a9 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,27 @@ +--- +name: Publish To PYPI + +on: + release: + types: [created] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v1 + - name: Set up Python + uses: actions/setup-python@v1 + 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 bdist_wheel + twine upload dist/* diff --git a/.travis.yml b/.travis.yml index b1a760c7..a8891c57 100644 --- a/.travis.yml +++ b/.travis.yml @@ -31,12 +31,6 @@ env: matrix: include: - # Lint & documentation. - - python: 3.6 - env: NOX_SESSION=lint - - python: 3.6 - env: NOX_SESSION=docs - # Unit tests - python: 2.7 env: NOX_SESSION=test-2.7 @@ -58,25 +52,6 @@ matrix: - python: 3.7 env: NOX_SESSION=google_brotli-3 - # OS X unit tests. - - language: generic - os: osx - env: NOX_SESSION=test-2.7 - - language: generic - os: osx - env: NOX_SESSION=test-3.5 - - language: generic - os: osx - env: NOX_SESSION=test-3.6 - - language: generic - os: osx - env: NOX_SESSION=test-3.7 - - - python: 3.7 - stage: deploy - script: - - ./_travis/deploy.sh - allow_failures: # MacPython 3.5 only supports TLS 1.1 by default, which fails whenever # easy_install fetchs packages, which is required by Twisted. Giving up on @@ -92,8 +67,4 @@ stages: # Run integration tests for release candidates - name: integration - if: type = pull_request AND head_branch =~ ^release-[\d.]+$ AND tag IS blank - - # Deploy on any tags - - name: deploy - if: tag IS present AND tag =~ /^(\d+\.\d+(?:.\d+)?)$/ AND repo = hip/hip + if: type = pull_request AND head_branch =~ ^release-[\d.]+$ AND tag IS blank \ No newline at end of file diff --git a/_travis/deploy.sh b/_travis/deploy.sh deleted file mode 100755 index 503f0723..00000000 --- a/_travis/deploy.sh +++ /dev/null @@ -1,7 +0,0 @@ -#!/bin/bash - -set -exo pipefail - -python3 -m pip install --upgrade twine wheel -python3 setup.py sdist bdist_wheel -python3 -m twine upload dist/* -u $PYPI_USERNAME -p $PYPI_PASSWORD --skip-existing From f47f8bff4e8b85f0ac887060e95bd4f14de1bee7 Mon Sep 17 00:00:00 2001 From: Ratan Kulshreshtha Date: Mon, 9 Dec 2019 15:59:49 +1100 Subject: [PATCH 2/6] Add codecov token --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7443ac35..a2bcda39 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: - name: Upload Coverage uses: codecov/codecov-action@v1 with: - token: ${{ secrets.CODECOV_TOKEN }} + token: 3bb38a90-137e-4efe-9627-ca66de472c13 file: ./coverage.xml flags: unittests name: codecov-umbrella From ce45f8f67ff8ee326095bc352460214e8f1764ae Mon Sep 17 00:00:00 2001 From: Ratan Kulshreshtha Date: Mon, 9 Dec 2019 16:29:12 +1100 Subject: [PATCH 3/6] Preserve deployment on tag in travis --- .travis.yml | 15 +++++---------- _travis/deploy.sh | 7 +++++++ 2 files changed, 12 insertions(+), 10 deletions(-) create mode 100755 _travis/deploy.sh diff --git a/.travis.yml b/.travis.yml index a8891c57..18b7b08b 100644 --- a/.travis.yml +++ b/.travis.yml @@ -52,19 +52,14 @@ matrix: - python: 3.7 env: NOX_SESSION=google_brotli-3 - allow_failures: - # MacPython 3.5 only supports TLS 1.1 by default, which fails whenever - # easy_install fetchs packages, which is required by Twisted. Giving up on - # testing MacPython 3.5 on Travis for this reason. - # https://github.com/tox-dev/tox/issues/809#issuecomment-443436586 - - language: generic - os: osx - env: NOX_SESSION=test-3.5 - stages: - name: test if: tag IS blank # Run integration tests for release candidates - name: integration - if: type = pull_request AND head_branch =~ ^release-[\d.]+$ AND tag IS blank \ No newline at end of file + if: type = pull_request AND head_branch =~ ^release-[\d.]+$ AND tag IS blank + + # Deploy on any tags + - name: deploy + if: tag IS present AND tag =~ /^(\d+\.\d+(?:.\d+)?)$/ AND repo = hip/hip \ No newline at end of file diff --git a/_travis/deploy.sh b/_travis/deploy.sh new file mode 100755 index 00000000..503f0723 --- /dev/null +++ b/_travis/deploy.sh @@ -0,0 +1,7 @@ +#!/bin/bash + +set -exo pipefail + +python3 -m pip install --upgrade twine wheel +python3 setup.py sdist bdist_wheel +python3 -m twine upload dist/* -u $PYPI_USERNAME -p $PYPI_PASSWORD --skip-existing From 217a54abff887674e44ea7fce4cbc9c841c066f8 Mon Sep 17 00:00:00 2001 From: Ratan Kulshreshtha Date: Thu, 12 Dec 2019 11:26:33 +1100 Subject: [PATCH 4/6] Seperate tests for different platforms --- .github/workflows/ci.yml | 47 +++++++++++++++++++++++++++++++++------- 1 file changed, 39 insertions(+), 8 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2bcda39..d4abcd6e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,12 +36,48 @@ jobs: - name: Build the docs run: nox -s docs - test: - runs-on: ${{ matrix.platform }} + macos: + runs-on: macos-latest + + strategy: + fail-fast: false + matrix: + python-version: [2.7, 3.5, 3.6, 3.7, 3.8] + + steps: + - name: Checkout Repository + uses: actions/checkout@v1 + - name: Set Up Python 3.7 to run nox + uses: actions/setup-python@v1 + with: + python-version: 3.7 + - name: Set Up Python - ${{ matrix.python-version }} + if: matrix.python_version != '3.7' + uses: actions/setup-python@v1 + with: + python-version: ${{ matrix.python-version }} + - name: Install Dependencies + run: | + python3.7 -m pip install --upgrade nox + - name: Run Tests + run: | + nox -s test-${{ matrix.python-version }} + - name: Upload Coverage + uses: codecov/codecov-action@v1 + with: + token: 3bb38a90-137e-4efe-9627-ca66de472c13 + file: ./coverage.xml + flags: unittests + name: codecov-umbrella + yml: ./codecov.yml + fail_ci_if_error: true + + windows: + runs-on: windows-latest + strategy: fail-fast: false matrix: - platform: [macos-latest, windows-latest] python-version: [2.7, 3.5, 3.6, 3.7, 3.8] steps: @@ -57,15 +93,10 @@ jobs: with: python-version: ${{ matrix.python-version }} - name: Install dependencies (Windows) - if: matrix.platform == 'windows-latest' run: | # Work around https://github.com/theacodes/nox/issues/250 Remove-Item C:\ProgramData\Chocolatey\bin\python2.7.exe py -3.7 -m pip install nox - - name: Install Dependencies - if: matrix.platform != 'windows-latest' - run: | - python3.7 -m pip install --upgrade nox - name: Run Tests run: | nox -s test-${{ matrix.python-version }} From 285472aaf8d90614c9936367709b2529e2a63603 Mon Sep 17 00:00:00 2001 From: Ratan Kulshreshtha Date: Thu, 12 Dec 2019 17:07:08 +1100 Subject: [PATCH 5/6] Change names for ut jobs for mac and windows --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index d4abcd6e..751ba162 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: - name: Build the docs run: nox -s docs - macos: + MacOS: runs-on: macos-latest strategy: @@ -72,7 +72,7 @@ jobs: yml: ./codecov.yml fail_ci_if_error: true - windows: + Windows: runs-on: windows-latest strategy: From 7bd226c9bec4f12dcd1247f79ccc6cf2f0243c1a Mon Sep 17 00:00:00 2001 From: Ratan Kulshreshtha Date: Thu, 12 Dec 2019 17:13:01 +1100 Subject: [PATCH 6/6] Change names for ut jobs for mac --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 751ba162..f3529f62 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -36,7 +36,7 @@ jobs: - name: Build the docs run: nox -s docs - MacOS: + macOS: runs-on: macos-latest strategy: