From c3b319ba64be10fccea6a137ba15d8324b6897c2 Mon Sep 17 00:00:00 2001 From: Roman Nikonov Date: Sun, 22 Dec 2024 20:40:49 +0100 Subject: [PATCH] internal: check Linux build on commonly used distros --- .github/workflows/pr-ubuntu-docker.yml | 32 ++++++++++++++++++++++---- misc/deps_linux/ubuntu-2204.json | 3 +++ misc/deps_linux/ubuntu-2404.json | 3 +++ misc/deps_linux/vcpkg-deps.sh | 8 +++++++ 4 files changed, 41 insertions(+), 5 deletions(-) create mode 100644 misc/deps_linux/ubuntu-2204.json create mode 100644 misc/deps_linux/ubuntu-2404.json create mode 100644 misc/deps_linux/vcpkg-deps.sh diff --git a/.github/workflows/pr-ubuntu-docker.yml b/.github/workflows/pr-ubuntu-docker.yml index 56a655506c..94db61f3ff 100644 --- a/.github/workflows/pr-ubuntu-docker.yml +++ b/.github/workflows/pr-ubuntu-docker.yml @@ -11,6 +11,18 @@ env: jobs: pr-ubuntu-docker: + strategy: + matrix: + base_system: + # The usual container used for all builds within the CI and the one + # we use as the base for server builds with preinstalled/cached deps + - vcpkg-deps + + # Distros that our contributors are likely to run + # - ubuntu-2204 + # - ubuntu-2404 + # - debian + # - archlinux runs-on: ubuntu-latest steps: - name: Checkout @@ -20,7 +32,17 @@ jobs: - name: Get image to build upon run: | + set -x # print executed commands cat ${{github.workspace}}/misc/github_env_linux >> "$GITHUB_ENV" + # get latest image + base_image="`misc/deps_linux/${{ matrix.base_system }}.sh --get-image-uri`" + docker run -it \ + --name prepare_deps_container \ + -v "${{github.workspace}}:/src" \ + "$base_image" \ + bash -c bash \ + 'misc/deps_linux/${{ matrix.base_system }}.sh --ensure-deps-noninteractive' + docker commit prepare_deps_container localhost/buildimage - name: Store SP types from commit run: | @@ -58,7 +80,7 @@ jobs: - name: Prepare uses: addnab/docker-run-action@v3 with: - image: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }} + image: localhost/buildimage options: | -v ${{github.workspace}}:/src run: | @@ -68,7 +90,7 @@ jobs: id: cmake_configure uses: addnab/docker-run-action@v3 with: - image: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }} + image: localhost/buildimage options: | -v ${{github.workspace}}:/src -u skymp @@ -94,7 +116,7 @@ jobs: - name: Build uses: addnab/docker-run-action@v3 with: - image: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }} + image: localhost/buildimage options: | -v ${{github.workspace}}:/src -u skymp @@ -105,7 +127,7 @@ jobs: - name: Prepare dist.tar.gz uses: addnab/docker-run-action@v3 with: - image: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }} + image: localhost/buildimage options: | -v ${{github.workspace}}:/src -u skymp @@ -164,7 +186,7 @@ jobs: - name: Test uses: addnab/docker-run-action@v3 with: - image: ${{ env.SKYMP_VCPKG_DEPS_IMAGE }} + image: localhost/buildimage options: | -v ${{github.workspace}}:/src -u skymp diff --git a/misc/deps_linux/ubuntu-2204.json b/misc/deps_linux/ubuntu-2204.json new file mode 100644 index 0000000000..2ea3398ef1 --- /dev/null +++ b/misc/deps_linux/ubuntu-2204.json @@ -0,0 +1,3 @@ +{ + "image": "ubuntu:22.04" +} diff --git a/misc/deps_linux/ubuntu-2404.json b/misc/deps_linux/ubuntu-2404.json new file mode 100644 index 0000000000..e704a44c4c --- /dev/null +++ b/misc/deps_linux/ubuntu-2404.json @@ -0,0 +1,3 @@ +{ + "image": "ubuntu:24.04" +} diff --git a/misc/deps_linux/vcpkg-deps.sh b/misc/deps_linux/vcpkg-deps.sh new file mode 100644 index 0000000000..8d52ab856b --- /dev/null +++ b/misc/deps_linux/vcpkg-deps.sh @@ -0,0 +1,8 @@ +#!/usr/bin/env bash + +if [[ "$1" == "--get-image-uri" ]]; then + . misc/github_env_linux && echo "$SKYMP_VCPKG_DEPS_IMAGE" + exit +elif [[ "$1" == "--ensure-deps-noninteractive" ]]; then + # Nothing to prepare, vcpkg-deps image already contains all we need +fi