https://github.com/jackdewinter/pymarkdown/issues/1318 (#1319) #2802
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.13 | |
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 lock --clear --python ${{ env.default-python-version }} | |
pipenv sync -d | |
pipenv graph | |
- name: Execute Pre-Commit | |
run: | | |
pipenv run pre-commit run --all | |
- 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 | |
needs: [ lint ] | |
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 lock --clear --python ${{ env.default-python-version }} | |
pipenv sync -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.13"] | |
platform: [windows-latest, ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.platform }} | |
needs: [ lint ] | |
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 lock --clear --python ${{ env.default-python-version }} | |
pipenv sync -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 | |
expanded-scenario-tests: | |
name: Scenario Tests | |
strategy: | |
matrix: | |
python: ["3.9", "3.10", "3.11", "3.12"] | |
platform: [windows-latest, ubuntu-latest, macos-latest] | |
runs-on: ${{ matrix.platform }} | |
needs: [ scenario-tests ] | |
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: | | |
rm Pipfile.lock | |
pipenv lock --clear --python ${{ matrix.python }} | |
pipenv sync -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 | |
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 lock --clear --python ${{ env.default-python-version }} | |
pipenv sync -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 |