From 976c45e36ab65cc0cc592ff5bfab2757ea709731 Mon Sep 17 00:00:00 2001 From: Alexander Turenko Date: Tue, 27 Feb 2024 00:35:56 +0300 Subject: [PATCH 1/2] ci: simplify container jobs The list of the changes is the following. * Transformed `--no-install-recommends` and `--no-install-suggests` into `apt-get` configuration options to bring them into `apt-get` commands run by the `setup-tarantool` action. It reduces a list of installed dependencies and, so, reduces a size of the cache file (~200MB to ~30MB). * Eliminated `apt-get upgrade`, because I see no reason to perform it. Kept `apt-get update` (refreshing of repositories metadata). * Extracted the `tzdata` package installation to make the reason of this step clear. * Clarified the `setup-node` invocation to make it clear that it is not a required step for using the setup-tarantool action is a container job. * Updated setup-node action to v4, updated nodejs version to 20. Part of #47 --- .github/workflows/test-docker.yml | 35 ++++++++++++++++++++++++------- 1 file changed, 27 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test-docker.yml b/.github/workflows/test-docker.yml index 8bbc699..d0bce49 100644 --- a/.github/workflows/test-docker.yml +++ b/.github/workflows/test-docker.yml @@ -32,20 +32,39 @@ jobs: env: TARANTOOL_CACHE_KEY_SUFFIX: -DA-${{ matrix.image }}-${{ github.run_id }} DEBIAN_FRONTEND: noninteractive - TZ: Etc/UTC steps: - - name: Setup system + - name: Configure apt-get + run: | + mkdir -p /etc/apt/apt.conf.d + printf '%s\n%s\n' \ + 'APT::Install-Recommends "false";' \ + 'APT::Install-Suggests "false";' \ + > /etc/apt/apt.conf.d/no-recommends-no-suggests.conf + + - name: Update repositories metadata run: | apt-get -y update - apt-get -y upgrade - apt-get -y install --no-install-recommends --no-install-suggests \ - tzdata sudo lsb-release gnupg ca-certificates rsync - - name: Setup nodejs - uses: actions/setup-node@v3 + - name: Workaround interactive tzdata configuration problem (gh-50) + run: + apt-get -y install tzdata + + - name: Install setup-tarantool dependencies + run: | + apt-get -y install sudo lsb-release gnupg ca-certificates rsync + + # Bring `node` executable file into PATH for latest-version + # and verify-versions actions. + # + # It is not needed for a usual usage of the setup-tarantool + # action within a container job, because GitHub Action + # runner mounts a volume with a `node` executable into the + # container. + - name: Setup Node.js + uses: actions/setup-node@v4 with: - node-version: '18.18.0' + node-version: 20 - uses: actions/checkout@v4 From 1ec5cc3d841d9363b93f524e3cbd9078ce2cd307 Mon Sep 17 00:00:00 2001 From: Alexander Turenko Date: Tue, 27 Feb 2024 00:46:33 +0300 Subject: [PATCH 2/2] readme: add self-hosted runners and container jobs Running the action on a self-hosted runner or in a container job is supported since PR #45, but it requires a few additional steps. Let's describe them in the README.md file. Fixes #47 --- README.md | 51 +++++++++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 49 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index c198751..f9126fc 100644 --- a/README.md +++ b/README.md @@ -6,8 +6,10 @@ This action will set up [Tarantool](https://www.tarantool.io) environment and ** - When cached, it takes \~1-2s to finish. - The first run takes \~40s. -- Cache size is \~20MB. -- Runs on GitHub-hosted `ubuntu-*` runners only. +- Cache size is 20MB-30MB. +- Runs on GitHub-hosted `ubuntu-*` runners. +- Runs on Debian/Ubuntu self-hosted runners. +- Runs inside Debian/Ubuntu container jobs. # Usage @@ -47,6 +49,51 @@ steps: nightly-build: true ``` +### Self-hosted runners and container jobs + +It requires an additional step to bring dependencies needed for the action +itself. These dependencies are preinstalled on GitHub hosted runners, but a +self-hosted runner and a docker image may miss them. + +Configuring `apt-get` to skip recommended and suggested packages reduces the +cache size from \~200MiB to \~30MiB. + +```yaml +jobs: + myjob: + runs-on: ubuntu-latest + container: + image: debian:bookworm + + env: + DEBIAN_FRONTEND: noninteractive + + steps: + - name: Configure apt-get + run: | + mkdir -p /etc/apt/apt.conf.d + printf '%s\n%s\n' \ + 'APT::Install-Recommends "false";' \ + 'APT::Install-Suggests "false";' \ + > /etc/apt/apt.conf.d/no-recommends-no-suggests.conf + + - name: Update repositories metadata + run: | + apt-get -y update + + - name: Workaround interactive tzdata configuration problem (gh-50) + run: + apt-get -y install tzdata + + - name: Install setup-tarantool dependencies + run: | + apt-get -y install sudo lsb-release gnupg ca-certificates rsync + + - uses: tarantool/setup-tarantool@ab69f5679e6ea7e5872d9e0901f681587fd29be6 + with: + tarantool-version: '2.11' +``` + # License The scripts and documentation in this project are released under the [MIT License](LICENSE).