Skip to content

Boilerplate GHA script #13

@mattwthompson

Description

@mattwthompson

Here is a starting point for a GitHub Actions script that runs CI. This assumes some structural similarity to the MolSSI cookiecutter (python -m pip install . should install the package, there should be a conda environment specified in devtools/conda-envs/test_env.yaml) but with some small modifications. The only necessary modification to get this running off the shelf should be updating PACKAGE_NAME_HERE

name: ci

on:
  push:
    branches:
      - "master"
      - "maintenance/.+"
  pull_request:
    branches:
      - "master"
      - "maintenance/.+"
  schedule:
    # Run a cron job once daily
    - cron: "0 3 * * *"

jobs:
  test:
    runs-on: ${{ matrix.os }}
    strategy:
      fail-fast: false
      matrix:
        os: [macOS-latest, ubuntu-latest]
        python-version: [3.6, 3.7]
    env:
      PYVER: "${{ matrix.python-version }}"
      PACKAGE: PACKAGE_NAME_HERE  # Replace with the name of your package

    steps:
    - uses: actions/checkout@v2

    - uses: conda-incubator/setup-miniconda@v2
      with:
        python-version: ${{ matrix.python-version }}
        activate-environment: test
        channel-priority: true
        environment-file: devtools/conda-envs/test_env.yaml
        auto-activate-base: false

    - name: Additional info about the build
      shell: bash
      run: |
        uname -a
        df -h
        ulimit -a

    - name: Environment Information
      shell: bash -l {0}
      run: |
        conda info --all
        conda list

    - name: Install package
      shell: bash -l {0}
      run: |
        python -m pip install --no-deps .

    - name: Run tests
      shell: bash -l {0}
      run: |
        PYTEST_ARGS=" -v --cov=$PACKAGE --cov-report=xml --cov-config=setup.cfg"
        pytest $PYTEST_ARGS $PACKAGE

    - name: Codecov
      uses: codecov/codecov-action@v1
      with:
        file: ./coverage.xml
        fail_ci_if_error: true

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions