Skip to content

Commit 39e0d4b

Browse files
authored
build: add Taskfile with development tasks (#1867)
Added Taskfile with development tasks This patch adds a Taskfile with various tasks that is useful for RDFLib development. Details of the available tasks can be seen from `task help` output and some more information is included in the RDFLib developers guide. For more information about Taskfiles see https://taskfile.dev/#/usage. The GitHub action pipeline was also changed to now use tasks from the Taskfile which simplifies the pipeline quite a bit. This patch also adds development container which can be used to run various development task and which can also be used with development container enabled tools such as VSCode or GitHub codespaces. This is all being done in preperation for moving coveralls reporting to the GitHub actions workflow. Other changes: - Removed the `Makefile` and associated `test/Dockerfile` as it is now replaced by a `Taskfile.yml`.
1 parent ab5d554 commit 39e0d4b

File tree

10 files changed

+441
-117
lines changed

10 files changed

+441
-117
lines changed

.devcontainer.json

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
{
2+
"dockerComposeFile": "docker-compose.yml",
3+
"service": "devcontainer",
4+
"workspaceFolder": "/srv/workspace/",
5+
"shutdownAction": "stopCompose",
6+
"settings": {
7+
"python.linting.mypyEnabled": true,
8+
"python.linting.flake8Enabled": true,
9+
"python.linting.pylintEnabled": false,
10+
"python.formatting.provider": "black"
11+
},
12+
"extensions": [
13+
"ms-python.python",
14+
"redhat.vscode-yaml",
15+
"redhat.vscode-xml",
16+
"stardog-union.stardog-rdf-grammars",
17+
"lextudio.restructuredtext",
18+
"trond-snekvik.simple-rst",
19+
"EditorConfig.EditorConfig",
20+
"paulvarache.vscode-taskfile",
21+
"stardog-union.vscode-stardog-languages"
22+
]
23+
}

.github/workflows/validate.yaml

Lines changed: 15 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,8 @@ env:
1313

1414
jobs:
1515
validate:
16+
permissions:
17+
contents: read
1618
runs-on: ${{ matrix.os }}
1719
strategy:
1820
fail-fast: false
@@ -43,11 +45,6 @@ jobs:
4345
with:
4446
distribution: "temurin"
4547
java-version: "17"
46-
- name: Setup env
47-
shell: bash
48-
run: |
49-
MATRIX_PYTHON_VERSION=${{ matrix.python-version }}
50-
echo "TOX_PYENV=py${MATRIX_PYTHON_VERSION//./}" >> ${GITHUB_ENV}
5148
- name: Get pip cache dir
5249
id: pip-cache
5350
shell: bash
@@ -59,7 +56,7 @@ jobs:
5956
with:
6057
path: ${{ steps.pip-cache.outputs.dir }}
6158
key: ${{ matrix.os }}-pip-${{ matrix.python-version }}-v1-${{
62-
hashFiles('**/setup.py', '**/requirements*.txt') }}
59+
hashFiles('**/setup.py', '**/*requirements*.txt') }}
6360
restore-keys: |
6461
${{ matrix.os }}-pip-${{ matrix.python-version }}-v1-
6562
- name: Cache xdg
@@ -69,38 +66,18 @@ jobs:
6966
key: ${{ matrix.os }}-xdg-v1-${{ hashFiles('**/with-fuseki.sh') }}
7067
restore-keys: |
7168
${{ matrix.os }}-xdg-v1-
72-
- name: Install python dependencies
73-
shell: bash
74-
# Installing tox-gh-actions to get some enhancement to output rendering
75-
# in github actions. Eventually we can maybe collapse the tox-envs job
76-
# into this one but there are some limitations of tox-gh-actions which
77-
# preclude doing that at the moment.
78-
run: |
79-
python -m pip install tox tox-gh-actions
80-
- name: Install system depdendencies for extensive tests
81-
if: ${{ matrix.extensive-tests }}
82-
shell: bash
83-
run: |
84-
if [ "${{ matrix.os }}" == "ubuntu-latest" ]
85-
then
86-
sudo apt-get install -y libdb-dev
87-
elif [ "${{ matrix.os }}" == "macos-latest" ]
88-
then
89-
brew install berkeley-db@4
90-
export BERKELEYDB_DIR=$(brew --prefix berkeley-db@4)
91-
fi
92-
- name: Validate
69+
- name: Install Task
70+
uses: arduino/setup-task@v1
71+
with:
72+
repo-token: ${{ secrets.GITHUB_TOKEN }}
73+
- name: Run validation
9374
shell: bash
9475
run: |
95-
test_harness=()
96-
if "${{ matrix.extensive-tests || false }}" && [ "${{ matrix.os }}" != "windows-latest" ]
97-
then
98-
1>&2 echo "Running with fuseki"
99-
test_harness+="./with-fuseki.sh"
100-
TOX_PYENV_SUFFIX=-extensive
101-
fi
102-
TOXENV="${{ matrix.TOXENV }}"
103-
TOXENV="${TOX_PYENV}${TOX_PYENV_SUFFIX}${TOXENV:+,${TOXENV}}"
104-
export TOXENV
10576
export TOX_EXTRA_COMMAND="${{ matrix.TOX_EXTRA_COMMAND }}"
106-
"${test_harness[@]}" python -m tox
77+
task \
78+
EXTENSIVE=${{ matrix.extensive-tests }} \
79+
TOX_PYTHON_VERSION=${{ matrix.python-version }} \
80+
WITH_GITHUB_ACTIONS=1 \
81+
install:system-deps \
82+
install:tox \
83+
tox

Dockerfile.devcontainer

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
FROM mcr.microsoft.com/vscode/devcontainers/base:ubuntu-22.04
2+
3+
ENV DEBIAN_FRONTEND="noninteractive" TZ="Etc/UTC"
4+
5+
RUN \
6+
apt-get update && \
7+
apt-get install -y \
8+
make \
9+
curl \
10+
git \
11+
build-essential \
12+
&& \
13+
true
14+
15+
RUN \
16+
apt-get install -y \
17+
libdb-dev \
18+
libjpeg-dev \
19+
&& \
20+
true
21+
22+
RUN \
23+
apt-get install -y \
24+
default-jdk \
25+
&& \
26+
true
27+
28+
RUN \
29+
apt-get install -y \
30+
software-properties-common \
31+
&& \
32+
add-apt-repository ppa:deadsnakes/ppa && \
33+
apt-get install -y \
34+
python3 \
35+
python3-pip \
36+
python3-dev \
37+
python3-venv \
38+
python3.7 \
39+
python3.7-dev \
40+
python3.7-venv \
41+
python3.8 \
42+
python3.8-dev \
43+
python3.8-venv \
44+
python3.9 \
45+
python3.9-dev \
46+
python3.9-venv \
47+
python3.10 \
48+
python3.10-dev \
49+
python3.10-venv \
50+
python3.11 \
51+
python3.11-dev \
52+
python3.11-venv \
53+
python-is-python3 \
54+
&& \
55+
python --version && \
56+
true
57+
58+
RUN sh -c "$(curl --location https://taskfile.dev/install.sh)" -- -d -b /usr/local/bin
59+
60+
COPY requirements.txt requirements.dev.txt requirements.dev-extra.txt /var/tmp/
61+
COPY docs/sphinx-requirements.txt /var/tmp/docs/sphinx-requirements.txt
62+
63+
RUN \
64+
cd /var/tmp/ && \
65+
python -m pip install --upgrade \
66+
-r requirements.txt \
67+
-r requirements.dev.txt \
68+
-r requirements.dev-extra.txt \
69+
-r docs/sphinx-requirements.txt \
70+
tox \
71+
&& \
72+
true

Makefile

Lines changed: 0 additions & 20 deletions
This file was deleted.

README.md

Lines changed: 0 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -184,22 +184,6 @@ Run the test suite and generate a HTML coverage report with `pytest` and `pytest
184184
pytest --cov
185185
```
186186

187-
### Running the tests in a Docker container
188-
189-
Run the test suite inside a Docker container for cross-platform support. This resolves issues such as installing BerkeleyDB on Windows and avoids the host and port issues on macOS.
190-
```shell
191-
make tests
192-
```
193-
194-
Tip: If the underlying Dockerfile for the test runner changes, use `make build`.
195-
196-
### Running the tests in a Docker container with coverage report
197-
198-
Run the test suite inside a Docker container with HTML coverage report.
199-
```shell
200-
make coverage
201-
```
202-
203187
### Viewing test coverage
204188

205189
Once tests have produced HTML output of the coverage report, view it by running:

0 commit comments

Comments
 (0)