Skip to content

Commit

Permalink
FreeBSD via Vagrant allows reuse of existing actions (#339)
Browse files Browse the repository at this point in the history
Currently, there is a lot of duplicate CI config for FreeBSD jobs, this removes that redundancy.
  • Loading branch information
hummeltech authored Sep 28, 2023
1 parent 04a2ef0 commit d13186a
Show file tree
Hide file tree
Showing 7 changed files with 103 additions and 58 deletions.
8 changes: 4 additions & 4 deletions .github/actions/cmake/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,16 +10,16 @@ runs:
shell: bash --noprofile --norc -euxo pipefail {0}

- name: Test `mod_tile`
run: ctest --exclude-regex 'clear_dirs|remove_tile' --output-on-failure
run: ctest --exclude-regex 'clear_dirs|remove_tiles' --output-on-failure
shell: bash --noprofile --norc -euxo pipefail {0}
working-directory: build

- name: Archive test artifacts on failure
if: failure()
run: |
TAR_FILENAME=${{ matrix.image || matrix.os }}-${{ matrix.compiler }}.tar.gz
TAR_FILENAME=${{ matrix.image || matrix.os || github.job }}-${{ matrix.compiler }}.tar.gz
TAR_FILENAME=$(echo "${TAR_FILENAME}" | sed 's/:/-/g')
tar -zcf /tmp/${TAR_FILENAME} tests
tar -zcf ${{ runner.temp }}/${TAR_FILENAME} tests
shell: bash --noprofile --norc -euxo pipefail {0}
working-directory: build

Expand All @@ -28,4 +28,4 @@ runs:
uses: actions/upload-artifact@v3
with:
name: Test Artifacts
path: /tmp/*.tar.gz
path: ${{ runner.temp }}/*.tar.gz
22 changes: 21 additions & 1 deletion .github/actions/dependencies/install/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,17 @@ inputs:
fedora-test-dependencies:
default: >-
httpd
freebsd-build-dependencies:
default: >-
apache24
cairo
coreutils
curl
glib
iniparser
libmemcached
mapnik
pkgconf
macos-build-dependencies:
default: >-
apr
Expand Down Expand Up @@ -166,6 +177,15 @@ runs:
${{ matrix.compiler == 'LLVM' && 'clang' || 'gcc gcc-c++' }}
if: startsWith(matrix.image, 'fedora:')

- name: Install Dependencies (FreeBSD)
uses: ./.github/actions/dependencies/install/pkg
with:
packages: >-
${{ inputs.freebsd-build-dependencies }}
${{ matrix.build_system == 'CMake' && 'cmake' || 'autoconf automake' }}
${{ matrix.compiler == 'GNU' && 'gcc' || 'llvm' }}
if: github.job == 'FreeBSD'

- name: Install Dependencies (macOS)
uses: ./.github/actions/dependencies/install/brew
with:
Expand All @@ -174,7 +194,7 @@ runs:
${{ inputs.macos-test-dependencies }}
${{ matrix.build_system == 'CMake' && 'cmake' || 'autoconf automake' }}
${{ matrix.compiler == 'GNU' && 'gcc' || '' }}
if: runner.os == 'macOS'
if: github.job == 'macOS'

- name: Install Dependencies (Ubuntu)
uses: ./.github/actions/dependencies/install/apt-get
Expand Down
15 changes: 15 additions & 0 deletions .github/actions/dependencies/install/pkg/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
---
inputs:
packages:
description: List of package(s) to install
required: true
options:
default: --yes
description: Option(s) to pass

runs:
using: composite
steps:
- name: Install package(s)
run: ${{ !matrix.image && 'sudo' || '' }} pkg install ${{ inputs.options }} ${{ inputs.packages }}
shell: bash --noprofile --norc -euxo pipefail {0}
40 changes: 0 additions & 40 deletions .github/actions/freebsd/action.yml

This file was deleted.

56 changes: 48 additions & 8 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,9 +59,7 @@ jobs:
container:
env:
CC: ${{ matrix.compiler == 'LLVM' && 'clang' || 'gcc' }}
CFLAGS: ${{ (matrix.build_system == 'CMake' && matrix.compiler == 'GNU') && '--coverage' || '' }}
CXX: ${{ matrix.compiler == 'LLVM' && 'clang++' || 'g++' }}
CXXFLAGS: ${{ (matrix.build_system == 'CMake' && matrix.compiler == 'GNU') && '--coverage' || '' }}
image: ${{ matrix.image }}
steps:
- name: Install `git` (Amazon Linux 2)
Expand All @@ -88,7 +86,10 @@ jobs:
CFLAGS: -Wno-implicit-function-declaration
LDFLAGS: -undefined dynamic_lookup
LIBRARY_PATH: /usr/local/lib
name: ${{ matrix.os }} (${{ matrix.build_system }}) (${{ matrix.compiler }})
name: >-
${{ matrix.os }}
(${{ matrix.build_system }})
(${{ matrix.compiler }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
Expand Down Expand Up @@ -132,12 +133,51 @@ jobs:
uses: ./.github/actions/install

FreeBSD:
if: contains(github.ref, 'master') || contains(github.ref, 'develop')
name: FreeBSD (CMake) (LLVM)
runs-on: macos-12
env:
BUILD_PARALLEL_LEVEL: 4
LIBRARY_PATH: /usr/local/lib
TMPDIR: /tmp
name: >-
${{ matrix.box_generic }}
(${{ matrix.build_system }})
(${{ matrix.compiler }})
runs-on: macos-latest
strategy:
matrix:
box_generic:
- freebsd12
build_system:
- CMake
compiler:
- LLVM
on_default_branch:
- ${{ contains(github.ref, 'master') || contains(github.ref, 'develop') }}
include:
- box_generic: freebsd13
build_system: CMake
compiler: LLVM
exclude:
- on_default_branch: false
fail-fast: false
steps:
- name: Checkout code
uses: actions/checkout@v3

- name: Install dependencies, Build, Test & Install `mod_tile`
uses: ./.github/actions/freebsd
- name: Provision VM
uses: hummeltech/freebsd-vagrant-action@v1.3
with:
box: generic/${{ matrix.box_generic }}
cpus: ${{ env.BUILD_PARALLEL_LEVEL }}
memory: 4096

- name: Install dependencies
uses: ./.github/actions/dependencies/install

- name: Build `mod_tile`
uses: ./.github/actions/build

- name: Test `mod_tile`
uses: ./.github/actions/test

- name: Install `mod_tile`
uses: ./.github/actions/install
6 changes: 1 addition & 5 deletions docs/build/building_on_freebsd.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,10 @@ This document provides users with step-by-step instructions on how to compile an

Please see our [Continuous Integration script](/.github/workflows/build-and-test.yml) for more details.

## FreeBSD 13.0/13.1/13.2
## FreeBSD 12/13
```shell
#!/usr/bin/env sh

# Mapnik & GDAL w/ working GPKG support are not in the `quarterly` repository (2023.05.04)
sudo mkdir -p /usr/local/etc/pkg/repos
sudo sed 's#/quarterly#/latest#g' /etc/pkg/FreeBSD.conf > /usr/local/etc/pkg/repos/FreeBSD.conf

# Update installed packages
sudo pkg upgrade --yes

Expand Down
14 changes: 14 additions & 0 deletions tests/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -83,6 +83,7 @@ add_test(
add_test(
NAME create_dirs
COMMAND ${MKDIR_EXECUTABLE} -p -v logs run tiles
WORKING_DIRECTORY tests
)
add_test(
NAME start_renderd
Expand All @@ -94,14 +95,17 @@ add_test(
echo 'exit 0' >> ${PROJECT_BINARY_DIR}/tests/renderd_start.sh
${BASH} ${PROJECT_BINARY_DIR}/tests/renderd_start.sh
"
WORKING_DIRECTORY tests
)
add_test(
NAME start_httpd
COMMAND ${HTTPD_EXECUTABLE} -e debug -f ${PROJECT_BINARY_DIR}/tests/conf/httpd.conf -k start
WORKING_DIRECTORY tests
)
add_test(
NAME render_speedtest
COMMAND render_speedtest --map ${MAP_NAME} --max-zoom 10 --socket ${PROJECT_BINARY_DIR}/tests/run/renderd.sock
WORKING_DIRECTORY tests
)
add_test(
NAME render_expired
Expand All @@ -114,6 +118,7 @@ add_test(
--socket ${PROJECT_BINARY_DIR}/tests/run/renderd.sock \
--tile-dir ${PROJECT_BINARY_DIR}/tests/tiles
"
WORKING_DIRECTORY tests
)
add_test(
NAME render_list
Expand All @@ -128,6 +133,7 @@ add_test(
--socket ${PROJECT_BINARY_DIR}/tests/run/renderd.sock \
--tile-dir ${PROJECT_BINARY_DIR}/tests/tiles
"
WORKING_DIRECTORY tests
)
add_test(
NAME render_old
Expand All @@ -142,6 +148,7 @@ add_test(
--socket ${PROJECT_BINARY_DIR}/tests/run/renderd.sock \
--tile-dir ${PROJECT_BINARY_DIR}/tests/tiles
"
WORKING_DIRECTORY tests
)
add_test(
NAME download_tiles
Expand All @@ -167,6 +174,7 @@ add_test(
sleep 1;
done
"
WORKING_DIRECTORY tests
)
add_test(
NAME check_tiles
Expand All @@ -177,6 +185,7 @@ add_test(
(echo '${TILE_PNG32_SHA256SUM} tile.png32' | ${SHA256SUM_EXECUTABLE} -c) && \
((echo '${TILE_WEBP_SHA256SUM_7} tile.webp' | ${SHA256SUM_EXECUTABLE} -c) || (echo '${TILE_WEBP_SHA256SUM_6} tile.webp' | ${SHA256SUM_EXECUTABLE} -c) || (echo '${TILE_WEBP_SHA256SUM_4} tile.webp' | ${SHA256SUM_EXECUTABLE} -c))
"
WORKING_DIRECTORY tests
)
add_test(
NAME dirty_tile
Expand All @@ -193,29 +202,34 @@ add_test(
sleep 1;
done
"
WORKING_DIRECTORY tests
)
add_test(
NAME remove_tiles
COMMAND ${RM} -v tile.png tile.jpg tile.png256 tile.png32 tile.webp
WORKING_DIRECTORY tests
)
add_test(
NAME stop_renderd
COMMAND ${BASH} -c "
${KILL_EXECUTABLE} $(${CAT_EXECUTABLE} run/renderd1.pid) && ${RM} run/renderd1.pid
${KILL_EXECUTABLE} $(${CAT_EXECUTABLE} run/renderd.pid) && ${RM} run/renderd.pid
"
WORKING_DIRECTORY tests
)
add_test(
NAME stop_httpd
COMMAND ${BASH} -c "
${KILL_EXECUTABLE} $(${CAT_EXECUTABLE} run/httpd.pid) && ${RM} run/httpd.pid
"
WORKING_DIRECTORY tests
)
add_test(
NAME clear_dirs
COMMAND ${BASH} -c "
${RM} -f -r -v logs/* run/* tiles/*
"
WORKING_DIRECTORY tests
)


Expand Down

0 comments on commit d13186a

Please sign in to comment.