-
Notifications
You must be signed in to change notification settings - Fork 35
85 lines (81 loc) · 2.95 KB
/
govcookiecutter-template-build.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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
name: govcookiecutter template build
on: [ pull_request ]
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.8, 3.9, '3.10' ]
R:
- {using_R: No, version: N/A}
- {using_R: Yes, version: 4.1.3}
- {using_R: Yes, version: 4.2.2}
steps:
- name: Checkout the revision
uses: actions/checkout@v3
with:
path: ga-govcookiecutter
- name: Set up Python ${{ matrix.python }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python }}
- name: Install R ${{ matrix.R.version }}
uses: r-lib/actions/setup-r@v2
with:
r-version: ${{ matrix.R.version }}
if: ${{ matrix.R.using_r == 'Yes' }}
- name: Install other ${{ matrix.os }} R dependencies
run: |
sudo apt-get update
sudo apt-get install libcurl4-openssl-dev
sudo apt-get install libgit2-dev
sudo apt-get install libharfbuzz-dev
sudo apt-get install libfribidi-dev
if: ${{ matrix.os == 'ubuntu-latest' && matrix.R.using_R == 'Yes' }}
- name: Install extra macos R dependencies
run: |
brew install harfbuzz
brew install fribidi
if: ${{ matrix.os == 'macos-latest' && matrix.R.using_R == 'Yes' }}
- 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 govcookiecutter for this commit
run: cookiecutter ga-govcookiecutter --no-input repo_name=example using_R=${{ matrix.R.using_R }}
shell: bash
- name: Install requirements, and pre-commit hooks, and check Sphinx build
run: |
cd example
git init
git add .
if [[ "$RUNNER_OS" == "Linux" || "$RUNNER_OS" == "macOS" ]]; then
make docs
elif [ "$RUNNER_OS" == "Windows" ]; then
pip install -U pip setuptools
pip install -e .[dev]
pre-commit install
sphinx-build -b html ./docs ./docs/_build
else
echo "$RUNNER_OS not supported"
exit 1
fi;
shell: bash
- name: Run pre-commit hooks
run: |
cd example
pre-commit run --all-files
# TODO: Currently no tests - this gives exit code 5, which fails CI, so commenting out for now
# pytest