Skip to content

Commit c23d0a8

Browse files
Merge branch 'flexlate-templates-new-repo-structure' into flexlate-output-new-repo-structure
2 parents 2f867bb + 2cce3c7 commit c23d0a8

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+2553
-581
lines changed

.commitlintrc.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
extends:
2+
- "@commitlint/config-conventional"
3+
4+
rules:
5+
subject-case: [2, "always", ["sentence-case"]]
6+
footer-max-line-length: [0, "always", 100]
7+
footer-max-length: [0, "always", 100]
8+
header-max-length: [0, "always", 100]

.flake8

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[flake8]
2+
exclude = .git,.nox,__pycache__,dist,docs,docsrc/source/conf.py
Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
name: Build and Deploy Docs
2+
description: "Installs docs-specific dependencies, builds the docs, and deploys them. Be sure to run install-dependencies first"
3+
inputs:
4+
gh-token:
5+
required: true
6+
description: "The GitHub token to use for authentication."
7+
runs:
8+
using: composite
9+
steps:
10+
- name: Install docs-specific dependencies
11+
shell: bash
12+
run: |
13+
sudo apt-get install pandoc -y
14+
# Need to set Git committer to run terminal examples in docs
15+
- name: Set Git Committer
16+
shell: bash
17+
run: |
18+
git config --global user.email "flexlate-git@nickderobertis.com"
19+
git config --global user.name "flexlate-git"
20+
git config --global init.defaultBranch main
21+
- name: Build Documentation
22+
shell: bash
23+
run: |
24+
pipenv run nox -s docs
25+
echo "" > docs/.nojekyll
26+
- name: Deploy Documentation
27+
uses: peaceiris/actions-gh-pages@v2.5.0
28+
env:
29+
GITHUB_TOKEN: ${{ inputs.gh-token }}
30+
PUBLISH_BRANCH: gh-pages
31+
PUBLISH_DIR: ./docs
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Install Python Dependencies
2+
description: "Installs Python dependencies for the project."
3+
inputs:
4+
python-version:
5+
required: true
6+
description: "The Python version to install dependencies for."
7+
runs:
8+
using: composite
9+
steps:
10+
- name: Install pipenv
11+
shell: bash
12+
run: pipx install pipenv
13+
- name: Set up Python ${{ matrix.python-version }}
14+
uses: actions/setup-python@v3
15+
with:
16+
python-version: ${{ matrix.python-version }}
17+
cache: pipenv
18+
- uses: actions/cache@v3
19+
name: Cache global dependencies
20+
with:
21+
path: ${{ env.pythonLocation }}
22+
key: ${{ env.pythonLocation }}-${{ hashFiles('*-requirements.txt') }}
23+
- name: Install main dependencies
24+
shell: bash
25+
run: |
26+
pipenv --python ${{ matrix.python-version }} sync
27+
- name: Install linting dependencies
28+
shell: bash
29+
run: |
30+
pip install -r lint-requirements.txt
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
name: Lint and Test
2+
description: "Runs isort, black, flake8, mypy, pytest. Be sure to run install-dependencies first"
3+
runs:
4+
using: composite
5+
steps:
6+
- name: Check code formatting, linting, and run tests
7+
shell: bash
8+
run: pipenv run nox
Lines changed: 20 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,20 @@
1+
name: Lint and Test
2+
description: "Runs isort, black, flake8, mypy, pytest. Be sure to run install-dependencies first"
3+
inputs:
4+
codecov-token:
5+
required: true
6+
description: "The codecov token to use for uploading coverage reports."
7+
runs:
8+
using: composite
9+
steps:
10+
- name: Run tests with coverage
11+
shell: bash
12+
run: pipenv run nox -s test_coverage
13+
- name: Upload coverage to Codecov
14+
uses: codecov/codecov-action@v2
15+
with:
16+
token: ${{ inputs.codecov-token }}
17+
file: ./coverage.xml
18+
flags: unittests
19+
name: codecov-pytest
20+
yml: ./codecov.yml

.github/workflows/automerge.yml

Lines changed: 0 additions & 171 deletions
This file was deleted.

.github/workflows/docs.yml

Lines changed: 26 additions & 65 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
1+
12
name: Build and Push Docs
23

