From 8e88914fb6ebfd75504a6273bae7dbe85a53c0ed Mon Sep 17 00:00:00 2001 From: Martin Larralde Date: Mon, 6 Nov 2023 15:40:28 +0100 Subject: [PATCH] Replace Travis-CI with GitHub Actions for running CI/CD --- .github/workflows/package.yml | 89 +++++++++++++++++++++++++++++++++++ .github/workflows/test.yml | 48 +++++++++++++++++++ .travis.yml | 41 ---------------- 3 files changed, 137 insertions(+), 41 deletions(-) create mode 100644 .github/workflows/package.yml create mode 100644 .github/workflows/test.yml delete mode 100644 .travis.yml diff --git a/.github/workflows/package.yml b/.github/workflows/package.yml new file mode 100644 index 0000000..4acdb68 --- /dev/null +++ b/.github/workflows/package.yml @@ -0,0 +1,89 @@ +name: Package + +on: + push: + tags: + - v*.*.* + +jobs: + + wheel: + runs-on: ubuntu-latest + name: Build universal wheel + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: true + - name: Setup Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install build requirements + run: python -m pip install -r ci/requirements.txt + - name: Build wheel + run: python setup.py bdist_wheel + - name: Store built wheels + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist/* + + sdist: + runs-on: ubuntu-latest + name: Build source distribution + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: true + - name: Set up Python 3.9 + uses: actions/setup-python@v2 + with: + python-version: 3.9 + - name: Install build requirements + run: python -m pip install -r ci/requirements.txt + - name: Build wheel distribution + run: python setup.py sdist + - name: Store built wheels + uses: actions/upload-artifact@v2 + with: + name: dist + path: dist/* + + upload: + environment: PyPI + runs-on: ubuntu-latest + name: Upload + needs: + - sdist + - wheel + steps: + - name: Download built distributions + uses: actions/download-artifact@v2 + with: + name: dist + path: dist + - name: Publish distributions to PyPI + if: startsWith(github.ref, 'refs/tags/v') + uses: pypa/gh-action-pypi-publish@master + with: + user: __token__ + password: ${{ secrets.PYPI_API_TOKEN }} + skip_existing: false + + release: + environment: GitHub Releases + runs-on: ubuntu-latest + if: "startsWith(github.ref, 'refs/tags/v')" + name: Release + needs: upload + steps: + - name: Checkout code + uses: actions/checkout@v1 + with: + submodules: true + - name: Release a Changelog + uses: rasmus-saks/release-a-changelog-action@v1.0.1 + with: + github-token: '${{ secrets.GITHUB_TOKEN }}' diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..414efd1 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,48 @@ +name: Test + +on: + - push + - pull_request + +jobs: + + test-linux: + name: Test (Linux) + runs-on: ubuntu-latest + env: + OS: Linux + strategy: + matrix: + python-version: + - '3.7' + - '3.8' + - '3.9' + # - '3.10' + # - '3.11' + # - '3.12' + steps: + - name: Checkout code + uses: actions/checkout@v2 + with: + submodules: true + - name: Setup Python ${{ matrix.python-version }} + uses: actions/setup-python@v3 + with: + python-version: ${{ matrix.python-version }} + - name: Update pip + run: python -m pip install -U pip wheel setuptools + - name: Install library + run: python -m pip install . + - name: Install test requirements + run: python -m pip install -r tests/requirements.txt --prefer-binary + - name: Install coverage + run: python -m pip install coverage --prefer-binary + - name: Test with coverage + run: python -m coverage run -m unittest discover -vv + - name: Upload to Codecov + uses: codecov/codecov-action@v1 + with: + flags: ${{ matrix.python-version }} + name: test-python-${{ matrix.python-version }} + fail_ci_if_error: true + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index a4e829a..0000000 --- a/.travis.yml +++ /dev/null @@ -1,41 +0,0 @@ -sudo: false -language: python -python: -- '3.6' -- '3.5' -- '3.4' -- '2.7' - -cache: - pip: true - directories: - - $HOME/nmrML - - $HOME/MetaboLightsConfig - - $HOME/MetaboLightsStudies - -before_install: -- pip install -U pip setuptools wheel -- pip install -r tests/requirements.txt - -install: -- pip install -r requirements.txt -- pip install . - -script: -- python -m unittest discover -v - -notifications: - email: - - althonosdev@gmail.com - -deploy: -- provider: pypi - user: althonos - skip_cleanup: true - distributions: sdist bdist_wheel - password: - secure: 3GwXUI+FtixtOTEodb0GfB/eR/F74hD+gRPeiKgrPEVkDfu4e+n0QqgMdtBeEhpWbjK/hT7UavjqxwUQ8YW+w2Ty6Kb2QP8nbSuBuBFSKbJF/MVZb6MWgBt8HXOq9aH+G5nDnXlC7qKDt1yUFm0VbbPRa/LIwo9ebIcAC7Q5pi96LvmqIWzDxdeOAW+f9w4MiM1qdIF22C7zEXtBC9Rhuf0xQP9eic1YYmE6TlNAmIt3yVorEteZoHdRmbhx40qMnCx7TpWEYk4fx+BoZ7f0mlahDcZLaTIbMYaH15dFFRasOmc5aPSARR62mt9Tkq6qX1Rs/rYZa2qshF9wQJIOHbcHSX4kMR2AL/ZAqNlSGyjVWkOzEtLyh3YfknbfdcMrfF/1ZVMQDdAKL8QZ1u6ub8+CKfZTEsGu2tjZiHigzMFNdhzzr7lqNyb2HKfllVRiPzVb16irWYVXz3cnT241h0PzG1VjGEYPsYZY96/ayrQ/0UsaHkxZ7H2XRnPH0S/RsFMKeYy7wMuiWY7Dvv3bY4H/IbNpQQAgLdj/77jsZXcSOKElh00XcjBQeSsnR9fPUIqZJo35yvI2knTusbYuEJ3mC6Wnpnw0n2V2n+SdZm7+3wElqtANcu44HaBl+0TLVZRmLlecgy9ftL7bBQtgjjJk0mkuxLghV4mL7oopVqY= - on: - python: '3.5' - tags: true - repo: ISA-tools/nmrml2isa