Skip to content

Commit

Permalink
align with cruft template
Browse files Browse the repository at this point in the history
  • Loading branch information
malmans2 committed Jul 18, 2022
1 parent ef68818 commit b537d1b
Show file tree
Hide file tree
Showing 24 changed files with 814 additions and 19 deletions.
16 changes: 16 additions & 0 deletions .cruft.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
{
"template": "https://github.com/ecmwf-projects/cookiecutter-conda-package",
"commit": "fa22e97dff1a88de1834d9deba827197b081fe29",
"checkout": null,
"context": {
"cookiecutter": {
"project_name": "callcache",
"project_slug": "callcache",
"project_short_description": "Efficiently cache calls to functions",
"copyright_holder": "B-Open Solutions srl",
"copyright_year": "2019",
"_template": "https://github.com/ecmwf-projects/cookiecutter-conda-package"
}
},
"directory": null
}
6 changes: 6 additions & 0 deletions .github/cruft-update-template.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
title: Weekly update rejection
labels: cruft-update
---
`cruft` was not able to automatically update the cookiecutter template.
Please run locally `make template-update` and resolve the conflicts before pushing to GitHub.
140 changes: 140 additions & 0 deletions .github/workflows/on-push.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,140 @@
name: on-push

on:
push:
branches:
- main
tags:
- '*'
pull_request:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

defaults:
run:
shell: bash -l {0}

jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: pre-commit/[email protected]

unit-tests:
name: unit-tests (3.10)
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@v12
with:
environment-file: environment.yml
environment-name: DEVELOP
channels: conda-forge
cache-env: true
extra-specs: |
python=3.10
- name: Install package
run: |
python -m pip install --no-deps -e .
- name: Run tests
run: |
make unit-tests
type-check:
needs: [unit-tests]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@v12
with:
environment-file: environment.yml
environment-name: DEVELOP
channels: conda-forge
cache-env: true
extra-specs: |
python=3.10
- name: Install package
run: |
python -m pip install --no-deps -e .
- name: Run code quality checks
run: |
make type-check
docs-build:
needs: [unit-tests]
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@v12
with:
environment-file: environment.yml
environment-name: DEVELOP
channels: conda-forge
cache-env: true
extra-specs: |
python=3.10
- name: Install package
run: |
python -m pip install --no-deps -e .
- name: Build documentation
run: |
make docs-build
integration-tests:
needs: [unit-tests]
runs-on: ubuntu-latest

strategy:
matrix:
include:
- python-version: '3.10'
extra: -minver

steps:
- uses: actions/checkout@v3
- name: Install Conda environment with Micromamba
uses: mamba-org/provision-with-micromamba@v12
with:
environment-file: environment${{ matrix.extra }}.yml
environment-name: DEVELOP${{ matrix.extra }}
channels: conda-forge
cache-env: true
extra-specs: |
python=${{matrix.python-version }}
- name: Install package
run: |
python -m pip install --no-deps -e .
- name: Run tests
run: |
make unit-tests
distribution:
runs-on: ubuntu-latest
needs: [integration-tests, type-check, docs-build]

steps:
- uses: actions/checkout@v3
- name: Build distributions
run: |
$CONDA/bin/python -m pip install build
$CONDA/bin/python -m build
- name: Publish a Python distribution to PyPI
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags')
uses: pypa/gh-action-pypi-publish@release/v1
with:
user: __token__
password: ${{ secrets.PYPI_API_TOKEN }}
37 changes: 37 additions & 0 deletions .github/workflows/weekly.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: weekly
on:
schedule:
- cron: 0 0 * * 1
jobs:
auto-update:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-python@v4
with:
python-version: 3.x
- uses: pre-commit/[email protected]
id: update
with:
extra_args: -c .pre-commit-config-weekly.yaml --all-files
- uses: andstor/file-existence-action@v1
if: failure()
id: check_files
with:
files: '*.rej'
- name: Open PR
if: failure() && (steps.check_files.outputs.files_exists == 'false')
uses: peter-evans/create-pull-request@v4
with:
title: weekly update
labels: |
cruft-update
- name: Open Issue
if: failure() && (steps.check_files.outputs.files_exists == 'true')
uses: JasonEtco/create-an-issue@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
filename: .github/cruft-update-template.md
update_existing: true
search_existing: open
Loading

0 comments on commit b537d1b

Please sign in to comment.