Migrate to forgejo
This commit is contained in:
parent
828f8a9231
commit
4c6441182b
11 changed files with 211 additions and 233 deletions
57
.forgejo/workflows/docker.yml
Normal file
57
.forgejo/workflows/docker.yml
Normal file
|
|
@ -0,0 +1,57 @@
|
||||||
|
name: Publish on DockerHub
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ['*']
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- name: Checkout
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
|
# The `docker` runner image is node-based and may not ship the docker CLI
|
||||||
|
# that the docker/* actions below drive; install it idempotently, as the
|
||||||
|
# sibling repos do for their Docker jobs.
|
||||||
|
- name: Ensure Docker CLI
|
||||||
|
run: |
|
||||||
|
set -eux
|
||||||
|
if ! command -v docker >/dev/null 2>&1; then
|
||||||
|
ARCH=$(uname -m)
|
||||||
|
curl -fsSL --retry 3 --retry-connrefused \
|
||||||
|
"https://download.docker.com/linux/static/stable/${ARCH}/docker-27.5.1.tgz" \
|
||||||
|
| tar xz --strip-components=1 -C /usr/local/bin docker/docker
|
||||||
|
fi
|
||||||
|
docker --version
|
||||||
|
|
||||||
|
# Marketplace actions must be referenced by full URL: this instance's
|
||||||
|
# DEFAULT_ACTIONS_URL points at code.forgejo.org, so only bare `actions/*`
|
||||||
|
# names resolve to GitHub automatically.
|
||||||
|
- name: Set up QEMU
|
||||||
|
uses: https://github.com/docker/setup-qemu-action@v3
|
||||||
|
|
||||||
|
- name: Set up Docker Buildx
|
||||||
|
uses: https://github.com/docker/setup-buildx-action@v3
|
||||||
|
|
||||||
|
- name: Log in to Docker Hub
|
||||||
|
uses: https://github.com/docker/login-action@v3
|
||||||
|
with:
|
||||||
|
username: ${{ secrets.DOCKER_USERNAME }}
|
||||||
|
password: ${{ secrets.DOCKER_PASSWORD }}
|
||||||
|
|
||||||
|
- name: Extract metadata for the Docker image
|
||||||
|
id: meta
|
||||||
|
uses: https://github.com/docker/metadata-action@v5
|
||||||
|
with:
|
||||||
|
images: schmelczera/great-ai
|
||||||
|
|
||||||
|
- name: Build and push
|
||||||
|
uses: https://github.com/docker/build-push-action@v6
|
||||||
|
with:
|
||||||
|
context: .
|
||||||
|
push: true
|
||||||
|
tags: ${{ steps.meta.outputs.tags }}
|
||||||
|
labels: ${{ steps.meta.outputs.labels }}
|
||||||
|
platforms: linux/amd64,linux/arm64
|
||||||
52
.forgejo/workflows/docs.yml
Normal file
52
.forgejo/workflows/docs.yml
Normal file
|
|
@ -0,0 +1,52 @@
|
||||||
|
name: Publish documentation
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main]
|
||||||
|
paths:
|
||||||
|
- 'docs/**'
|
||||||
|
- 'great_ai/**'
|
||||||
|
- 'mkdocs.yaml'
|
||||||
|
- '.forgejo/workflows/docs.yml'
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: pages
|
||||||
|
cancel-in-progress: false
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
# The mkdocs git-revision-date plugin reads each page's git history.
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
run: |
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
run: uv python install 3.10
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
uv venv --python 3.10
|
||||||
|
uv pip install '.[dev]'
|
||||||
|
|
||||||
|
- name: Build documentation
|
||||||
|
run: |
|
||||||
|
. .venv/bin/activate
|
||||||
|
mkdocs build
|
||||||
|
|
||||||
|
# The old workflow ran `mkdocs gh-deploy` (GitHub Pages); on this instance
|
||||||
|
# built sites are rsynced into the host /pages mount that nginx serves,
|
||||||
|
# via the shared ci-actions/deploy-pages action — same as photos/reconcile.
|
||||||
|
- name: Deploy to pages mount
|
||||||
|
if: github.ref == 'refs/heads/main'
|
||||||
|
uses: http://forgejo:3000/andras/ci-actions/deploy-pages@main
|
||||||
|
with:
|
||||||
|
source: site
|
||||||
|
target: great-ai
|
||||||
28
.forgejo/workflows/publish.yml
Normal file
28
.forgejo/workflows/publish.yml
Normal file
|
|
@ -0,0 +1,28 @@
|
||||||
|
name: Publish on PyPI
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
tags: ['*']
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
publish:
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
run: |
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
run: uv python install 3.10
|
||||||
|
|
||||||
|
# Forgejo cannot use PyPI trusted publishing (OIDC), so authenticate with
|
||||||
|
# an API token, the same way the sibling repos publish their packages.
|
||||||
|
- name: Build and publish
|
||||||
|
env:
|
||||||
|
FLIT_USERNAME: __token__
|
||||||
|
FLIT_PASSWORD: ${{ secrets.PYPI_TOKEN }}
|
||||||
|
run: uvx flit publish
|
||||||
73
.forgejo/workflows/test.yml
Normal file
73
.forgejo/workflows/test.yml
Normal file
|
|
@ -0,0 +1,73 @@
|
||||||
|
name: Check
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches: [main, dev]
|
||||||
|
pull_request:
|
||||||
|
branches: [main, dev]
|
||||||
|
workflow_dispatch:
|
||||||
|
|
||||||
|
concurrency:
|
||||||
|
group: ${{ gitea.workflow }}-${{ gitea.ref }}
|
||||||
|
cancel-in-progress: true
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
lint:
|
||||||
|
name: Lint, format & type checks
|
||||||
|
runs-on: docker
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
run: |
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
- name: Set up Python
|
||||||
|
run: uv python install 3.10
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
# --seed gives the venv its own pip, which scripts/check-python.sh shells
|
||||||
|
# out to for its linters; '.[dev]' provides the rest (mypy resolves the
|
||||||
|
# package's own imports against the installed tree).
|
||||||
|
run: |
|
||||||
|
uv venv --seed --python 3.10
|
||||||
|
uv pip install '.[dev]'
|
||||||
|
|
||||||
|
- name: Check code and formatting
|
||||||
|
run: |
|
||||||
|
. .venv/bin/activate
|
||||||
|
scripts/check-python.sh great_ai tests
|
||||||
|
|
||||||
|
test:
|
||||||
|
name: Test on Python ${{ matrix.python-version }}
|
||||||
|
runs-on: docker
|
||||||
|
strategy:
|
||||||
|
fail-fast: false
|
||||||
|
matrix:
|
||||||
|
# pyproject declares >= 3.7, but uv's standalone CPython and the current
|
||||||
|
# dependency floors (scikit-learn/numpy now require >= 3.9) no longer
|
||||||
|
# build on 3.7/3.8. Re-add those rows if the constraints are relaxed.
|
||||||
|
# The windows leg of the old GitHub matrix is dropped: this Forgejo
|
||||||
|
# instance only has a Linux `docker` runner.
|
||||||
|
python-version: ['3.9', '3.10']
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Install uv
|
||||||
|
run: |
|
||||||
|
curl -LsSf https://astral.sh/uv/install.sh | sh
|
||||||
|
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
|
||||||
|
|
||||||
|
- name: Set up Python ${{ matrix.python-version }}
|
||||||
|
run: uv python install ${{ matrix.python-version }}
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
uv venv --python ${{ matrix.python-version }}
|
||||||
|
uv pip install '.[dev]'
|
||||||
|
|
||||||
|
- name: Run tests
|
||||||
|
run: |
|
||||||
|
. .venv/bin/activate
|
||||||
|
pytest --doctest-modules --asyncio-mode=strict
|
||||||
6
.github/dependabot.yml
vendored
6
.github/dependabot.yml
vendored
|
|
@ -1,6 +0,0 @@
|
||||||
version: 2
|
|
||||||
updates:
|
|
||||||
- package-ecosystem: "github-actions"
|
|
||||||
directory: "/"
|
|
||||||
schedule:
|
|
||||||
interval: "daily"
|
|
||||||
38
.github/workflows/codeql-analysis.yml
vendored
38
.github/workflows/codeql-analysis.yml
vendored
|
|
@ -1,38 +0,0 @@
|
||||||
name: analyse with CodeQL
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
pull_request:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
schedule:
|
|
||||||
- cron: '45 13 * * 5'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
analyze:
|
|
||||||
name: Analyze
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
actions: read
|
|
||||||
contents: read
|
|
||||||
security-events: write
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
language:
|
|
||||||
- python
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout repository
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Initialize CodeQL
|
|
||||||
uses: github/codeql-action/init@v2
|
|
||||||
with:
|
|
||||||
languages: ${{ matrix.language }}
|
|
||||||
|
|
||||||
- name: Perform CodeQL Analysis
|
|
||||||
uses: github/codeql-action/analyze@v2
|
|
||||||
39
.github/workflows/docker.yaml
vendored
39
.github/workflows/docker.yaml
vendored
|
|
@ -1,39 +0,0 @@
|
||||||
name: publish on DockerHub
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Set up QEMU
|
|
||||||
uses: docker/setup-qemu-action@v2
|
|
||||||
|
|
||||||
- name: Set up Docker Buildx
|
|
||||||
uses: docker/setup-buildx-action@v2
|
|
||||||
|
|
||||||
- name: Log in to Docker Hub
|
|
||||||
uses: docker/login-action@v2
|
|
||||||
with:
|
|
||||||
username: ${{ secrets.DOCKER_USERNAME }}
|
|
||||||
password: ${{ secrets.DOCKER_PASSWORD }}
|
|
||||||
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Extract metadata for the Docker image
|
|
||||||
id: meta
|
|
||||||
uses: docker/metadata-action@v4
|
|
||||||
with:
|
|
||||||
images: schmelczera/great-ai
|
|
||||||
|
|
||||||
- name: Build and push
|
|
||||||
uses: docker/build-push-action@v3
|
|
||||||
with:
|
|
||||||
push: true
|
|
||||||
tags: ${{ steps.meta.outputs.tags }}
|
|
||||||
labels: ${{ steps.meta.outputs.labels }}
|
|
||||||
platforms: linux/amd64,linux/arm64
|
|
||||||
27
.github/workflows/docs.yaml
vendored
27
.github/workflows/docs.yaml
vendored
|
|
@ -1,27 +0,0 @@
|
||||||
name: publish documentation
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- dev
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Set up Python 3.9
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: 3.9
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: pip install --upgrade './[dev]'
|
|
||||||
|
|
||||||
- name: Build documentation
|
|
||||||
run: mkdocs gh-deploy
|
|
||||||
26
.github/workflows/publish.yaml
vendored
26
.github/workflows/publish.yaml
vendored
|
|
@ -1,26 +0,0 @@
|
||||||
name: publish on PyPI
|
|
||||||
|
|
||||||
on:
|
|
||||||
push:
|
|
||||||
tags:
|
|
||||||
- '*'
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
publish:
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Set up Python 3.9
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: 3.9
|
|
||||||
|
|
||||||
- name: Install Flit
|
|
||||||
run: pip install --upgrade flit --user
|
|
||||||
|
|
||||||
- name: Build and publish
|
|
||||||
run: flit publish --setup-py
|
|
||||||
env:
|
|
||||||
FLIT_USERNAME: __token__
|
|
||||||
FLIT_PASSWORD: ${{ secrets.PYPI_API_TOKEN }}
|
|
||||||
96
.github/workflows/test.yml
vendored
96
.github/workflows/test.yml
vendored
|
|
@ -1,96 +0,0 @@
|
||||||
name: tests
|
|
||||||
|
|
||||||
on:
|
|
||||||
workflow_dispatch:
|
|
||||||
push:
|
|
||||||
branches:
|
|
||||||
- main
|
|
||||||
- dev
|
|
||||||
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
name: Build and test on ${{ matrix.operating-system }} with Python ${{ matrix.python-version }}
|
|
||||||
|
|
||||||
strategy:
|
|
||||||
matrix:
|
|
||||||
python-version: ["3.7", "3.8", "3.9", "3.10"]
|
|
||||||
operating-system: [windows-latest, ubuntu-latest]
|
|
||||||
|
|
||||||
runs-on: ${{ matrix.operating-system }}
|
|
||||||
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
|
|
||||||
- name: Setup Python ${{ matrix.python-version }}
|
|
||||||
uses: actions/setup-python@v4
|
|
||||||
with:
|
|
||||||
python-version: ${{ matrix.python-version }}
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python3 -m pip install --upgrade pip
|
|
||||||
pip install --upgrade './[dev]'
|
|
||||||
|
|
||||||
- name: Check code and formatting
|
|
||||||
run: scripts/check-python.sh great_ai tests
|
|
||||||
|
|
||||||
- name: Run tests
|
|
||||||
run: python3 -m pytest --doctest-modules --cov=. --cov-report=xml --junit-xml pytest.xml --asyncio-mode=strict || true
|
|
||||||
|
|
||||||
- name: Upload results
|
|
||||||
if: always()
|
|
||||||
uses: actions/upload-artifact@v3
|
|
||||||
with:
|
|
||||||
name: Unit test coverage (Python ${{ matrix.python-version }} - ${{ matrix.operating-system }})
|
|
||||||
path: "*.xml"
|
|
||||||
|
|
||||||
sonar:
|
|
||||||
name: Analyse Python project with SonarQube
|
|
||||||
needs: test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Install dependencies
|
|
||||||
run: |
|
|
||||||
python -m pip install --upgrade pip
|
|
||||||
pip install --upgrade .
|
|
||||||
rm -rf build
|
|
||||||
|
|
||||||
- name: Download test results
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
path: artifacts
|
|
||||||
|
|
||||||
- uses: sonarsource/sonarqube-scan-action@master
|
|
||||||
env:
|
|
||||||
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
|
|
||||||
SONAR_HOST_URL: ${{ secrets.SONAR_HOST_URL }}
|
|
||||||
with:
|
|
||||||
args: >
|
|
||||||
-Dsonar.projectKey=great-ai
|
|
||||||
-Dsonar.login=${{ secrets.SONAR_TOKEN }}
|
|
||||||
-Dsonar.verbose=true
|
|
||||||
-Dsonar.python.coverage.reportPaths=artifacts/*/coverage.xml
|
|
||||||
-Dsonar.coverage.exclusions=**/external/**/*
|
|
||||||
-Dsonar.exclusions=**/external/**/*,artifacts/**/*
|
|
||||||
|
|
||||||
publish-test-results:
|
|
||||||
name: Publish unit test results
|
|
||||||
needs: test
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
if: always()
|
|
||||||
steps:
|
|
||||||
- name: Download artifacts
|
|
||||||
uses: actions/download-artifact@v3
|
|
||||||
with:
|
|
||||||
path: artifacts
|
|
||||||
|
|
||||||
- name: Publish results
|
|
||||||
uses: EnricoMi/publish-unit-test-result-action@v2
|
|
||||||
with:
|
|
||||||
files: artifacts/*/pytest.xml
|
|
||||||
|
|
@ -147,7 +147,7 @@ def parallel_map(
|
||||||
serialized_map_function = dill.dumps(func, byref=True, recurse=False)
|
serialized_map_function = dill.dumps(func, byref=True, recurse=False)
|
||||||
|
|
||||||
processes = [
|
processes = [
|
||||||
ctx.Process( # type: ignore
|
ctx.Process(
|
||||||
name=f"parallel_map_{config.function_name}_{i}",
|
name=f"parallel_map_{config.function_name}_{i}",
|
||||||
target=mapper_function,
|
target=mapper_function,
|
||||||
daemon=True,
|
daemon=True,
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue