roadmap update #308
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 | |
on: | |
workflow_dispatch: | |
push: | |
pull_request: | |
release: | |
types: [published] | |
jobs: | |
Validate-CITATION-cff: | |
runs-on: ubuntu-latest | |
name: Validate CITATION.cff | |
env: | |
RSPM: "https://packagemanager.rstudio.com/cran/__linux__/focal/latest" | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install V8 | |
run: sudo apt-get install -y libv8-dev | |
- name: cff-validator | |
uses: dieghernan/cff-validator@main | |
- name: Upload cff-validator error artifact | |
uses: actions/[email protected] | |
if: failure() | |
with: | |
name: citation-cff-errors | |
path: citation_cff_errors.md | |
checks: | |
name: checks | |
runs-on: ${{ matrix.os }} | |
needs: Validate-CITATION-cff | |
strategy: | |
matrix: | |
python-version: [3.7, 3.8, 3.9] | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python ${{ matrix.python-version }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Setting Python and OS environment variables on Linux and Mac | |
if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }} | |
run: | | |
echo "PYTHON=${{ matrix.python-version }}" >> $GITHUB_ENV | |
echo "OS=${{ runner.os }}" >> $GITHUB_ENV | |
- name: Setting Python and OS environment variables on Windows | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
echo "PYTHON=${{ matrix.python-version }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
echo "OS=${{ runner.os }}" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
- name: Python location | |
run: echo "Python location ${{ env.pythonLocation }}" | |
- name: Cache pip | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.pythonLocation }} | |
key: ${{ runner.os }}-${{ env.pythonLocation }}-pip-${{ hashFiles('**/requirements.txt') }}-${{ hashFiles('**/dev_requirements.txt') }} | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade --upgrade-strategy eager -r requirements.txt -r dev_requirements.txt | |
- name: isort | |
run: isort --check-only pymusas tests scripts | |
- name: flake8 | |
run: | | |
pip list | |
flake8 | |
- name: Cache mypy | |
uses: actions/cache@v2 | |
with: | |
path: ./.mypy_cache | |
key: ${{ runner.os }}-${{ env.pythonLocation }} | |
- name: mypy | |
run: mypy | |
- name: Code coverage testing | |
run: | | |
coverage run | |
- name: Code coverage report | |
run: | | |
coverage report | |
coverage xml | |
- name: CodeCov | |
uses: codecov/codecov-action@v2 | |
with: | |
env_vars: OS,PYTHON | |
fail_ci_if_error: false | |
- name: Set pymusas cache home directory for ubuntu and mac | |
if: ${{ runner.os == 'macOS' || runner.os == 'Linux' }} | |
run: | | |
echo "PYMUSAS_HOME=$HOME/.cache/doc_test_pymusas" >> $GITHUB_ENV | |
- name: Set pymusas cache home directory for windows | |
if: ${{ runner.os == 'Windows' }} | |
run: | | |
echo "PYMUSAS_HOME=$HOME\.cache\doc_test_pymusas" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append | |
- name: Cache Doc Test download files | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.PYMUSAS_HOME }} | |
key: ${{ runner.os }}-${{ env.PYMUSAS_HOME }} | |
- name: Doc Tests | |
run: | | |
coverage run -m pytest --doctest-modules pymusas/ | |
coverage report | |
update-binder-requirements: | |
name: update-binder-requirements | |
needs: checks | |
if: github.ref == 'refs/heads/main' | |
runs-on: ubuntu-latest | |
steps: | |
- name: update env checkout | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: update env commits | |
run: | | |
git branch | |
git checkout binder-main | |
git checkout main binder/environment.yml | |
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
if [ $(git diff-index binder-main | wc -l) -gt 0 ]; then git commit -m "update"; git push origin binder-main; fi | |
publish: | |
name: Publish to PyPI | |
needs: checks | |
runs-on: ubuntu-latest | |
if: github.repository == 'UCREL/pymusas' && github.event_name == 'release' | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install dependencies | |
run: | | |
python -m pip install --upgrade pip | |
pip install --upgrade build twine | |
- name: Build package | |
run: | | |
python -m build | |
- name: Twine check | |
run: python -m twine check --strict dist/* | |
- name: Upload to twine | |
run: | | |
python -m twine upload --repository pypi dist/* | |
env: | |
TWINE_USERNAME: __token__ | |
TWINE_PASSWORD: ${{ secrets.PYPI_API_TOKEN }} |