Merge pull request #195 from keiyamamo/fix_cfl #815
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
# Borrowed from VaMPy | |
# Original Workflow File: https://github.com/KVSlab/VaMPy/blob/master/.github/workflows/check_and_test_package.yml | |
# Description: Check and test the code of VaSP | |
name: 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 4am | |
- cron: "0 4 * * *" | |
env: | |
CACHE_NUMBER: 0 # Increase to reset cache | |
jobs: | |
check-code: | |
name: Check code | |
runs-on: ubuntu-latest | |
continue-on-error: true | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Upgrade pip and setuptools | |
run: python3 -m pip install pip setuptools --upgrade | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install types-paramiko | |
run: python3 -m pip install types-paramiko | |
- name: Install VaSP | |
run: python3 -m pip install .[test] | |
- name: Check code with Flake8 | |
run: python3 -m flake8 | |
- name: Check code with mypy | |
run: python3 -m mypy | |
test-code: | |
needs: check-code | |
strategy: | |
matrix: | |
include: | |
- os: ubuntu-latest | |
label: linux-64 | |
prefix: /usr/share/miniconda3/envs/vasp | |
- os: macos-latest | |
label: osx-64 | |
prefix: /Users/runner/miniconda3/envs/vasp | |
name: Test VaSP on ${{ matrix.label }} | |
runs-on: ${{ matrix.os }} | |
# https://github.com/marketplace/actions/setup-miniconda#use-a-default-shell | |
defaults: | |
run: | |
shell: bash -l {0} | |
steps: | |
- uses: actions/setup-python@v5 | |
with: | |
python-version: '3.10' | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Upgrade pip and setuptools | |
run: | | |
python3 -m pip install --break-system-packages pip setuptools --upgrade | |
# See: https://github.com/marketplace/actions/setup-miniconda | |
- name: Setup Conda environment | |
uses: conda-incubator/setup-miniconda@v3 | |
with: | |
miniforge-version: latest | |
channels: conda-forge | |
activate-environment: vasp | |
use-mamba: true | |
architecture: x64 | |
- name: Set cache date | |
run: echo "DATE=$(date +'%Y%m%d')" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
with: | |
path: ${{ matrix.prefix }} | |
key: ${{ matrix.label }}-conda-${{ hashFiles('environment.yml') }}-${{ env.DATE }}-${{ env.CACHE_NUMBER }} | |
id: cache | |
- name: Update environment | |
run: mamba env update -n vasp -f environment.yml | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Install VaSP | |
run: python3 -m pip install --editable .[test] | |
- name: Run tests | |
run: python3 -m pytest -n 2 tests | |
- name: Upload coverage report to codecov | |
if: matrix.os == 'ubuntu-latest' | |
uses: codecov/codecov-action@v4 | |
with: | |
token: ${{ secrets.CODECOV_TOKEN }} | |
files: ./coverage.xml | |
fail_ci_if_error: false | |
verbose: true | |
# Original workflow authored by Henrik Kjeldsberg | |
# Source Repository: https://github.com/KVSlab/VaMPy/ |