Skip to content

Fix devcontainer stuff #5

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 5 commits into from
Jan 16, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion .devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,5 +19,6 @@
"EditorConfig.EditorConfig",
"paulvarache.vscode-taskfile",
"stardog-union.vscode-stardog-languages"
]
],
"postCreateCommand": "poetry install --all-extras"
}
8 changes: 4 additions & 4 deletions .github/workflows/validate.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ on:

env:
FORCE_COLOR: 1
XDG_CACHE_HOME: ${{ github.workspace }}/.cache
POETRY_CACHE_DIR: ${{ github.workspace }}/.cache/pypoetry
PIP_CACHE_DIR: ${{ github.workspace }}/.cache/pip
XDG_CACHE_HOME: ${{ github.workspace }}/.var/cache
POETRY_CACHE_DIR: ${{ github.workspace }}/.var/cache/pypoetry
PIP_CACHE_DIR: ${{ github.workspace }}/.var/cache/pip


concurrency:
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
- name: Cache XDG_CACHE_HOME
uses: actions/cache@v3
with:
path: ~/.cache
path: ${{ env.XDG_CACHE_HOME }}
key: ${{ github.job }}-xdg-v1-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pyproject.toml', '**/poetry.lock', '**/with-fuseki.sh', '**/*requirements*.txt') }}
restore-keys: |
${{ github.job }}-xdg-v1-${{ matrix.os }}-${{ matrix.python-version }}-
Expand Down
2 changes: 2 additions & 0 deletions .var/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
*
!.gitignore
3 changes: 3 additions & 0 deletions Dockerfile.devcontainer
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,9 @@ COPY devtools/requirements-poetry.in /var/tmp/
RUN \
python -m pip install --upgrade \
tox \
pre-commit \
-r /var/tmp/requirements-poetry.in \
&& \
true

RUN git config --system --add safe.directory /srv/workspace
2 changes: 2 additions & 0 deletions Taskfile.yml
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,8 @@ tasks:
- task: clean:tox
- task: clean:mypy
- task: venv:clean
- task: _rimraf
vars: { RIMRAF_TARGET: ".var/devcontainer" }

test:data:fetch:
desc: Fetch test data.
Expand Down
31 changes: 20 additions & 11 deletions docker-compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,32 @@ services:
dockerfile: Dockerfile.devcontainer
working_dir: /srv/workspace
environment:
- POETRY_VIRTUALENVS_IN_PROJECT=1
- XDG_CACHE_HOME=/srv/workspace/.var/devcontainer/cache
- MYPY_CACHE_DIR=/srv/workspace/.var/devcontainer/mypy_cache
- TOX_WORK_DIR=/srv/workspace/.var/devcontainer/tox
- PYTEST_ADDOPTS=-o cache_dir=/srv/workspace/.var/devcontainer/pytest_cache
- PRE_COMMIT_HOME=/srv/workspace/.var/devcontainer/pre-commit
volumes:
- .:/srv/workspace:z,cached
- xdg-cache-home:/root/.cache
- dot-venv:/srv/workspace/.venv
- dot-tox:/srv/workspace/.tox
- dot-mypy-cache:/srv/workspace/.mypy_cache
- dot-pytest-cache:/srv/workspace/.pytest_cache
command:
- /bin/sh
- -c
- |
echo Waiting for shutdown... override the command if this is not what you want. 1>&2
while sleep 1000; do :; done
run:
build:
context: .
dockerfile: Dockerfile.devcontainer
working_dir: /srv/workspace
environment:
- XDG_CACHE_HOME=/srv/workspace-var/cache
- MYPY_CACHE_DIR=/srv/workspace-var/mypy_cache
- TOX_WORK_DIR=/srv/workspace-var/tox
- PYTEST_ADDOPTS=-o cache_dir=/srv/workspace-var/pytest_cache
- PRE_COMMIT_HOME=/srv/workspace-var/pre-commit
volumes:
- .:/srv/workspace:z,cached
- workspace-var:/srv/workspace-var
volumes:
xdg-cache-home: {}
dot-venv: {}
dot-tox: {}
dot-mypy-cache: {}
dot-pytest-cache: {}
workspace-var: {}
8 changes: 4 additions & 4 deletions docs/developers.rst
Original file line number Diff line number Diff line change
Expand Up @@ -297,16 +297,16 @@ To use the development container directly:
docker-compose build

# Configure the system for development.
docker-compose run --rm devcontainer task configure
docker-compose run --rm run task configure

# Run the validate task inside the devtools container.
docker-compose run --rm devcontainer task validate
docker-compose run --rm run task validate

# Run extensive tests inside the devtools container.
docker-compose run --rm devcontainer task EXTENSIVE=true test
docker-compose run --rm run task EXTENSIVE=true test

# To get a shell into the devcontainer docker image.
docker-compose run --rm devcontainer bash
docker-compose run --rm run bash

The devcontainer also works with `Podman Compose
<https://github.com/containers/podman-compose>`_.
Expand Down
4 changes: 2 additions & 2 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ exclude = '''
| \.pytest_cache
| \.tox
| \.venv
| \.cache
| \.var
| \.github
| _build
| htmlcov
Expand Down Expand Up @@ -175,7 +175,7 @@ skip = [
'.pytest_cache',
'.tox',
'.venv',
'.cache,',
'.var',
'.github',
'_build',
'htmlcov',
Expand Down
2 changes: 1 addition & 1 deletion setup.cfg
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ exclude =
.git,
__pycache__,
.venv,
.cache,
.var,
.tox,
var,
.mypy_cache,
Expand Down
3 changes: 3 additions & 0 deletions tox.ini
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
envlist =
flake8,py3{7,8,9,10,11},covreport,docs,precommit
isolated_build = True
toxworkdir={env:TOX_WORK_DIR:{tox_root}/.tox}

[testenv]
passenv =
Expand Down Expand Up @@ -81,6 +82,8 @@ skip_install = true
deps = pre-commit
passenv =
HOMEPATH # needed on Windows
PRE_COMMIT_HOME # so that users can configure it
XDG_CACHE_HOME # so that pre-commit won't use the default
commands =
precommit: pre-commit run
precommitall: pre-commit run --all-files