Skip to content

Commit

Permalink
Merge pull request #14 from jdoiro3/dev
Browse files Browse the repository at this point in the history
Nav Imports Within Sections
  • Loading branch information
jdoiro3 authored Apr 1, 2022
2 parents cc12b97 + 1eae27e commit 38ef17c
Show file tree
Hide file tree
Showing 32 changed files with 247 additions and 199 deletions.
39 changes: 29 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,29 +13,48 @@ on:
workflow_dispatch:

jobs:
test:
name: Test on Python ${{ matrix.python-version }}
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v3
with:
python-version: '3.7'
- name: Install Git
run: sudo apt-get install git
- name: Install Python dependencies
run: sudo ./__tests__/setup-pip.sh
- name: Linter
run: sudo ./__tests__/linter.sh
- name: Unittests
run: sudo python3 -m unittest tests.unittests -v

integration-tests:
needs: unit-tests
name: Integration Tests on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest

strategy:
matrix:
python-version: [3, 3.6, 3.7]

steps:
- uses: actions/checkout@master
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@master
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Bats
run: sudo ./__tests__/setup-bats.sh
run: ./__tests__/setup-bats.sh
- name: Install Python dependencies
run: sudo ./__tests__/setup-pip.sh
- name: Linter, Integration and Unit Tests
run: sudo ./__tests__/test-ci.sh
run: ./__tests__/setup-pip.sh
- name: Integration Tests
run: ./__tests__/test-bats-ci.sh

publish:
needs: test
needs: integration-tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@main
Expand Down
55 changes: 37 additions & 18 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,42 @@ on:
workflow_dispatch:

jobs:
test:
name: Test on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest
unit-tests:
name: Unit Tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Set up Python 3.7
uses: actions/setup-python@v3
with:
python-version: '3.7'
- name: Install Git
run: sudo apt-get install git
- name: Install Python dependencies
run: sudo ./__tests__/setup-pip.sh
- name: Linter
run: sudo ./__tests__/linter.sh
- name: Unittests
run: sudo python3 -m unittest tests.unittests -v

strategy:
matrix:
python-version: [3, 3.6, 3.7]
integration-tests:
needs: unit-tests
name: Integration Tests on Python ${{ matrix.python-version }}
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@master
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@master
with:
python-version: ${{ matrix.python-version }}
- name: Install Bats
run: sudo ./__tests__/setup-bats.sh
- name: Install Python dependencies
run: sudo ./__tests__/setup-pip.sh
- name: Linter, Integration and Unit Tests
run: sudo ./__tests__/test-ci.sh
strategy:
matrix:
python-version: [3, 3.6, 3.7]

steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v3
with:
python-version: ${{ matrix.python-version }}
- name: Install Bats
run: ./__tests__/setup-bats.sh
- name: Install Python dependencies
run: ./__tests__/setup-pip.sh
- name: Integration Tests
run: ./__tests__/test-bats-ci.sh
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
# Mac files
*.DS_Store

# Byte-compiled / optimized / DLL files
__pycache__/
*.py[cod]
Expand Down
3 changes: 0 additions & 3 deletions __tests__/fixtures/ok-nav-complex/docs/index.md

This file was deleted.

11 changes: 0 additions & 11 deletions __tests__/fixtures/ok-nav-complex/docs/mkdocs.yml

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions __tests__/fixtures/ok-nav-complex/docs/section1/index.md

This file was deleted.

This file was deleted.

3 changes: 0 additions & 3 deletions __tests__/fixtures/ok-nav-complex/docs/section2/index.md

This file was deleted.

3 changes: 0 additions & 3 deletions __tests__/fixtures/ok-nav-simple/docs/index.md

This file was deleted.

4 changes: 0 additions & 4 deletions __tests__/fixtures/ok-nav-simple/docs/mkdocs.yml

This file was deleted.

3 changes: 0 additions & 3 deletions __tests__/fixtures/ok-no-nav/docs/index.md

This file was deleted.

This file was deleted.

This file was deleted.

