Update README.md #27
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI-CD | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- '*' | |
jobs: | |
test: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-latest] | |
python-version: [3.7] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel pipenv | |
pip install -r test/requirements.txt | |
pip install pipdeptree==0.13.1 | |
- name: Test with pytest | |
run: | | |
pip install pytest | |
pip install pytest-cov | |
py.test --cov=./ --cov-report=xml -s test/test_core/test_CobraMetabolicModel.py | |
py.test --cov=./ --cov-report=xml -s test/test_cli/test_contrabass_cli.py | |
- name: "Upload coverage to Codecov" | |
uses: codecov/codecov-action@v2 | |
with: | |
fail_ci_if_error: true | |
sonarcloud: | |
name: SonarCloud | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis | |
- name: SonarCloud Scan | |
uses: SonarSource/sonarcloud-github-action@master | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} # Needed to get PR information, if any | |
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} | |
release: | |
needs: test | |
if: startsWith(github.ref, 'refs/tags') | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: [3.7] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
python -m pip install twine | |
- name: Build package | |
run: | | |
python setup.py sdist bdist_wheel | |
- name: Twine upload | |
env: | |
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }} | |
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }} | |
run: | | |
python -m twine upload --skip-existing --non-interactive dist/* | |
- name: Test install | |
run: | | |
pip install contrabass | |
- name: GitHub release | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.TOKEN_GITHUB }} | |
with: | |
tag_name: ${{ github.ref }} | |
release_name: ${{ github.ref }} | |
body_path: "" | |
draft: false | |
prerelease: false |