update to node.js 20 #168
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
on: [push, pull_request] | |
jobs: | |
lint_and_test: | |
runs-on: ${{matrix.os}} | |
strategy: | |
max-parallel: 4 | |
matrix: | |
os: [ubuntu-latest, macos-latest, windows-latest] | |
python-version: [3.11] | |
steps: | |
- name: Git config | |
run: git config --global core.autocrlf input | |
- uses: actions/checkout@v4 | |
- name: Set up Python v${{matrix.python-version}} - ${{runner.os}} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{matrix.python-version}} | |
cache: pip | |
- name: Display Python version | |
run: python --version | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
pip install -r requirements.txt | |
pip install -r requirements-dev.txt | |
pip install -r requirements-examples.txt | |
- name: Check formatting (black) | |
run: black --line-length 120 --check --diff staticmaps examples tests | |
- name: Lint (pylint) | |
run: pylint staticmaps examples tests | |
- name: Lint (flake8) | |
run: flake8 staticmaps examples tests | |
- name: Check types (mypy) | |
run: mypy staticmaps examples tests | |
- name: Run tests (pytest) | |
run: python -m pytest tests | |
build: | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: [3.11] | |
needs: "lint_and_test" | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- name: Install cairo | |
run: sudo apt-get install libcairo2-dev | |
- name: Git config | |
run: git config --global core.autocrlf input | |
- uses: actions/checkout@v4 | |
- name: Set up Python v${{matrix.python-version}} - ${{runner.os}} | |
uses: actions/setup-python@v5 | |
with: | |
python-version: ${{matrix.python-version}} | |
cache: pip | |
- name: Install Python dependencies | |
run: | | |
python -m pip install --upgrade pip setuptools wheel | |
pip install -r requirements.txt | |
pip install -r requirements-cairo.txt | |
pip install -r requirements-examples.txt | |
- name: Build examples | |
run: | | |
cd examples | |
mkdir build | |
PYTHONPATH=.. python custom_objects.py | |
PYTHONPATH=.. python draw_gpx.py running.gpx | |
PYTHONPATH=.. python frankfurt_newyork.py | |
PYTHONPATH=.. python freiburg_area.py | |
PYTHONPATH=.. python geodesic_circles.py | |
PYTHONPATH=.. python tile_providers.py | |
PYTHONPATH=.. python us_capitals.py | |
(ls *.svg && mv *.svg build/.) || echo "no svg files found!" | |
(ls *pillow*.png && mv *pillow*.png build/.) || echo "no pillow png files found!" | |
(ls *cairo*.png && mv *cairo*.png build/.) || echo "no cairo png files found!" | |
cd - | |
- name: Archive examples | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build_examples | |
path: examples/build | |
deploy: | |
runs-on: ${{matrix.os}} | |
strategy: | |
matrix: | |
os: [ubuntu-latest] | |
python-version: [3.11] | |
needs: "build" | |
if: github.ref == 'refs/heads/main' | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Setup git and push to remote | |
run: | | |
export GIT_USER=${{ github.actor }} | |
git config --global core.autocrlf input | |
- name: Git clone | |
run: git clone https://github.com/lowtower/py-staticmaps --branch assets assets | |
- name: Download artifacts | |
uses: actions/download-artifact@v3 | |
with: | |
name: build_examples | |
- name: Move pictures and commit | |
run: | | |
mv *.png assets/. | |
mv *.svg assets/. | |
cd assets | |
git config --local user.email "github-actions[bot]@users.noreply.github.com" | |
git config --local user.name "github-actions[bot]" | |
git fetch | |
git pull | |
git add *.png | |
git add *.svg | |
git commit -m "Automatic update of example image files" | |
git status | |
pwd | |
ls -lrt | |
- name: Push changes | |
uses: ad-m/github-push-action@master | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
directory: assets | |
branch: assets |