https://github.com/jackdewinter/pymarkdown/issues/1172 (#1196) #2629
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Main | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
env: | |
project-name: pymarkdown | |
default-python-version: 3.8 | |
jobs: | |
lint: | |
name: Project Quality Analysis | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ env.default-python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ env.default-python-version }} | |
- name: Install PipEnv | |
run: | | |
pip install pipenv==2023.12.1 | |
- name: Sync With Repository | |
run: | | |
pipenv update -d | |
pipenv graph | |
- name: Execute Black | |
run: | | |
pipenv run black . | |
- name: Execute ISort | |
run: | | |
pipenv run isort . | |
- name: Execute Pre-Commit | |
run: | | |
pipenv run pre-commit run --all | |
- name: Execute Flake8 | |
run: pipenv run flake8 --exclude dist,build | |
- name: Execute Bandit | |
run: | | |
pipenv run bandit --configfile bandit.yaml -q -r ${{ github.workspace }}/${{ env.project-name }} | |
- name: Execute PyLint on Source | |
run: | | |
pipenv run pylint ${{github.workspace}}/pymarkdown | |
pipenv run pylint ${{github.workspace}}/pymarkdown/extensions | |
pipenv run pylint ${{github.workspace}}/pymarkdown/extension_manager | |
pipenv run pylint ${{github.workspace}}/pymarkdown/plugins | |
pipenv run pylint ${{github.workspace}}/pymarkdown/plugin_manager | |
- name: Execute PyLint on Tests | |
run: pipenv run pylint ${{github.workspace}}/test | |
- name: Execute MyPy | |
run: pipenv run mypy --strict ${{ env.project-name }} stubs | |
- name: Execute PyMarkdown on Current Docs | |
run: pipenv run python ${{github.workspace}}/main.py --config ${{github.workspace}}/clean.json scan ${{github.workspace}} ${{github.workspace}}/docs | |
doc-lint: | |
name: Document Quality Analysis | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ env.default-python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ env.default-python-version }} | |
- name: Install PipEnv | |
run: | | |
pip install pipenv==2023.12.1 | |
- name: Sync With Repository | |
run: | | |
pipenv update -d | |
pipenv graph | |
- name: Execute PyMarkdown on NewDocs | |
run: | | |
pipenv run python main.py --config newdocs/clean.json scan newdocs/src | |
# - name: Execute MdFormat on Docs | |
# run: | | |
# cd newdocs | |
# pipenv run mdformat --align-semantic-breaks-in-lists --wrap 80 --check . | |
scenario-tests: | |
name: Scenario Tests | |
strategy: | |
matrix: | |
# python: ["3.8", "3.9", "3.10"] | |
python: ["3.8"] | |
platform: [windows-latest, ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.platform }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ matrix.python }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Install PipEnv | |
run: | | |
pip install pipenv==2023.12.1 | |
- name: Sync With Repository | |
run: | | |
pipenv update -d | |
pipenv graph | |
pipenv uninstall pytest-html | |
- name: Execute Tests | |
run: pipenv run pytest --cov-fail-under=90 --cov --cov-branch --cov-report xml:report/coverage.xml | |
- name: Archive coverage artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.platform }} Coverage | |
path: | | |
./report/coverage.xml | |
- name: Report Coverage | |
uses: codecov/codecov-action@v4 | |
if: github.event_name != 'schedule' | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
with: | |
file: ./report/coverage.xml | |
name: ${{ matrix.python }} - ${{ matrix.platform }} | |
fail_ci_if_error: true | |
packaging: | |
name: Package Application | |
runs-on: ubuntu-latest | |
needs: [ doc-lint, lint, scenario-tests ] | |
# if: github.ref == 'refs/heads/main' && github.event_name == 'push' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
- name: Setup Python ${{ env.default-python-version }} | |
uses: actions/[email protected] | |
with: | |
python-version: ${{ env.default-python-version }} | |
- name: Install PipEnv | |
run: | | |
pip install pipenv==2023.12.1 | |
- name: Sync With Repository | |
run: | | |
pipenv update -d | |
pipenv graph | |
- name: Pyroma | |
run: | | |
pipenv run pyroma -q -n 10 . | |
- name: Setup | |
run: | | |
pipenv run python setup.py sdist bdist_wheel | |
- name: Twine | |
run: | | |
pipenv run twine check dist/* | |
- name: Upload Package | |
uses: actions/upload-artifact@v4 | |
with: | |
name: my-artifact | |
path: ${{github.workspace}}/dist/ | |
- name: Initiating Integration Tests | |
env: | |
GITHUB_CONTEXT: ${{ toJson(github) }} | |
run: | | |
ACTION_SHA= | |
if [ "${{ github.event_name }}" == "pull_request" ] ; then | |
ACTION_SHA=${{ github.event.pull_request.head.sha }} | |
elif [ "${{ github.event_name }}" == "push" ] ; then | |
ACTION_SHA=${{ github.event.head_commit.id }} | |
else | |
echo "$GITHUB_CONTEXT" | |
ACTION_SHA=$GITHUB_SHA | |
fi | |
ACTION_RUN_ID=${{ github.run_id }} | |
ACCESS_TOKEN=${{ secrets.INTER_PROJECT_ACCESS_TOKEN }} | |
if [ -z "$ACCESS_TOKEN" ] ; then | |
echo "Secret 'INTER_PROJECT_ACCESS_TOKEN' has not been set to a non-empty value." | |
exit 1 | |
else | |
echo "SHA=$ACTION_SHA" | |
echo "RUN_ID=$ACTION_RUN_ID" | |
echo '{"event_type": "request-integration", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'", "ref":"'"$GITHUB_REF"'", "sha": "'"$ACTION_SHA"'", "run_id" : "'"$ACTION_RUN_ID"'" }}' | |
curl -X POST https://api.github.com/repos/jackdewinter/pymarkdown_test/dispatches \ | |
-H 'Accept: application/vnd.github.everest-preview+json' \ | |
-u '${{ secrets.INTER_PROJECT_ACCESS_TOKEN }}' \ | |
--data '{"event_type": "request-integration", "client_payload": { "repository": "'"$GITHUB_REPOSITORY"'", "ref":"'"$GITHUB_REF"'", "sha": "'"$ACTION_SHA"'", "run_id" : "'"$ACTION_RUN_ID"'" }}' | |
fi |