-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #16 from FrankMaverick/main
Controlli automatici - pre-commit, test, GitHub Actions
- Loading branch information
Showing
19 changed files
with
839 additions
and
100 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [ "main", "master" ] | ||
pull_request: | ||
branches: [ "main", "master" ] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Set up Python | ||
uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
|
||
- name: Install dependencies | ||
run: | | ||
python -m pip install --upgrade pip | ||
pip install requests | ||
pip install pytest | ||
- name: Run tests | ||
run: pytest -s ./tests/ |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
|
||
name: Validate | ||
|
||
# Controls when the action will run. | ||
on: | ||
# Triggers the workflow on push or pull request events but only for the main branch | ||
push: | ||
branches: [ "main", "master" ] | ||
pull_request: | ||
branches: [ "main", "master"] | ||
|
||
# Allows you to run this workflow manually from the Actions tab | ||
workflow_dispatch: | ||
|
||
# A workflow run is made up of one or more jobs that can run sequentially or in parallel | ||
jobs: | ||
pre-commit-hooks: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
- uses: actions/setup-python@v5 | ||
with: | ||
python-version: '3.11' | ||
architecture: 'x64' | ||
- name: Run a script | ||
run: |- | ||
pip install pre-commit | ||
pip install rdflib | ||
pre-commit autoupdate | ||
pre-commit run --all-files --verbose |
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
# | ||
# Define running hooks. | ||
# | ||
|
||
- id: check-repo-structure | ||
name: Check Repository Structure | ||
description: |- | ||
Check whether the directory structure is correct | ||
- assets/ontologies/* | ||
- assets/controlled-vocabularies/* | ||
- assets/schemas/* | ||
entry: check_repo_structure | ||
args: ["assets/controlled-vocabularies/", "assets/ontologies/", "assets/schemas/"] | ||
language: python | ||
files: ^assets/.* | ||
pass_filenames: false | ||
types: [file] | ||
|
||
- id: check-filename-format | ||
name: Check Filename Format | ||
description: |- | ||
Check whether file and directory names follow the specified format (^[\\.a-z0-9 _-]{1,64}$) | ||
entry: check_filename_format | ||
args: ["assets/controlled-vocabularies/", "assets/ontologies/", "assets/schemas/"] | ||
language: python | ||
files: ^assets/.* | ||
pass_filenames: false | ||
types: [file] | ||
|
||
- id: check-filenames-match-uri | ||
name: Check Filename match URI | ||
description: |- | ||
Checks whether the name of each TTL or oas3.yaml file matches the final part of its relative URI | ||
entry: check_filename_match_uri | ||
args: ["assets/controlled-vocabularies/", "assets/ontologies/", "assets/schemas/"] | ||
language: python | ||
files: ^assets/.* | ||
pass_filenames: false | ||
types: [file] | ||
additional_dependencies: [rdflib] | ||
|
||
- id: check-filenames-match-directories | ||
name: Check Filename match Directories | ||
description: |- | ||
Check if filenames match the containing directory names | ||
entry: check_filenames_match_directories | ||
args: ["assets/controlled-vocabularies/", "assets/ontologies/", "assets/schemas/"] | ||
language: python | ||
files: ^assets/.* | ||
pass_filenames: false | ||
types: [file] | ||
|
||
- id: check-supported-files | ||
name: Check encoding and file suffix | ||
entry: check_supported_files | ||
description: |- | ||
Checks the leaf directories of the specified root directories | ||
to ensure that each leaf directory contains at least one .ttl file in UTF-8 format. | ||
args: ["assets/controlled-vocabularies/", "assets/ontologies/", "assets/schemas/"] | ||
language: python | ||
files: ^assets/.* | ||
pass_filenames: false | ||
types: [file] | ||
|
||
- id: check-versioning-pattern | ||
name: Check versioning pattern | ||
entry: check_versioning_pattern | ||
description: |- | ||
Check if the versioning pattern is correct for leaf directories | ||
args: ["assets/controlled-vocabularies/", "assets/ontologies/", "assets/schemas/"] | ||
language: python | ||
files: ^assets/.* | ||
pass_filenames: false | ||
types: [file] |
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
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,20 @@ | ||
version: '3.9' | ||
version: '3.10' | ||
|
||
services: | ||
checkout: &baseline | ||
image: alpine/git | ||
volumes: | ||
- ./_deleteme:/code | ||
working_dir: /code | ||
entrypoint: ["git"] | ||
command: >- | ||
clone https://github.com/teamdigitale/dati-semantic-cookiecutter.git . | ||
zero: | ||
ci-precommit: | ||
build: | ||
context: ./ | ||
context: . | ||
dockerfile: tests/Dockerfile.precommit | ||
volumes: | ||
- ./_deleteme:/code | ||
working_dir: /code | ||
entrypoint: ['pre-commit'] | ||
command: ['run', '-a'] | ||
depends_on: | ||
- checkout | ||
one: | ||
<<: *baseline | ||
image: busybox | ||
command: ['sh', '-c', 'exit 0'] | ||
depends_on: | ||
- zero | ||
- .:/app | ||
working_dir: /app | ||
entrypoint: 'pre-commit run --all-files --verbose' | ||
|
||
ci-pytest: | ||
build: | ||
context: . | ||
dockerfile: tests/Dockerfile.pytest | ||
volumes: | ||
- .:/app | ||
working_dir: /app | ||
entrypoint: 'pytest -s ./tests/' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
pytest==8.1.1 | ||
pre-commit==3.6.0 | ||
requests==2.31.0 | ||
rdflib==7.0.0 |
Empty file.
Oops, something went wrong.