Skip to content

Bump actions/checkout from 3 to 4 #340

Bump actions/checkout from 3 to 4

Bump actions/checkout from 3 to 4 #340

Workflow file for this run

name: CI - Tests
on:
pull_request:
push:
branches:
- main
- 'push-action/**'
jobs:
pre-commit:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
while IFS="" read -r line || [ -n "${line}" ]; do
if [[ "${line}" =~ ^pre-commit.*$ ]]; then
pre_commit="${line}"
fi
done < requirements_dev.txt
while IFS="" read -r line || [ -n "${line}" ]; do
if [[ "${line}" =~ ^invoke.*$ ]]; then
invoke="${line}"
fi
done < requirements_docs.txt
pip install ${pre_commit} ${invoke}
- name: Test with pre-commit
run: SKIP=pylint pre-commit run --all-files
pylint-safety:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
pip install -r requirements.txt -r requirements_docs.txt -r requirements_dev.txt
pip install safety
- name: Run pylint
run: pylint --rcfile=pyproject.toml *.py turtle_canon
- name: Run safety
# Remove ignoring 48547 as soon as RDFLib/rdflib#1844 has been fixed and the fix
# has been released.
run: pip freeze | safety check --stdin -i 48547
pytest:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install python dependencies
run: |
python -m pip install -U pip
pip install -U setuptools wheel
pip install -e .[dev]
- name: Test with pytest
run: pytest -vvv --cov-report=xml
- name: Upload coverage to Codecov
if: github.repository == 'CasperWA/turtle-canon'
uses: codecov/codecov-action@v3
with:
name: turtle-canon
files: ./coverage.xml
flags: turtle-canon
build-package:
name: Build source distribution
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Check build and install source distribution
uses: CasperWA/check-sdist-action@v1
docs:
name: Documentation
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 2
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
pip install -e .[docs]
- name: Build
run: |
invoke create-api-reference-docs --pre-clean
invoke create-docs-index
mkdocs build --strict --verbose
as-pre-commit-hook:
name: As a pre-commit hook
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set up Python 3.9
uses: actions/setup-python@v4
with:
python-version: "3.9"
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install -U setuptools wheel
while IFS="" read -r line || [ -n "${line}" ]; do
if [[ "${line}" =~ ^pre-commit.*$ ]]; then
pre_commit="${line}"
fi
done < requirements_dev.txt
pip install ${pre_commit}
- name: Set 'rev' to current commit SHA
run: sed -i "s|COMMIT_SHA|${GITHUB_SHA}|" .github/utils/.pre-commit-config.yaml
- name: Test pre-commit hook
run: pre-commit run -c .github/utils/.pre-commit-config.yaml --all-files --verbose && exit 1 || exit 0
- name: Check files
run: |
if [ -z "$(git status --porcelain tests)" ]; then
echo "Turtle Canon didn't canonize any files under tests/ !"
exit 1
fi
if [ -n "$(git status --porcelain tests/static/rdflib_canonized)" ]; then
echo "Turtle Canon canonized already canonized files under tests/static/rdflib_canonized !"
exit 1
fi
# Now everything should run fine
pre-commit run -c .github/utils/.pre-commit-config.yaml --all-files