2 changes: 1 addition & 1 deletion __tests__/fixtures/parent-config-test/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ site_name: Test

nav:
- Home: index.md
- Section: '!import file://$(cd ../../ && pwd)/ok-with-diff-config-name-and-location?config=multirepo.yml'
- section: '!import https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=ok-with-diff-config-nm-and-loc?config=multirepo.yml'

plugins:
- multirepo

This file was deleted.

10 changes: 0 additions & 10 deletions __tests__/fixtures/parent-multiple-nav-imports-github/mkdocs.yml

This file was deleted.

11 changes: 9 additions & 2 deletions __tests__/fixtures/parent-multiple-nav-imports/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,15 @@ site_name: Test

nav:
- Home: index.md
- ok-nav-simple: '!import file://$(cd ../../ && pwd)/ok-nav-simple'
- ok-nav-complex: '!import file://$(cd ../../ && pwd)/ok-nav-complex'
- ok-nav-simple: '!import https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=ok-nav-simple'
- ok-nav-complex: '!import https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=ok-nav-complex'
- section:
- ok-nav-simple2: '!import https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=ok-nav-simple'
- ok-nav-complex2: '!import https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=ok-nav-complex'
- deepImport:
- subsection1:
- subsection2:
- ok-nav-simple3: '!import https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=ok-nav-simple'

plugins:
- multirepo
2 changes: 1 addition & 1 deletion __tests__/fixtures/parent-with-nav/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ site_name: Test

nav:
- Home: index.md
- ok-nav-simple: '!import file://$(cd ../../ && pwd)/ok-nav-simple'
- ok-nav-simple: '!import https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=ok-nav-simple'

plugins:
- multirepo
Expand Down
6 changes: 3 additions & 3 deletions __tests__/fixtures/parent-with-repos/mkdocs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ plugins:
- multirepo:
repos:
- section: ok-nav-simple
import_url: file://$(cd ../../ && pwd)/ok-nav-simple
import_url: https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=ok-nav-simple
- section: ok-no-nav
import_url: file://$(cd ../../ && pwd)/ok-no-nav
import_url: https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=ok-no-nav
- section: ok-nav-complex
import_url: file://$(cd ../../ && pwd)/ok-nav-complex
import_url: https://github.com/jdoiro3/mkdocs-multirepo-demoRepo1?branch=ok-nav-complex
8 changes: 8 additions & 0 deletions __tests__/linter.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
#!/bin/bash

# Lint via flake8
printf "Running flake8 linter -------->\n"
printf "flake8 count for E9,F63,F7,F82: "
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=setup.py,env
printf "flake8 count for max-complexity=10: "
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=setup.py,env,tests
3 changes: 2 additions & 1 deletion __tests__/setup-pip.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
#!/bin/bash

python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r requirements.txt
pip install -e . --quiet >&2
12 changes: 1 addition & 11 deletions __tests__/test-ci.sh → __tests__/test-bats-ci.sh
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
#!/bin/bash

# Lint via flake8
printf "Running flake8 linter -------->\n"
printf "flake8 count for E9,F63,F7,F82: "
flake8 . --count --select=E9,F63,F7,F82 --show-source --statistics --exclude=setup.py,env
printf "flake8 count for max-complexity=10: "
flake8 . --count --exit-zero --max-complexity=10 --max-line-length=127 --statistics --exclude=setup.py,env,tests

# End-to-end testing via Bats (Bash automated tests)
GITHUB_ACTIONS_E2E_PATH="/home/runner/work/mkdocs-multirepo-plugin/mkdocs_multirepo_plugin/__tests__/test.bats"
LOCAL_E2E_PATH="./__tests__/test.bats"
Expand All @@ -18,7 +11,4 @@ elif [[ -f "$LOCAL_E2E_PATH" ]]; then
else
echo "Could not find the test.bats file. Please check /__tests__/test-ci.sh and correct the paths."
exit 1
fi

# Running unit-tests
python3 -m unittest tests.unittests
fi
Loading

0 comments on commit 38ef17c

Please sign in to comment.