From e7e1eca30cd084439ce178659309a52aaba2787c Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Thu, 11 Apr 2024 21:50:14 +0000 Subject: [PATCH 01/15] Initial commit of GitHub Action --- .devcontainer/devcontainer.json | 34 +----------------- .github/workflows/devcontainer-ci.yml | 29 +++++++++++++++ .../iggy-cpp-build/.devcontainer/Dockerfile | 4 +++ .../.devcontainer/devcontainer.json | 35 +++++++++++++++++++ images/iggy-cpp-build/README.md | 6 ++++ 5 files changed, 75 insertions(+), 33 deletions(-) create mode 100644 .github/workflows/devcontainer-ci.yml create mode 100644 images/iggy-cpp-build/.devcontainer/Dockerfile create mode 100644 images/iggy-cpp-build/.devcontainer/devcontainer.json create mode 100644 images/iggy-cpp-build/README.md diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index aa18fe6..bcaad0a 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,38 +1,6 @@ { "name": "Iggy C++ Client", - "build": { - "dockerfile": "Dockerfile" - }, - "features": { - "ghcr.io/devcontainers/features/common-utils:2": {}, - "ghcr.io/devcontainers/features/docker-in-docker:2": {}, - "ghcr.io/devcontainers/features/github-cli:1": {}, - "ghcr.io/devcontainers-contrib/features/act:1": {}, - "ghcr.io/devcontainers-contrib/features/apt-packages": { - "packages": [ - "autoconf", - "autoconf-archive", - "automake", - "build-essential", - "clang-format", - "clang-tidy", - "doxygen", - "gcovr", - "graphviz", - "lcov", - "libtool", - "ninja-build", - "python3", - "xdg-utils" - ] - }, - "ghcr.io/devcontainers-contrib/features/markdownlint-cli2:1": {}, - "ghcr.io/devcontainers-contrib/features/pre-commit:2": {}, - "ghcr.io/dhoeric/features/hadolint:1": {}, - "ghcr.io/msclock/features/vcpkg:1": { - "vcpkgversion": "stable" - } - }, + "image": "docker.io/iggy/iggy-cpp-build:latest", "customizations": { "vscode": { "extensions": [ diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml new file mode 100644 index 0000000..231d909 --- /dev/null +++ b/.github/workflows/devcontainer-ci.yml @@ -0,0 +1,29 @@ +--- +name: devcontainer-ci + +on: + push: + paths: + - images/iggy-cpp-build/.devcontainer/* + +permissions: read-all + +jobs: + build: + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Login to Docker Hub + uses: docker/login-action@v2 + with: + registry: docker.io + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - name: Pre-build image and run make ci-build in dev container + uses: devcontainers/ci@v0.3 + with: + imageName: docker.io/iggy/iggy-cpp-build + cacheFrom: docker.io/iggy/iggy-cpp-build + push: always diff --git a/images/iggy-cpp-build/.devcontainer/Dockerfile b/images/iggy-cpp-build/.devcontainer/Dockerfile new file mode 100644 index 0000000..2b54675 --- /dev/null +++ b/images/iggy-cpp-build/.devcontainer/Dockerfile @@ -0,0 +1,4 @@ +FROM mcr.microsoft.com/devcontainers/cpp:1-ubuntu-22.04 + +# workaround for msclock build issue on arm +ENV VCPKG_FORCE_SYSTEM_BINARIES=1 diff --git a/images/iggy-cpp-build/.devcontainer/devcontainer.json b/images/iggy-cpp-build/.devcontainer/devcontainer.json new file mode 100644 index 0000000..218f9e6 --- /dev/null +++ b/images/iggy-cpp-build/.devcontainer/devcontainer.json @@ -0,0 +1,35 @@ +{ + "build": { + "dockerfile": "Dockerfile" + }, + "features": { + "ghcr.io/devcontainers/features/common-utils:2": {}, + "ghcr.io/devcontainers/features/docker-in-docker:2": {}, + "ghcr.io/devcontainers/features/github-cli:1": {}, + "ghcr.io/devcontainers-contrib/features/act:1": {}, + "ghcr.io/devcontainers-contrib/features/apt-packages": { + "packages": [ + "autoconf", + "autoconf-archive", + "automake", + "build-essential", + "clang-format", + "clang-tidy", + "doxygen", + "gcovr", + "graphviz", + "lcov", + "libtool", + "ninja-build", + "python3", + "xdg-utils" + ] + }, + "ghcr.io/devcontainers-contrib/features/markdownlint-cli2:1": {}, + "ghcr.io/devcontainers-contrib/features/pre-commit:2": {}, + "ghcr.io/dhoeric/features/hadolint:1": {}, + "ghcr.io/msclock/features/vcpkg:1": { + "vcpkgversion": "stable" + } + } +} diff --git a/images/iggy-cpp-build/README.md b/images/iggy-cpp-build/README.md new file mode 100644 index 0000000..50388db --- /dev/null +++ b/images/iggy-cpp-build/README.md @@ -0,0 +1,6 @@ + +# Iggy C++ Build Container + +This directory contains the source for the pre-built devcontainer referenced in `.devcontainer` at the top level. + +Under normal circumstances you should not need to modify or load this; it gets build in a dedicated GitHub Action. From 702bc2cf01899c0032aa9903c37e4d6fcfde1ab3 Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 17:25:59 +0000 Subject: [PATCH 02/15] Add multiple platform build for devcontainer --- .github/workflows/devcontainer-ci.yml | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index 231d909..a0b37fe 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -11,10 +11,18 @@ permissions: read-all jobs: build: runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + platform: + - linux/amd64 + - linux/arm/v7 + - linux/arm64 steps: - name: Checkout uses: actions/checkout@v3 - + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 - name: Login to Docker Hub uses: docker/login-action@v2 with: From 50115bfc4603deeb80d9a168e8faffd67f5257f7 Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 17:28:44 +0000 Subject: [PATCH 03/15] Switch to using native multi-platform support in devcontainers/ci --- .github/workflows/devcontainer-ci.yml | 12 +++++------- 1 file changed, 5 insertions(+), 7 deletions(-) diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index a0b37fe..42f1480 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -11,18 +11,15 @@ permissions: read-all jobs: build: runs-on: ubuntu-latest - strategy: - fail-fast: false - matrix: - platform: - - linux/amd64 - - linux/arm/v7 - - linux/arm64 steps: - name: Checkout uses: actions/checkout@v3 - name: Set up QEMU uses: docker/setup-qemu-action@v3 + - name: Setup Docker buildx for multi-architecture builds + uses: docker/setup-buildx-action@v3 + with: + use: true - name: Login to Docker Hub uses: docker/login-action@v2 with: @@ -34,4 +31,5 @@ jobs: with: imageName: docker.io/iggy/iggy-cpp-build cacheFrom: docker.io/iggy/iggy-cpp-build + platform: linux/amd64,linux/arm/v7,linux/arm64 push: always From 827826d5b5333f98cb7945a262db516346ee79fc Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 17:31:07 +0000 Subject: [PATCH 04/15] Add trigger if GitHub Action workflow definition updated --- .github/workflows/devcontainer-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index 42f1480..58f4730 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -4,6 +4,7 @@ name: devcontainer-ci on: push: paths: + - .github/workflows/devcontainer-ci.yml - images/iggy-cpp-build/.devcontainer/* permissions: read-all From d2faf7f5960b1defb665f5cde45bb30ad8d8e263 Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 17:33:17 +0000 Subject: [PATCH 05/15] Temporarily remove cacheFrom to work around issue --- .github/workflows/devcontainer-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index 58f4730..1a93bae 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -31,6 +31,5 @@ jobs: uses: devcontainers/ci@v0.3 with: imageName: docker.io/iggy/iggy-cpp-build - cacheFrom: docker.io/iggy/iggy-cpp-build platform: linux/amd64,linux/arm/v7,linux/arm64 push: always From 352ffec34a75f6694014e064c9bdc511f7461dc5 Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 17:36:29 +0000 Subject: [PATCH 06/15] Fix the Iggy Docker repository name --- .devcontainer/devcontainer.json | 2 +- .github/workflows/devcontainer-ci.yml | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/.devcontainer/devcontainer.json b/.devcontainer/devcontainer.json index bcaad0a..5a42fe2 100644 --- a/.devcontainer/devcontainer.json +++ b/.devcontainer/devcontainer.json @@ -1,6 +1,6 @@ { "name": "Iggy C++ Client", - "image": "docker.io/iggy/iggy-cpp-build:latest", + "image": "docker.io/iggyrs/iggy-cpp-build:latest", "customizations": { "vscode": { "extensions": [ diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index 1a93bae..64a1de3 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -30,6 +30,7 @@ jobs: - name: Pre-build image and run make ci-build in dev container uses: devcontainers/ci@v0.3 with: - imageName: docker.io/iggy/iggy-cpp-build + imageName: docker.io/iggyrs/iggy-cpp-build + cacheFrom: docker.io/iggyrs/iggy-cpp-build platform: linux/amd64,linux/arm/v7,linux/arm64 push: always From f27a9ab3a4ea38436f4086f95f687ef87e9ec766 Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 17:45:12 +0000 Subject: [PATCH 07/15] Another attempt to work around docker inspect failures --- .github/workflows/devcontainer-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index 64a1de3..7db30d6 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -33,4 +33,3 @@ jobs: imageName: docker.io/iggyrs/iggy-cpp-build cacheFrom: docker.io/iggyrs/iggy-cpp-build platform: linux/amd64,linux/arm/v7,linux/arm64 - push: always From aa98599636c29354c828a958cb13ad5ca8bbdeb9 Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 18:15:22 +0000 Subject: [PATCH 08/15] Turn back on push-always --- .github/workflows/devcontainer-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index 7db30d6..64a1de3 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -33,3 +33,4 @@ jobs: imageName: docker.io/iggyrs/iggy-cpp-build cacheFrom: docker.io/iggyrs/iggy-cpp-build platform: linux/amd64,linux/arm/v7,linux/arm64 + push: always From 30e1eff1dd40dc27a30c2a68ee40a3511b02a2d1 Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 18:17:26 +0000 Subject: [PATCH 09/15] Remove cacheFrom --- .github/workflows/devcontainer-ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index 64a1de3..ac0fe65 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -31,6 +31,5 @@ jobs: uses: devcontainers/ci@v0.3 with: imageName: docker.io/iggyrs/iggy-cpp-build - cacheFrom: docker.io/iggyrs/iggy-cpp-build platform: linux/amd64,linux/arm/v7,linux/arm64 push: always From bb4b861058c0190943a36c6357630d1591d8c9c2 Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 18:19:39 +0000 Subject: [PATCH 10/15] Force caching off --- .github/workflows/devcontainer-ci.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index ac0fe65..885dbcc 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -32,4 +32,5 @@ jobs: with: imageName: docker.io/iggyrs/iggy-cpp-build platform: linux/amd64,linux/arm/v7,linux/arm64 + noCache: true push: always From 15feb460ff577d405ec9d3f4810b94c3d4ac8b28 Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 18:22:26 +0000 Subject: [PATCH 11/15] Try stripping out docker.io --- .github/workflows/devcontainer-ci.yml | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index 885dbcc..434371e 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -24,13 +24,12 @@ jobs: - name: Login to Docker Hub uses: docker/login-action@v2 with: - registry: docker.io username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - name: Pre-build image and run make ci-build in dev container uses: devcontainers/ci@v0.3 with: - imageName: docker.io/iggyrs/iggy-cpp-build + imageName: iggyrs/iggy-cpp-build platform: linux/amd64,linux/arm/v7,linux/arm64 noCache: true push: always From e58e12bec314cbc06add60a8e73eec3e98c2488b Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 18:25:55 +0000 Subject: [PATCH 12/15] Fix missing subFolder --- .github/workflows/devcontainer-ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index 434371e..28a698b 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -29,7 +29,8 @@ jobs: - name: Pre-build image and run make ci-build in dev container uses: devcontainers/ci@v0.3 with: + subFolder: images/iggy-cpp-build imageName: iggyrs/iggy-cpp-build + cacheFrom: iggyrs/iggy-cpp-build platform: linux/amd64,linux/arm/v7,linux/arm64 - noCache: true push: always From b20b78894eb40021a64ab0aa3f489343c8fc6401 Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 18:28:54 +0000 Subject: [PATCH 13/15] Remove unsupport platform --- .github/workflows/devcontainer-ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index 28a698b..f86a530 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -32,5 +32,5 @@ jobs: subFolder: images/iggy-cpp-build imageName: iggyrs/iggy-cpp-build cacheFrom: iggyrs/iggy-cpp-build - platform: linux/amd64,linux/arm/v7,linux/arm64 + platform: linux/amd64,linux/arm64 push: always From 0ff9b03ac4dad45b2fa2e92159e9bca1756d2c59 Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 19:10:30 +0000 Subject: [PATCH 14/15] Cosmetic improvements --- .github/workflows/devcontainer-ci.yml | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index f86a530..550ad1b 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -7,10 +7,13 @@ on: - .github/workflows/devcontainer-ci.yml - images/iggy-cpp-build/.devcontainer/* +env: + DOCKERHUB_REGISTRY_NAME: iggyrs/iggy-cpp-build + permissions: read-all jobs: - build: + pre-build-container: runs-on: ubuntu-latest steps: - name: Checkout @@ -26,11 +29,11 @@ jobs: with: username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - - name: Pre-build image and run make ci-build in dev container + - name: Pre-build image uses: devcontainers/ci@v0.3 with: subFolder: images/iggy-cpp-build - imageName: iggyrs/iggy-cpp-build - cacheFrom: iggyrs/iggy-cpp-build + imageName: ${{ env.DOCKERHUB_REGISTRY_NAME }} + cacheFrom: ${{ env.DOCKERHUB_REGISTRY_NAME }} platform: linux/amd64,linux/arm64 push: always From d0ec2aa9ff90126d9b21e0e47abf8af309b6928f Mon Sep 17 00:00:00 2001 From: 0xG0nz0 <8682922+0xg0nz0@users.noreply.github.com> Date: Sat, 13 Apr 2024 19:18:14 +0000 Subject: [PATCH 15/15] Workaround for old version of Skopeo --- .github/workflows/devcontainer-ci.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/devcontainer-ci.yml b/.github/workflows/devcontainer-ci.yml index 550ad1b..b8e2841 100644 --- a/.github/workflows/devcontainer-ci.yml +++ b/.github/workflows/devcontainer-ci.yml @@ -24,6 +24,16 @@ jobs: uses: docker/setup-buildx-action@v3 with: use: true + - name: Install updated Skopeo + # This can be omitted once runner images have a version of Skopeo > 1.4.1 + # See https://github.com/containers/skopeo/issues/1874 + run: | + REPO_URL="https://download.opensuse.org/repositories/devel:/kubic:/libcontainers:/unstable/xUbuntu_22.04" + sudo sh -c "echo 'deb ${REPO_URL}/ /' > /etc/apt/sources.list.d/skopeo.list" + curl -fsSL ${REPO_URL}/Release.key | gpg --dearmor | sudo tee /etc/apt/trusted.gpg.d/skopeo.gpg > /dev/null + + sudo apt update + sudo apt install skopeo - name: Login to Docker Hub uses: docker/login-action@v2 with: