Skip to content

Commit

Permalink
feat: send full code
Browse files Browse the repository at this point in the history
  • Loading branch information
RaczeQ committed Dec 28, 2023
1 parent d0af12a commit 3b23a1c
Show file tree
Hide file tree
Showing 47 changed files with 4,920 additions and 16 deletions.
80 changes: 80 additions & 0 deletions .github/workflows/_tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,80 @@
name: tests
on: workflow_call

jobs:
run-tests:
name: Run tests 🛠️ on multiple systems 🖥️ and Python 🐍 versions
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
python-version: ["3.9", "3.10", "3.11"]
include:
- os: macos-latest
python-version: "3.11"
- os: windows-latest
python-version: "3.11"
env:
OS: ${{ matrix.os }}
PYTHON: ${{ matrix.python-version }}
steps:
- uses: actions/checkout@v3
- name: Setup Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Install GDAL (unix)
if: matrix.os != 'windows-latest'
run: |
$CONDA/bin/conda install -c conda-forge gdal
$CONDA/bin/ogr2ogr --version
- name: Install GDAL (windows)
if: matrix.os == 'windows-latest'
run: |
& $env:CONDA\Scripts\conda.exe install -c conda-forge gdal
& $env:CONDA\Library\bin\ogr2ogr.exe --version
- uses: pdm-project/setup-pdm@v3
name: Setup PDM (Python ${{ matrix.python-version }})
with:
python-version: ${{ matrix.python-version }}
architecture: x64
enable-pep582: true
cache: true
cache-dependency-path: "**/pdm.lock"
- name: Install dependencies
run: pdm install -d -G test --skip=post_install
- name: Cache Overpass data
uses: actions/cache@v3
with:
path: cache
key: overpass-cache-${{ matrix.os }}-${{ matrix.python-version }}
- name: Cache tox runner
uses: actions/cache@v3
with:
path: .tox
key: tox-cache-${{ matrix.os }}-${{ matrix.python-version }}-${{ hashFiles('**/pdm.lock') }}
restore-keys: |
tox-cache-${{ matrix.os }}-${{ matrix.python-version }}-
- name: Run tests with tox (unix)
if: matrix.os != 'windows-latest'
run: |
PATH=$CONDA/bin:$PATH
pdm run tox -e python${{ matrix.python-version }}
- name: Run tests with tox (windows)
if: matrix.os == 'windows-latest'
run: |
$env:Path = "$env:CONDA\Library\bin;" + $env:Path
pdm run tox -e python${{ matrix.python-version }}
- name: Upload coverage to Codecov
uses: Wandalen/wretry.action@master
with:
action: codecov/codecov-action@v3
with: |
env_vars: OS,PYTHON
fail_ci_if_error: true
files: ./coverage.python${{ matrix.python-version }}.xml,
flags: ${{ matrix.os }}-python${{ matrix.python-version }}
verbose: true
attempt_limit: 100
attempt_delay: 10000
72 changes: 72 additions & 0 deletions .github/workflows/bump-and-pr.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
name: "Bump ⬆️ library version and create PR"
on:
workflow_dispatch:
inputs:
bumpType:
description: "Bump type"
required: true
default: "patch"
type: choice
options:
- patch
- minor
- major

env:
PYTHON_VERSION: 3.11

jobs:
bump-n-pr:
name: Bump ⬆️ and create a Pull Request with a new library version (${{ inputs.bumpType }})
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.CICD_PAT_TOKEN }}
- name: Configure Git user
run: |
git config --local user.name "Kraina CI/CD"
git config --local user.email "[email protected]"
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: ${{ env.PYTHON_VERSION }}
- uses: pdm-project/setup-pdm@v3
name: Setup PDM
with:
python-version: ${{ env.PYTHON_VERSION }}
architecture: x64
- name: Install dependencies
run: pdm install -d -G dev --skip=post_install
- name: Bump changelog version
id: changelog
uses: release-flow/keep-a-changelog-action@v2
with:
command: bump
version: ${{ inputs.bumpType }}
tag-prefix: ""
keep-unreleased-section: True
- name: Run bumpver
run: |
pdm run bumpver update --allow-dirty --${{ inputs.bumpType }} -vvv
- name: Get commit message
id: commit_message
run: |
echo COMMIT_MESSAGE="$(git log -1 --pretty=%B | cat)" >> $GITHUB_OUTPUT
- name: Get new version
id: new_version
run: |
pdm run bumpver show -n -e | grep CURRENT_VERSION >> $GITHUB_OUTPUT
- name: Create Pull Request
uses: peter-evans/create-pull-request@v5
with:
title: ${{ steps.commit_message.outputs.COMMIT_MESSAGE }}
branch: ${{ format('release/{0}', steps.new_version.outputs.CURRENT_VERSION) }}
labels: release
base: main
body: ${{ steps.changelog.outputs.release-notes }}
token: ${{ secrets.CICD_PAT_TOKEN }}
author: Kraina CI/CD <[email protected]>
committer: Kraina CI/CD <[email protected]>
commit-message: "docs: update CHANGELOG.md"
129 changes: 129 additions & 0 deletions .github/workflows/ci-dev.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,129 @@
name: "Build & publish - DEV"
on:
workflow_run:
workflows: [Test - DEV]
types:
- completed

jobs:
build-n-publish:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Build and publish Python 🐍 distributions 📦 to TestPyPI
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.11
- uses: pdm-project/setup-pdm@v3
name: Setup PDM
with:
python-version: 3.11
architecture: x64
enable-pep582: true
cache: true
cache-dependency-path: "**/pdm.lock"
- run: pip install toml
- uses: jannekem/run-python-script-action@v1
name: Rename test version
with:
script: |
import time
import toml
data = toml.load("pyproject.toml")
current_date = time.strftime("%Y%m%d%H%M%S")
data['project']['version']=f"{data['project']['version']}-{current_date}"
data['tool']['bumpver']['current_version']=f"{data['tool']['bumpver']['current_version']}-{current_date}"
f = open("pyproject.toml",'w')
toml.dump(data, f)
f.close()
- name: Publish distribution 📦 to Test PyPI
run: pdm publish --repository testpypi --username __token__ --password ${{ secrets.PYPI_TEST_API_TOKEN }} --comment ${{ github.sha }} --verbose

generate-docs:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
name: Generate latest library 📚 documentation 📄
runs-on: ubuntu-latest
permissions:
contents: write
env:
MKDOCS_EXECUTE_JUPYTER: false # execution is done before rendering documentation
MKDOCS_DEV: true
steps:
- uses: actions/checkout@v3
with:
token: ${{ secrets.CICD_PAT_TOKEN }}
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: "3.10"
- uses: actions/cache@v3
with:
path: ~/.cache/pip
key: ${{ runner.os }}-pip-dev-${{ hashFiles('**/pdm.lock') }}
restore-keys: |
${{ runner.os }}-pip-dev-
- name: Install pdm
run: pip install pdm
- name: Generate requirements.txt
run: pdm export --no-default -G docs -G visualization -f requirements -o requirements.txt
- name: Install dependencies
run: pip install --no-deps -r requirements.txt
- name: Install nbconvert dependency
run: pip install jupyter nbconvert nbformat black
- name: Install quackosm
run: |
pdm build -v -d dist
pip install 'quackosm @ file://'"$(pwd)/$(find dist -name '*.whl')"
- name: Configure Git user
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Cache Overpass data
uses: actions/cache@v3
with:
path: "**/cache"
key: mkdocs-overpass-dev-cache-${{ runner.os }}
- name: Execute jupyter notebooks
run: |
jupyter nbconvert --to notebook --inplace --execute $(find examples/ -type f -name "*.ipynb") --ExecutePreprocessor.kernel_name='python3'
- uses: jannekem/run-python-script-action@v1
name: Replace copyright date
with:
script: |
import time
file_name = "mkdocs.yml"
with open(file_name) as f:
data = f.read().replace('{current_year}', time.strftime("%Y"))
with open(file_name, "w") as f:
f.write(data)
- name: Create remote for quackosm-docs repository
run: git remote add origin-quackosm-docs https://github.com/kraina-ai/quackosm-docs
- name: Fetch gh-pages branch
run: git fetch origin-quackosm-docs gh-pages --depth=1
- name: Publish dev documentation
run: mike deploy --remote origin-quackosm-docs --rebase --push dev

deploy-docs:
name: Deploy documentation 📄 to Github Pages 🌐
needs: [generate-docs]
runs-on: ubuntu-latest
permissions:
contents: write
pages: write
id-token: write
steps:
- uses: actions/checkout@v3
with:
repository: 'kraina-ai/quackosm-docs'
ref: 'gh-pages'
token: ${{ secrets.CICD_PAT_TOKEN }}
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
# Upload entire repository
path: '.'
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
Loading

0 comments on commit 3b23a1c

Please sign in to comment.