Files
openstreetmap-mod_tile-pyth…/.github/workflows/github-actions.yml
2021-07-29 23:48:54 +00:00

153 lines
4.9 KiB
YAML

---
name: CI Pipeline
on:
pull_request:
push:
branches:
- master
- develop
jobs:
lint-astyle:
name: Lint code with `astyle`
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Update installed packages
run: sudo apt --yes update
- name: Install `astyle`
run: sudo apt --yes install astyle
- name: Run `astyle`
run: |
astyle \
--options=none --lineend=linux --style=1tbs --indent=force-tab=8 \
--break-blocks --indent-switches --pad-oper --pad-header \
--unpad-paren --suffix=none \
includes/* src/*
- name: Check if any modifications were made by `astyle`
run: |
if [[ -n $(git diff) ]]; then
echo "You must run 'astyle \
--options=none --lineend=linux --style=1tbs --indent=force-tab=8 \
--break-blocks --indent-switches --pad-oper --pad-header \
--unpad-paren --suffix=none \
includes/* src/*' before submitting a pull request"
echo ""
git diff
exit -1
fi
build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Update installed packages
run: sudo apt --yes update
- name: Install build dependencies
run: |
sudo apt --yes install \
apache2-dev libcairo2-dev libcurl4-gnutls-dev libglib2.0-dev \
libiniparser-dev libmapnik-dev
- name: Run `./autogen.sh`
run: ./autogen.sh
- name: Run `./configure`
run: ./configure
- name: Run `make`
run: make
- name: Create build archive
run: |
tar --verbose --create --file=/tmp/workspace.tar \
${{ github.workspace }}
- name: Upload build artifacts
uses: actions/upload-artifact@v2
with:
name: build
path: /tmp/workspace.tar
test-make-test:
name: Test with `make test`
runs-on: ubuntu-latest
needs:
- build
- lint-astyle
steps:
- name: Update installed packages
run: sudo apt --yes update
- name: Install build dependencies
run: |
sudo apt --yes install \
apache2-dev libcairo2-dev libcurl4-gnutls-dev libglib2.0-dev \
libiniparser-dev libmapnik-dev
- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: build
path: /tmp
- name: Extract build archive
run: tar --verbose --extract --directory=/ --file=/tmp/workspace.tar
- name: Run `make test`
run: make test
test-mod_tile-module:
name: Test `mod_tile` module
runs-on: ubuntu-latest
needs:
- build
- lint-astyle
steps:
- name: Update installed packages
run: sudo apt --yes update
- name: Install build dependencies
run: |
sudo apt --yes install \
apache2-dev libcairo2-dev libcurl4-gnutls-dev libglib2.0-dev \
libiniparser-dev libmapnik-dev libjs-leaflet
- name: Install Apache HTTP Server
run: |
sudo apt --yes install \
apache2
- name: Download build artifacts
uses: actions/download-artifact@v2
with:
name: build
path: /tmp
- name: Extract build archive
run: tar --verbose --extract --directory=/ --file=/tmp/workspace.tar
- name: Set up Apache HTTP Server
run: |
sudo mkdir --parents /run/renderd /var/cache/renderd/tiles
sudo ln --symbolic \
"${PWD}/utils/example-map" \
/var/www/
sudo ln --symbolic \
/usr/share/javascript/leaflet \
/var/www/example-map/leaflet
sudo ln --symbolic \
"${PWD}/etc/renderd/renderd.conf.examples" \
/etc/renderd.conf
sudo ln --symbolic \
"${PWD}/etc/apache2/renderd.conf" \
/etc/apache2/conf-enabled/renderd.conf
sudo ln --symbolic \
"${PWD}/etc/apache2/renderd-example-map.conf" \
/etc/apache2/conf-enabled/renderd-example-map.conf
echo "LoadModule tile_module /usr/lib/apache2/modules/mod_tile.so" \
| sudo tee --append /etc/apache2/mods-enabled/mod_tile.load
- name: Run `sudo make install`
run: sudo make install
- name: Run `make install-mod_tile`
run: sudo make install-mod_tile
- name: Start `renderd`
run: sudo renderd
- name: Enable & start Apache HTTP Server
run: sudo systemctl --now enable apache2
- name: Test Apache HTTP Server `mod_tile` module
run: |
curl --silent http://localhost/renderd-example/tiles/9/297/191.png \
| sha256sum - \
| grep dbf26531286e844a3a9735cdd193598dca78d22f77cafe5824bcaf17f88cbb08