Dist-Zilla-PluginBundle-Author-GETTY
view release on metacpan or search on metacpan
simpici-provider/emit.sh view on Meta::CPAN
#!/bin/sh
# SimpiCI provider for [@Author::GETTY] distributions.
#
# SimpiCI runs this image once, read-only over the checkout, with a private
# writable directory at $CICD_PROVIDER_OUT. We write one `.sh` job file per
# supported Perl version into $CICD_PROVIDER_OUT; SimpiCI merges them into the
# staging .cicd WITHOUT overwriting a repository's own files, so a dist that
# ships its own `perl+5.40+test.sh` keeps it. We receive no registry
# credentials and no Docker socket by design.
#
# The generated jobs run LATER, each in a `perl:<ver>` container, with the
# checkout read-only at /workspace and the staging dir read-only at /cicd
# (CICD_ROOT=/cicd). They source the shared helper we also drop in lib/.
set -eu
: "${CICD_PROVIDER_OUT:?must be run by SimpiCI (CICD_PROVIDER_OUT is unset)}"
# Version matrix, most specific wins: a `.simpici-perl` file in the checkout (for
# a dist that can't run the full range -- e.g. one whose .simpici-apt needs a
# Debian release the oldest perl:<ver> images no longer serve packages for), else
# the per-run SIMPICI_PROVIDER_PERL_VERSIONS override, else the baked-in default.
# `#` starts a comment; whitespace and newlines separate versions.
if [ -f "${CICD_WORKSPACE:-/workspace}/.simpici-perl" ]; then
versions="$(sed 's/#.*//' "${CICD_WORKSPACE:-/workspace}/.simpici-perl")"
elif [ -n "${SIMPICI_PROVIDER_PERL_VERSIONS:-}" ]; then
versions="$SIMPICI_PROVIDER_PERL_VERSIONS"
else
versions="$(cat /opt/simpici-provider/perl-versions)"
fi
mkdir -p "$CICD_PROVIDER_OUT/lib"
# Shared helper. The checkout is read-only and `dzil test` writes .build/, so we
# copy the checkout into the writable $CICD_OUTPUT and build there. This mirrors
# the bundle's own .github/actions/dzil-test composite action.
cat > "$CICD_PROVIDER_OUT/lib/dzil-test.sh" <<'HELPER'
#!/usr/bin/env bash
set -euo pipefail
src="$CICD_OUTPUT/src"
mkdir -p "$src"
cp -a "$CICD_WORKSPACE"/. "$src"/
git config --global --add safe.directory "$src"
cd "$src"
# System packages the dist needs before its Perl deps will build. A libgit2-
# backed dist lists the cmake/-dev toolchain here so Alien::Libgit2 can build
# libgit2 from source; a pure-perl dist ships no file and apt is never touched.
# One package per whitespace token; `#` starts a comment to end of line.
if [ -f .simpici-apt ]; then
apt_pkgs="$(sed 's/#.*//' .simpici-apt | tr '\n' ' ')"
if [ -n "${apt_pkgs// /}" ]; then
apt-get update -qq
apt-get install -y --no-install-recommends $apt_pkgs
fi
fi
# `dzil test` triggers a build, and a dist with [@Author::GETTY::Docker] would
# otherwise try to reach a container engine and build an image from here -- there
# is none in a perl:<ver> CI container, so the build would die in its precheck.
# CI tests the code, not images; skip it. Harmless for a dist without Docker.
export DZIL_DOCKER_API_SKIP=1
export PERL_CPANM_OPT="${PERL_CPANM_OPT:---mirror https://cpan.metacpan.org --mirror-only}"
cpanm -nq Dist::Zilla
dzil authordeps --missing | cpanm -nq
dzil listdeps --author --missing | cpanm -nq
dzil test
HELPER
chmod +x "$CICD_PROVIDER_OUT/lib/dzil-test.sh"
( run in 0.634 second using v1.01-cache-2.11-cpan-007c89162af )