Skip to content

Commit 5f50a10

Browse files
committed
fix: add nix support, UV + migrate tests, add gimie_shacl
1 parent a32ac05 commit 5f50a10

6 files changed

Lines changed: 3271 additions & 0 deletions

File tree

.github/workflows/publish.yml

Lines changed: 68 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,68 @@
1+
# Workflow following resources at:
2+
# - https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-pypi
3+
# - https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives
4+
# Jobs are split to prevent unneccessary priviledge elevation through write permissions during building.
5+
6+
name: Build and publish on Pypi
7+
8+
on:
9+
release:
10+
types: [published]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
run-tests:
17+
uses: ./.github/workflows/pytest.yml
18+
secrets: inherit
19+
20+
release-build:
21+
name: Build python wheels
22+
needs:
23+
- run-tests
24+
runs-on: ubuntu-latest
25+
steps:
26+
# https://github.com/actions/checkout
27+
- uses: actions/checkout@v4
28+
# https://github.com/astral-sh/setup-uv
29+
- name: Install uv
30+
uses: astral-sh/setup-uv@v4
31+
32+
- name: Set up Python
33+
# https://github.com/actions/setup-python
34+
uses: actions/setup-python@v5
35+
with:
36+
python-version: "3.12"
37+
38+
- name: Build source and wheel archives
39+
run: uv build
40+
41+
- name: Upload distributions
42+
# https://github.com/actions/upload-artifact
43+
uses: actions/upload-artifact@v4
44+
with:
45+
name: release-dists
46+
path: dist/
47+
48+
pypi-publish:
49+
name: Upload release to PyPI
50+
needs:
51+
- release-build
52+
runs-on: ubuntu-latest
53+
environment:
54+
name: pypi
55+
url: https://pypi.org/p/gimie
56+
permissions:
57+
id-token: write
58+
# IMPORTANT: this permission is mandatory for trusted publishing
59+
steps:
60+
- name: Retrieve release distributions
61+
# https://github.com/actions/download-artifact
62+
uses: actions/download-artifact@v4.1.8
63+
with:
64+
name: release-dists
65+
path: dist/
66+
- name: Publish package distributions to PyPI
67+
# https://github.com/pypa/gh-action-pypi-publish
68+
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/pytest.yml

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
name: tests
2+
3+
on: [push, workflow_call]
4+
5+
jobs:
6+
7+
test:
8+
runs-on: ubuntu-latest
9+
strategy:
10+
matrix:
11+
python-version: ["3.9", "3.10", "3.11", "3.12"]
12+
steps:
13+
# https://github.com/actions/checkout
14+
- uses: actions/checkout@v4
15+
with:
16+
fetch-depth: 0
17+
18+
# https://github.com/astral-sh/setup-uv
19+
- name: Install uv
20+
uses: astral-sh/setup-uv@v4
21+
22+
# https://github.com/actions/setup-python
23+
- name: Set up Python ${{ matrix.python-version }}
24+
uses: actions/setup-python@v5
25+
with:
26+
python-version: ${{ matrix.python-version }}
27+
28+
- name: Install Dependencies
29+
run: uv sync --group dev
30+
31+
- name: Code Quality
32+
run: uv run black . --check
33+
34+
- name: Test with pytest
35+
env:
36+
GITHUB_TOKEN: ${{ secrets.ACCESS_GITHUB_TOKEN }}
37+
GITLAB_TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }}
38+
run: make test
39+
40+
- name: Upload coverage report
41+
env:
42+
COVERALLS_REPO_TOKEN: ${{ secrets.COVERALLS_REPO_TOKEN }}
43+
GITHUB_TOKEN: ${{ secrets.ACCESS_GITHUB_TOKEN }}
44+
GITLAB_TOKEN: ${{ secrets.GITLAB_ACCESS_TOKEN }}
45+
COVERALLS_PARALLEL: true
46+
run: |
47+
uv run coveralls --service=github-actions
48+
continue-on-error: true
49+
50+
finish:
51+
needs: test
52+
if: ${{ always() }}
53+
runs-on: ubuntu-latest
54+
steps:
55+
# https://github.com/coverallsapp/github-action
56+
- name: Coveralls Finished
57+
uses: coverallsapp/github-action@v2
58+
with:
59+
parallel-finished: true

.github/workflows/test-publish.yml

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
# Workflow following resources at:
2+
# - https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-python#publishing-to-pypi
3+
# - https://packaging.python.org/en/latest/tutorials/packaging-projects/#uploading-the-distribution-archives
4+
# Jobs are split to prevent unneccessary priviledge elevation through write permissions during building.
5+
6+
name: Build and publish on Pypi Test
7+
8+
on:
9+
workflow_dispatch:
10+
11+
permissions:
12+
contents: read
13+
14+
jobs:
15+
run-tests:
16+
uses: ./.github/workflows/pytest.yml
17+
secrets: inherit
18+
19+
test-build:
20+
name: Build python wheels
21+
needs:
22+
- run-tests
23+
runs-on: ubuntu-latest
24+
steps:
25+
# https://github.com/actions/checkout
26+
- uses: actions/checkout@v4
27+
# https://github.com/astral-sh/setup-uv
28+
- name: Install uv
29+
uses: astral-sh/setup-uv@v4
30+
31+
- name: Set up Python
32+
# https://github.com/actions/setup-python
33+
uses: actions/setup-python@v5
34+
with:
35+
python-version: "3.12"
36+
37+
- name: Build source and wheel archives
38+
run: uv build
39+
40+
- name: Upload distributions
41+
# https://github.com/actions/upload-artifact
42+
uses: actions/upload-artifact@v4
43+
with:
44+
name: test-dists
45+
path: dist/
46+
47+
pypi-test-publish:
48+
name: Upload release to PyPI Test
49+
needs:
50+
- test-build
51+
runs-on: ubuntu-latest
52+
environment:
53+
name: test-pypi
54+
url: https://test.pypi.org/p/gimie
55+
permissions:
56+
id-token: write
57+
# IMPORTANT: this permission is mandatory for trusted publishing
58+
steps:
59+
- name: Retrieve release distributions
60+
# https://github.com/actions/download-artifact
61+
uses: actions/download-artifact@v4.1.8
62+
with:
63+
name: test-dists
64+
path: dist/
65+
- name: Publish package distributions to TestPyPI
66+
# https://github.com/pypa/gh-action-pypi-publish
67+
uses: pypa/gh-action-pypi-publish@release/v1
68+
with:
69+
repository-url: https://test.pypi.org/legacy/

flake.nix

Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
{
2+
description = "Gimie development environment";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
};
8+
9+
outputs = { self, nixpkgs, flake-utils }:
10+
flake-utils.lib.eachDefaultSystem (system:
11+
let
12+
pkgs = nixpkgs.legacyPackages.${system};
13+
in
14+
{
15+
devShells.default = pkgs.mkShell {
16+
buildInputs = with pkgs; [
17+
python313
18+
uv
19+
# Explicit library dependencies
20+
stdenv.cc.cc.lib
21+
glibc
22+
glib
23+
zlib
24+
libffi
25+
openssl
26+
];
27+
28+
shellHook = ''
29+
export LD_LIBRARY_PATH="${pkgs.stdenv.cc.cc.lib}/lib:${pkgs.glibc}/lib:$LD_LIBRARY_PATH"
30+
echo "Development environment loaded"
31+
'';
32+
};
33+
});
34+
}

0 commit comments

Comments
 (0)