Skip to content

Commit 31d7552

Browse files
committed
Added GH Actions
1 parent cd59e5c commit 31d7552

File tree

4 files changed

+128
-0
lines changed

4 files changed

+128
-0
lines changed
Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Build and test [Python 3.10, 3.11]
2+
3+
on: [push, pull_request]
4+
5+
jobs:
6+
build:
7+
runs-on: ${{ matrix.os }}
8+
strategy:
9+
matrix:
10+
os: [ubuntu-latest, macos-latest, windows-latest]
11+
python-version: ["3.10", "3.11"]
12+
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
with:
17+
persist-credentials: false
18+
19+
- name: Setup Miniconda using Python ${{ matrix.python-version }}
20+
uses: conda-incubator/setup-miniconda@v2
21+
with:
22+
miniforge-variant: Mambaforge
23+
auto-update-conda: true
24+
activate-environment: compmethods-dev
25+
environment-file: environment.yml
26+
python-version: ${{ matrix.python-version }}
27+
auto-activate-base: false
28+
29+
- name: Build
30+
shell: bash -l {0}
31+
run: |
32+
pip install -e .
33+
pip install pytest-cov
34+
pip install pytest-pycodestyle
35+
- name: Test
36+
shell: bash -l {0}
37+
working-directory: ./
38+
run: |
39+
pytest -m 'not local' --cov=./ --cov-report=xml
40+
- name: Upload coverage to Codecov
41+
uses: codecov/codecov-action@v3
42+
with:
43+
files: ./coverage.xml
44+
flags: unittests
45+
name: codecov-umbrella
46+
fail_ci_if_error: true
47+
verbose: true

.github/workflows/check_format.yml

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
2+
name: Check code formatting
3+
4+
on: [push, pull_request]
5+
6+
jobs:
7+
lint:
8+
runs-on: ubuntu-latest
9+
steps:
10+
- uses: actions/checkout@v4
11+
- uses: actions/setup-python@v4
12+
- uses: psf/black@stable
13+
with:
14+
options: "-l 79 --check"
15+
src: "."

.github/workflows/deploy_docs.yml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Build and Deploy Jupyter Book documentation
2+
on:
3+
push:
4+
branches:
5+
- main
6+
jobs:
7+
build-and-deploy:
8+
if: github.repository == 'OpenSourceEcon/CompMethods'
9+
runs-on: ubuntu-latest
10+
steps:
11+
- name: Checkout
12+
uses: actions/checkout@v4
13+
with:
14+
persist-credentials: false
15+
16+
- name: Setup Miniconda
17+
uses: conda-incubator/setup-miniconda@v2
18+
with:
19+
miniforge-variant: Mambaforge
20+
activate-environment: compmethods-dev
21+
environment-file: environment.yml
22+
python-version: "3.10"
23+
auto-activate-base: false
24+
25+
- name: Build # Build Jupyter Book
26+
shell: bash -l {0}
27+
run: |
28+
pip install -e .
29+
python -m ipykernel install --user --name=compmethods-dev
30+
cd docs
31+
jb build ./book
32+
33+
- name: Deploy
34+
uses: JamesIves/github-pages-deploy-action@v4
35+
with:
36+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
37+
BRANCH: gh-pages # The branch the action should deploy to.
38+
FOLDER: docs/book/_build/html # The folder the action should deploy.

.github/workflows/docs_check.yml

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
name: Check that docs build
2+
on: [push, pull_request]
3+
4+
jobs:
5+
build:
6+
runs-on: ubuntu-latest
7+
steps:
8+
- name: Checkout
9+
uses: actions/checkout@v4
10+
with:
11+
persist-credentials: false
12+
13+
- name: Setup Miniconda
14+
uses: conda-incubator/setup-miniconda@v2
15+
with:
16+
miniforge-variant: Mambaforge
17+
activate-environment: compmethods-dev
18+
environment-file: environment.yml
19+
python-version: "3.10"
20+
auto-activate-base: false
21+
22+
- name: Build # Build Jupyter Book
23+
shell: bash -l {0}
24+
run: |
25+
pip install -e .
26+
python -m ipykernel install --user --name=compmethods-dev
27+
cd docs
28+
jb build ./book

0 commit comments

Comments
 (0)