-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (57 loc) · 1.69 KB
/
build_template.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: build-experiment-template
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
template-build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
# TODO: Fix R pre-commit hook issues with Windows
os: [ ubuntu-latest, macos-latest ]
python: ['3.10']
steps:
- name: Checkout the revision
uses: actions/checkout@v3
with:
path: cpr-experiment-template
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install cookiecutter
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
# TODO: Add pip alternative, as Ubuntu 20.04LTS not currently supported (June 2021)
sudo apt-get install cookiecutter || pip install cookiecutter
elif [ "$RUNNER_OS" == "macOS" ]; then
brew install cookiecutter
elif [ "$RUNNER_OS" == "Windows" ]; then
pip install cookiecutter
else
echo "$RUNNER_OS not supported"
exit 1
fi;
shell: bash
- name: Create project from experiment template for this commit
run: cookiecutter cpr-experiment-template --no-input repo_name=example
shell: bash
- name: Install requirements and pre-commit hooks
run: |
python -m pip install "poetry==1.3.2"
cd example
make install
shell: bash
- name: Run pre-commit hooks
run: |
cd example
git add .
poetry run pre-commit run --all-files
- name: Run tests
run: |
cd example
make test