Skip to content

CI

CI #1728

# This is a basic workflow to help you get started with Actions
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
pull_request:
# run the pipeline on the 0th minute of the 0th hour of day 1 and 15 every month
schedule:
- cron: '0 0 1,15 * *'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Specify the python versions to test
strategy:
matrix:
python-version: ["3.9", "3.10", "3.11"]
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
# Set up the python versions and install conda dependencies
- name: Install conda dependencies
uses: conda-incubator/setup-miniconda@v2
with:
python-version: ${{ matrix.python-version }}
environment-file: conda_env.yml
activate-environment: flarestack
auto-activate-base: false
# Display the python version and conda info
- name: Display Python version and Conda info
shell: bash -el {0}
run: |
python --version
conda --version
conda config --show-sources
conda config --show
conda list
conda info -a
# Setting up dependencies
- name: Install dependencies
shell: bash -el {0}
run: |
python -m pip install --upgrade pip
python -m pip install poetry
python -m poetry install
# Runs a set of commands using the runners shell
- name: Test the code
shell: bash -el {0}
run: |
poetry run coverage run --concurrency=multiprocessing -m unittest discover tests/
poetry run coverage combine
poetry run coverage xml
- name: quick coverage report
shell: bash -el {0}
run: |
ls -la
poetry run coverage report --data-file .coverage
- name: Run Coveralls
if: ${{ success() }}
uses: coverallsapp/github-action@v2
with:
file: coverage.xml
flag-name: python${{ join(matrix.*, '-') }}
parallel: true
github-token: ${{ secrets.GITHUB_TOKEN }}
format: cobertura
- name: Echo tag name
run: echo "Tag is ${{ github.ref }}, Deploy is ${{ startsWith(github.ref, 'refs/tags/') && matrix.python-version == 3.9}}"
- name: Build a binary wheel and a source tarball
shell: bash -el {0}
run: python -m poetry build
- name: Publish distribution 📦 to PyPI
if: ${{ startsWith(github.ref, 'refs/tags/') && success() && matrix.python-version == 3.9}}
env:
POETRY_PYPI_TOKEN_PYPI: ${{ secrets.PYPI_API_TOKEN }}
shell: bash -el {0}
run: poetry publish
finish:
needs: build
if: ${{ always() }}
runs-on: ubuntu-latest
steps:
- name: Coveralls Finished
uses: coverallsapp/github-action@v2
with:
parallel-finished: true
carryforward: "python3.9,python3.10,python3.11"
github-token: ${{ secrets.GITHUB_TOKEN }}