ci: Move execution method of tasks into yaml templates

This is done in preparation for making the compute resources for CI
configurable. It also looks cleaner.

Reviewed-by: Daniel Gustafsson <daniel@yesql.se>
Discussion: https://postgr.es/m/20230808021541.7lbzdefvma7qmn3w@awork3.anarazel.de
Backpatch: 15-, where CI support was added
This commit is contained in:
Andres Freund 2023-08-23 12:30:23 -07:00
parent 89daa5ae30
commit 462f4df0a8
1 changed files with 55 additions and 22 deletions

View File

@ -9,6 +9,7 @@ env:
GCP_PROJECT: pg-ci-images GCP_PROJECT: pg-ci-images
IMAGE_PROJECT: $GCP_PROJECT IMAGE_PROJECT: $GCP_PROJECT
CONTAINER_REPO: us-docker.pkg.dev/${GCP_PROJECT}/ci CONTAINER_REPO: us-docker.pkg.dev/${GCP_PROJECT}/ci
DISK_SIZE: 25
# The lower depth accelerates git clone. Use a bit of depth so that # The lower depth accelerates git clone. Use a bit of depth so that
# concurrent tasks and retrying older jobs have a chance of working. # concurrent tasks and retrying older jobs have a chance of working.
@ -27,6 +28,45 @@ env:
PG_TEST_EXTRA: kerberos ldap ssl PG_TEST_EXTRA: kerberos ldap ssl
# Define how to run various types of tasks.
# VMs provided by cirrus-ci. Each user has a limited number of "free" credits
# for testing.
cirrus_community_vm_template: &cirrus_community_vm_template
compute_engine_instance:
image_project: $IMAGE_PROJECT
image: family/$IMAGE_FAMILY
platform: $PLATFORM
cpu: $CPUS
disk: $DISK_SIZE
default_linux_task_template: &linux_task_template
env:
PLATFORM: linux
<<: *cirrus_community_vm_template
default_freebsd_task_template: &freebsd_task_template
env:
PLATFORM: freebsd
<<: *cirrus_community_vm_template
default_windows_task_template: &windows_task_template
env:
PLATFORM: windows
<<: *cirrus_community_vm_template
# macos workers provided by cirrus-ci
default_macos_task_template: &macos_task_template
env:
PLATFORM: macos
macos_instance:
image: $IMAGE
# What files to preserve in case tests fail # What files to preserve in case tests fail
on_failure: &on_failure on_failure: &on_failure
log_artifacts: log_artifacts:
@ -45,17 +85,14 @@ task:
CPUS: 2 CPUS: 2
BUILD_JOBS: 3 BUILD_JOBS: 3
TEST_JOBS: 3 TEST_JOBS: 3
IMAGE_FAMILY: pg-ci-freebsd-13
DISK_SIZE: 50
CCACHE_DIR: /tmp/ccache_dir CCACHE_DIR: /tmp/ccache_dir
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*freebsd.*' <<: *freebsd_task_template
compute_engine_instance: only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*freebsd.*'
image_project: $IMAGE_PROJECT
image: family/pg-ci-freebsd-13
platform: freebsd
cpu: $CPUS
disk: 50
sysinfo_script: | sysinfo_script: |
id id
@ -152,19 +189,16 @@ task:
CPUS: 4 CPUS: 4
BUILD_JOBS: 4 BUILD_JOBS: 4
TEST_JOBS: 8 # experimentally derived to be a decent choice TEST_JOBS: 8 # experimentally derived to be a decent choice
IMAGE_FAMILY: pg-ci-bullseye
CCACHE_DIR: /tmp/ccache_dir CCACHE_DIR: /tmp/ccache_dir
DEBUGINFOD_URLS: "https://debuginfod.debian.net" DEBUGINFOD_URLS: "https://debuginfod.debian.net"
LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES LINUX_CONFIGURE_FEATURES: *LINUX_CONFIGURE_FEATURES
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*' <<: *linux_task_template
compute_engine_instance: only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*linux.*'
image_project: $IMAGE_PROJECT
image: family/pg-ci-bullseye
platform: linux
cpu: $CPUS
ccache_cache: ccache_cache:
folder: ${CCACHE_DIR} folder: ${CCACHE_DIR}
@ -228,15 +262,15 @@ task:
# work OK. See # work OK. See
# https://postgr.es/m/20220927040208.l3shfcidovpzqxfh%40awork3.anarazel.de # https://postgr.es/m/20220927040208.l3shfcidovpzqxfh%40awork3.anarazel.de
TEST_JOBS: 8 TEST_JOBS: 8
IMAGE: ghcr.io/cirruslabs/macos-ventura-base:latest
CIRRUS_WORKING_DIR: ${HOME}/pgsql/ CIRRUS_WORKING_DIR: ${HOME}/pgsql/
CCACHE_DIR: ${HOME}/ccache CCACHE_DIR: ${HOME}/ccache
MACPORTS_CACHE: ${HOME}/macports-cache MACPORTS_CACHE: ${HOME}/macports-cache
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*' <<: *macos_task_template
macos_instance: only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*(macos|darwin|osx).*'
image: ghcr.io/cirruslabs/macos-ventura-base:latest
sysinfo_script: | sysinfo_script: |
id id
@ -360,6 +394,8 @@ task:
# build # build
MSBFLAGS: -m -verbosity:minimal "-consoleLoggerParameters:Summary;ForceNoAlign" /p:TrackFileAccess=false -nologo MSBFLAGS: -m -verbosity:minimal "-consoleLoggerParameters:Summary;ForceNoAlign" /p:TrackFileAccess=false -nologo
DISK_SIZE: 50
# If tests hang forever, cirrus eventually times out. In that case log # If tests hang forever, cirrus eventually times out. In that case log
# output etc is not uploaded, making the problem hard to debug. Of course # output etc is not uploaded, making the problem hard to debug. Of course
# tests internally should have shorter timeouts, but that's proven to not # tests internally should have shorter timeouts, but that's proven to not
@ -382,15 +418,12 @@ task:
# given that it explicitly prevents crash dumps from working... # given that it explicitly prevents crash dumps from working...
# 0x8001 is SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX # 0x8001 is SEM_FAILCRITICALERRORS | SEM_NOOPENFILEERRORBOX
CIRRUS_WINDOWS_ERROR_MODE: 0x8001 CIRRUS_WINDOWS_ERROR_MODE: 0x8001
IMAGE_FAMILY: pg-ci-windows-ci-vs-2019
<<: *windows_task_template
only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*' only_if: $CIRRUS_CHANGE_MESSAGE !=~ '.*\nci-os-only:.*' || $CIRRUS_CHANGE_MESSAGE =~ '.*\nci-os-only:[^\n]*windows.*'
compute_engine_instance:
image_project: $IMAGE_PROJECT
image: family/pg-ci-windows-ci-vs-2019
platform: windows
cpu: $CPUS
sysinfo_script: | sysinfo_script: |
chcp chcp
systeminfo systeminfo