34
on:
@@ -9,14 +10,6 @@ on:
910
- master
1011

1112
jobs:
12-
# TODO [#2]: refactor docs workflow once Github Actions improves
13-
#
14-
# Entire jobs are getting copied between workflow files due to limitations in Github Actions
15-
#
16-
# Possible changes to Github Actions that would allow the docs workflow to be refactored:
17-
# - reuse jobs
18-
# - reuse steps
19-
# - trigger workflow from within action/workflow
2013
test:
2114
runs-on: ubuntu-latest
2215
strategy:
@@ -25,38 +18,11 @@ jobs:
2518
python-version: [3.8]
2619

2720
steps:
28-
- uses: actions/checkout@v1
29-
- name: Set up Python ${{ matrix.python-version }}
30-
uses: actions/setup-python@v1
21+
- uses: actions/checkout@v3
22+
- uses: ./.github/actions/install-dependencies
3123
with:
3224
python-version: ${{ matrix.python-version }}
33-
- name: Install Pipenv
34-
uses: dschep/install-pipenv-action@v1
35-
- name: Install dependencies
36-
run: |
37-
pipenv sync
38-
- name: Lint with flake8
39-
run: |
40-
pip install flake8
41-
# stop the build if there are Python syntax errors or undefined names
42-
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics
43-
# exit-zero treats all errors as warnings. The GitHub editor is 127 chars wide
44-
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics
45-
- name: Test with pytest
46-
run: |
47-
pipenv run python -m pytest --cov=./ --cov-report=xml
48-
- name: Upload coverage to Codecov
49-
if: github.ref == 'refs/heads/master'
50-
uses: codecov/codecov-action@v1
51-
with:
52-
token: ${{ secrets.CODECOV_TOKEN }}
53-
file: ./coverage.xml
54-
flags: unittests
55-
name: codecov-pytest
56-
yml: ./codecov.yml
57-
- name: Static Typing Checks with mypy
58-
run: |
59-
pipenv run mypy $(python directory.py)
25+
- uses: ./.github/actions/lint-and-test
6026

6127
deploy:
6228
needs: test
@@ -68,32 +34,27 @@ jobs:
6834
python-version: [3.8]
6935

7036
steps:
71-
- uses: actions/checkout@v1
72-
- name: Set up Python ${{ matrix.python-version }}
73-
uses: actions/setup-python@v1
37+
- uses: actions/checkout@v3
38+
- uses: ./.github/actions/install-dependencies
7439
with:
7540
python-version: ${{ matrix.python-version }}
76-
- name: Install Pipenv
77-
uses: dschep/install-pipenv-action@v1
78-
- name: Install dependencies
79-
run: |
80-
pipenv sync
81-
sudo apt-get install pandoc -y
82-
# Need to set Git committer to run terminal examples in docs
83-
- name: Set Git Committer
84-
run: |
85-
git config --global user.email "flexlate-git@nickderobertis.com"
86-
git config --global user.name "flexlate-git"
87-
git config --global init.defaultBranch main
88-
- name: Build Documentation
89-
run: |
90-
cd docsrc
91-
pipenv run make github
92-
cd ..
93-
echo "" > docs/.nojekyll
94-
- name: Deploy Documentation
95-
uses: peaceiris/actions-gh-pages@v2.5.0
96-
env:
97-
GITHUB_TOKEN: ${{ secrets.gh_token }}
98-
PUBLISH_BRANCH: gh-pages
99-
PUBLISH_DIR: ./docs
41+
- uses: ./.github/actions/build-and-deploy-docs
42+
with:
43+
gh-token: ${{ secrets.GH_TOKEN }}
44+
45+
coverage:
46+
needs: deploy
47+
runs-on: ubuntu-latest
48+
strategy:
49+
max-parallel: 1
50+
matrix:
51+
python-version: [3.8]
52+
steps:
53+
- uses: actions/checkout@v3
54+
- uses: ./.github/actions/install-dependencies
55+
with:
56+
python-version: ${{ matrix.python-version }}
57+
- name: Run coverage and upload to Codecov.io
58+
uses: ./.github/actions/test-coverage
59+
with:
60+
codecov-token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)