Skip to content

Commit

Permalink
Merge pull request #148 from KVSlab/patch/fix-ci
Browse files Browse the repository at this point in the history
Update CI
  • Loading branch information
hkjeldsberg authored May 5, 2024
2 parents 298de3d + 2c5b524 commit 07129c6
Showing 1 changed file with 26 additions and 47 deletions.
73 changes: 26 additions & 47 deletions .github/workflows/check_and_test_package.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,14 @@
name: CI
name: VaMPy CI

on:
push:
# The CI is executed on every push on every branch
branches:
- master
pull_request:
# The CI is executed on every pull request to the main branch
branches:
- master

schedule:
# The CI is executed every day at 8am
- cron: "0 8 * * *"
- cron: '0 8 * * *'

env:
CACHE_NUMBER: 11 # Increase to reset cache
Expand All @@ -23,23 +19,18 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Upgrade pip and setuptools
run: python3 -m pip install pip setuptools --upgrade

- name: Install types-paramiko
run: python3 -m pip install types-paramiko

- name: Install VaMPy
run: python3 -m pip install .[test]
- uses: actions/checkout@v4
- uses: actions/setup-python@v5
with:
python-version: '3.8'

- name: Check code with Flake8
run: python3 -m flake8
- name: Install dependencies and VaMPy
run: |
python -m pip install --upgrade pip setuptools
python -m pip install types-paramiko .[test]
- name: Check code with mypy
run: python3 -m mypy
- run: python -m flake8
- run: python -m mypy

test-code:
needs: check-code
Expand All @@ -52,53 +43,41 @@ jobs:
- os: macos-latest
label: osx-64
prefix: /Users/runner/miniconda3/envs/vampy

name: Test VaMPy on ${{ matrix.label }}
runs-on: ${{ matrix.os }}

# https://github.com/marketplace/actions/setup-miniconda#use-a-default-shell
defaults:
run:
run: # https://github.com/marketplace/actions/setup-miniconda#use-a-default-shell
shell: bash -l {0}

steps:
- name: Checkout
uses: actions/checkout@v3

- name: Upgrade pip and setuptools
run: |
python3 -m pip install pip setuptools --upgrade
# See: https://github.com/marketplace/actions/setup-miniconda
- name: Setup Mambaforge
- uses: actions/checkout@v3
- uses: actions/setup-python@v5
with:
python-version: '3.8'
- name: Setup and install with Mambaforge
uses: conda-incubator/setup-miniconda@v2
with:
miniforge-variant: Mambaforge
miniforge-version: latest
channels: conda-forge
activate-environment: vampy
use-mamba: true

- name: Set cache date
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV

environment-file: environment-test.yml
id: mamba
- uses: actions/cache@v2
with:
path: ${{ matrix.prefix }}
key: ${{ matrix.label }}-conda-${{ hashFiles('environment-test.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }}
id: cache

- name: Update environment
run: mamba env update -n vampy -f environment-test.yml
key: ${{ matrix.label }}-${{ github.run_id }}-${{ env.CACHE_NUMBER }}
restore-keys: ${{ matrix.label }}-
- run: mamba env update -n vampy -f environment-test.yml
if: steps.cache.outputs.cache-hit != 'true'

- name: Install VaMPy
run: python3 -m pip install --editable .[test]
run: python -m pip install .[test]

- name: Run tests
run: python3 -m pytest tests
run: python -m pytest tests

- name: Upload coverage report to codecov
- name: Upload coverage report to Codecov
if: matrix.os == 'ubuntu-latest'
uses: codecov/codecov-action@v3
with:
Expand Down

0 comments on commit 07129c6

Please sign in to comment.