From ba2b443156dabae0104e11b9c34649892b331b78 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Mon, 24 Jun 2024 16:14:34 +0200 Subject: [PATCH 01/10] .github/workflows/testing.yml: copy Docs secret into docker volume Signed-off-by: Tim Janik --- .github/workflows/testing.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index febf9859..96e9c39f 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -46,11 +46,11 @@ jobs: - name: 'Configure build presets' run: | echo -e ' prefix=/\n CC=clang \n CXX=clang++ \n CLANG_TIDY=clang-tidy ' > config-defaults.mk + (umask 0077 && cat <<< "${{ secrets.SSH_ID_GHDOCS4ANKLANG_ECDSA }}" > .git/.ssh_id_ghdocs4anklang) misc/cirun dir2vol . ;# copy current git to /cirun - name: 'Upload API Docs' # http://tim-janik.github.io/docs/anklang run: | misc/cirun make -j`nproc` all - (umask 0077 && cat <<< "${{ secrets.SSH_ID_GHDOCS4ANKLANG_ECDSA }}" > .git/.ssh_id_ghdocs4anklang) misc/cirun doc/poxy.sh -b -u ArchReplay: From db682c8d853c2bed42b694d3ceb322539211109e Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Mon, 24 Jun 2024 15:59:50 +0200 Subject: [PATCH 02/10] .github/workflows/testing.yml: run build steps in anklang-ci containers Signed-off-by: Tim Janik --- .github/workflows/testing.yml | 48 +++++++++++------------------------ 1 file changed, 15 insertions(+), 33 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 96e9c39f..f1947d28 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -13,21 +13,16 @@ jobs: FocalAssets: runs-on: ubuntu-latest - env: { CITAG: "focal" } + container: { image: ghcr.io/tim-janik/anklang-ci:focal-latest } steps: - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe - - { uses: actions/cache@v4, with: { path: "/tmp/cicache", key: "cifocal-${{hashFiles ('misc/Dockerfile.focal')}}" } } - - run: | - misc/cirun build "/tmp/cicache" - name: 'Configure build presets' run: | echo -e ' prefix=/\n CC=clang \n CXX=clang++ \n CLANG_TIDY=clang-tidy ' > config-defaults.mk - misc/cirun dir2vol . ;# copy current git to /cirun - name: 'Build Dist Assets' run: | - misc/cirun make mkassets - misc/cirun vol2dir . ;# move /cirun out of docker volume + make mkassets - uses: actions/upload-artifact@v4 with: { name: assets, path: assets/ } - uses: actions/upload-artifact@v4 @@ -36,46 +31,37 @@ jobs: UploadDocs: if: ${{ github.repository == 'tim-janik/anklang' && github.ref == 'refs/heads/trunk' }} runs-on: ubuntu-latest - env: { CITAG: "focal" } + container: { image: ghcr.io/tim-janik/anklang-ci:focal-latest } steps: - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe - - { uses: actions/cache@v4, with: { path: "/tmp/cicache", key: "cifocal-${{hashFiles ('misc/Dockerfile.focal')}}" } } - - run: | - misc/cirun build "/tmp/cicache" - name: 'Configure build presets' run: | echo -e ' prefix=/\n CC=clang \n CXX=clang++ \n CLANG_TIDY=clang-tidy ' > config-defaults.mk - (umask 0077 && cat <<< "${{ secrets.SSH_ID_GHDOCS4ANKLANG_ECDSA }}" > .git/.ssh_id_ghdocs4anklang) - misc/cirun dir2vol . ;# copy current git to /cirun - name: 'Upload API Docs' # http://tim-janik.github.io/docs/anklang run: | - misc/cirun make -j`nproc` all - misc/cirun doc/poxy.sh -b -u + make -j`nproc` all + (umask 0077 && cat <<< "${{ secrets.SSH_ID_GHDOCS4ANKLANG_ECDSA }}" > .git/.ssh_id_ghdocs4anklang) + doc/poxy.sh -b -u ArchReplay: runs-on: ubuntu-latest - env: { CITAG: "arch" } + container: { image: ghcr.io/tim-janik/anklang-ci:arch-latest } steps: - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe - - { uses: actions/cache@v4, with: { path: "/tmp/cicache", key: "ciarch-${{hashFiles ('misc/Dockerfile.arch')}}" } } - - run: | - misc/cirun build "/tmp/cicache" - name: 'Configure build presets' run: | echo 'prefix=/' > config-defaults.mk ;# reset any previous config-defaults.mk - misc/cirun dir2vol . ;# copy current git to /cirun - name: 'Build Anklang' run: | - misc/cirun make GCC_COLORS="" -j`nproc` all + make GCC_COLORS="" -j`nproc` all - name: 'Run Tests' run: | - misc/cirun make -j`nproc` check + make -j`nproc` check - name: 'Run X11 GUI Tests' run: | - misc/cirun make x11test-v - misc/cirun vol2dir . ;# move /cirun out of docker volume + make x11test-v # Artifact upload from x11test - uses: actions/upload-artifact@v4 if: ${{ always() }} @@ -84,24 +70,20 @@ jobs: FocalClangTidy: if: ${{ ! contains(github.ref, 'refs/tags/') }} runs-on: ubuntu-latest - env: { CITAG: "focal" } + container: { image: ghcr.io/tim-janik/anklang-ci:focal-latest } steps: - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe - - { uses: actions/cache@v4, with: { path: "/tmp/cicache", key: "cifocal-${{hashFiles ('misc/Dockerfile.focal')}}" } } - - run: | - misc/cirun build "/tmp/cicache" - name: 'Configure build presets' run: | echo -e ' prefix=/\n CC=clang \n CXX=clang++ \n CLANG_TIDY=clang-tidy ' > config-defaults.mk - misc/cirun dir2vol . ;# copy current git to /cirun - run: | - misc/cirun make -j`nproc` all + make -j`nproc` all - run: | - misc/cirun make -j`nproc` check + make -j`nproc` check - name: 'Make clang-tidy' run: | - misc/cirun make -j`nproc` clang-tidy + make -j`nproc` clang-tidy # Artifact upload from clang-tidy - uses: actions/upload-artifact@v4 with: { name: clang-tidy, path: out/clang-tidy/ } @@ -109,7 +91,7 @@ jobs: # Use non-0 exit status for a failing branch-check on PRs run: | test -z "${{ github.event.pull_request }}" || BRANCH_CHECK_EXIT=77 - misc/cirun make branch-check BRANCH_CHECK_EXIT=$BRANCH_CHECK_EXIT + make branch-check BRANCH_CHECK_EXIT=$BRANCH_CHECK_EXIT Ping-IRC: if: ${{ always() }} From 85876f5a59d9b206ee5a18df9d9ca9f2ce582342 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Mon, 24 Jun 2024 16:58:14 +0200 Subject: [PATCH 03/10] .github/workflows/testing.yml: quote container image names Signed-off-by: Tim Janik --- .github/workflows/testing.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index f1947d28..054775cb 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -13,7 +13,7 @@ jobs: FocalAssets: runs-on: ubuntu-latest - container: { image: ghcr.io/tim-janik/anklang-ci:focal-latest } + container: { image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' } steps: - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe @@ -31,7 +31,7 @@ jobs: UploadDocs: if: ${{ github.repository == 'tim-janik/anklang' && github.ref == 'refs/heads/trunk' }} runs-on: ubuntu-latest - container: { image: ghcr.io/tim-janik/anklang-ci:focal-latest } + container: { image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' } steps: - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe @@ -46,7 +46,7 @@ jobs: ArchReplay: runs-on: ubuntu-latest - container: { image: ghcr.io/tim-janik/anklang-ci:arch-latest } + container: { image: 'ghcr.io/tim-janik/anklang-ci:arch-latest' } steps: - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe @@ -70,7 +70,7 @@ jobs: FocalClangTidy: if: ${{ ! contains(github.ref, 'refs/tags/') }} runs-on: ubuntu-latest - container: { image: ghcr.io/tim-janik/anklang-ci:focal-latest } + container: { image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' } steps: - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe From 71c304d809cc5291b1b7644f65cdbd2b4d38665e Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Mon, 24 Jun 2024 17:12:43 +0200 Subject: [PATCH 04/10] .github/workflows/testing.yml: test checkout fixups Signed-off-by: Tim Janik --- .github/workflows/testing.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 054775cb..9d1a50d1 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,6 +15,7 @@ jobs: runs-on: ubuntu-latest container: { image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' } steps: + - run: id && pwd && ls -al - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe - name: 'Configure build presets' @@ -33,7 +34,7 @@ jobs: runs-on: ubuntu-latest container: { image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' } steps: - - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 + - { uses: actions/checkout@v3, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe - name: 'Configure build presets' run: | @@ -48,7 +49,7 @@ jobs: runs-on: ubuntu-latest container: { image: 'ghcr.io/tim-janik/anklang-ci:arch-latest' } steps: - - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 + - { uses: actions/checkout@v4 } - run: git fetch -f --tags && git submodule update --init --recursive && git describe - name: 'Configure build presets' run: | @@ -70,7 +71,9 @@ jobs: FocalClangTidy: if: ${{ ! contains(github.ref, 'refs/tags/') }} runs-on: ubuntu-latest - container: { image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' } + container: + image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' + options: --user root steps: - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe From 487a9e5f349c555e31a8db724d4fe7406fd5dc3b Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Mon, 24 Jun 2024 17:19:50 +0200 Subject: [PATCH 05/10] .github/workflows/testing.yml: debug all stages Signed-off-by: Tim Janik --- .github/workflows/testing.yml | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 9d1a50d1..855d2563 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest container: { image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' } steps: - - run: id && pwd && ls -al + - run: id && pwd && env && ls -al - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe - name: 'Configure build presets' @@ -34,7 +34,8 @@ jobs: runs-on: ubuntu-latest container: { image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' } steps: - - { uses: actions/checkout@v3, with: { fetch-depth: 0 } } # Fix actions/checkout#290 + - run: id && pwd && env && ls -al + - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe - name: 'Configure build presets' run: | @@ -49,7 +50,8 @@ jobs: runs-on: ubuntu-latest container: { image: 'ghcr.io/tim-janik/anklang-ci:arch-latest' } steps: - - { uses: actions/checkout@v4 } + - run: id && pwd && env && ls -al + - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe - name: 'Configure build presets' run: | @@ -71,10 +73,9 @@ jobs: FocalClangTidy: if: ${{ ! contains(github.ref, 'refs/tags/') }} runs-on: ubuntu-latest - container: - image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' - options: --user root + container: { image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' } steps: + - run: id && pwd && env && ls -al - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - run: git fetch -f --tags && git submodule update --init --recursive && git describe - name: 'Configure build presets' From 77edeba85605b1d54f06b03eb6dee393606bf2d4 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Mon, 24 Jun 2024 23:42:46 +0200 Subject: [PATCH 06/10] .github/workflows/testing.yml: FocalAssets: fix $HOME and git checkout Signed-off-by: Tim Janik --- .github/workflows/testing.yml | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index 855d2563..c764dfbf 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,9 +15,16 @@ jobs: runs-on: ubuntu-latest container: { image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' } steps: - - run: id && pwd && env && ls -al - - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - - run: git fetch -f --tags && git submodule update --init --recursive && git describe + - run: | + sudo chown -R `id -u`:`id -g` . ~ ;# /github/home - actions/runner/issues/863 + export HOME=$(env -i bash -c 'echo ~') && echo HOME=$HOME | sudo tee -a $GITHUB_ENV + ! [[ $RUNNER_TEMP =~ _ ]] || sudo chmod -R 0777 $RUNNER_TEMP ;# for GH action cache + - name: 'Git Checkout' + run: | + git --version && git clone -q --recurse-submodules https://github.com/$GITHUB_REPOSITORY . + git fetch origin $GITHUB_REF # e.g. refs/pull/nnn/merge + [[ $GITHUB_REF =~ ^refs/heads/ ]] && BRANCHORSHA=$GITHUB_REF_NAME || BRANCHORSHA=$GITHUB_SHA + git checkout -q $BRANCHORSHA && git describe --always - name: 'Configure build presets' run: | echo -e ' prefix=/\n CC=clang \n CXX=clang++ \n CLANG_TIDY=clang-tidy ' > config-defaults.mk From d434a7a887e052987e805da2c45e5382ee32e578 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Tue, 25 Jun 2024 02:31:37 +0200 Subject: [PATCH 07/10] misc/Dockerfile.focal: build image for uid=1001(runner) gid=127(docker) Signed-off-by: Tim Janik --- misc/Dockerfile.focal | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/misc/Dockerfile.focal b/misc/Dockerfile.focal index a507ece7..f144e720 100644 --- a/misc/Dockerfile.focal +++ b/misc/Dockerfile.focal @@ -100,11 +100,10 @@ RUN \ make && make install \ && apt-get autoremove -y -# Become non-root -RUN groupadd --gid 1000 ubuntu \ - && useradd --uid 1000 --gid 1000 --create-home --shell /bin/bash ubuntu \ - && echo "ubuntu ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/ubuntu -USER ubuntu +# Become non-root, use Github action VM user: uid=1001(runner) gid=127(docker) +RUN groupadd -g 127 docker && useradd -u 1001 -g 127 -m -d /github/home -s /bin/bash runner \ + && echo "runner ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/runner +USER runner -# docker build -t cirun:focal -f misc/Dockerfile.focal misc -# docker run -ti --rm -v $PWD:/cirun -w /cirun cirun:focal +# docker build -t ghcr.io/tim-janik/anklang-ci:focal-latest -f misc/Dockerfile.focal misc +# docker run -ti --rm -v $PWD:/hostwd -w /cirun ghcr.io/tim-janik/anklang-ci:focal-latest From fb47c8df70277669aba0d669d2c0add7907fb68e Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Tue, 25 Jun 2024 02:33:37 +0200 Subject: [PATCH 08/10] misc/Dockerfile.arch: build image for uid=1001(runner) gid=127(docker) Signed-off-by: Tim Janik --- misc/Dockerfile.arch | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/misc/Dockerfile.arch b/misc/Dockerfile.arch index 7ef7abce..dc917ec9 100644 --- a/misc/Dockerfile.arch +++ b/misc/Dockerfile.arch @@ -27,11 +27,10 @@ RUN cd /tmp && git clone https://github.com/CastXML/CastXML.git && cd CastXML && # Provide a fast JS package manager RUN npm install -g pnpm@latest -# Become non-root -RUN groupadd --gid 1000 builder \ - && useradd --uid 1000 --gid 1000 --create-home --shell /bin/bash builder \ - && echo "builder ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/builder -USER builder +# Become non-root, use Github action VM user: uid=1001(runner) gid=127(docker) +RUN groupadd -g 127 docker && useradd -u 1001 -g 127 -m -d /github/home -s /bin/bash runner \ + && echo "runner ALL=(ALL) NOPASSWD:ALL" > /etc/sudoers.d/runner +USER runner -# docker build -t arch:latest -f misc/Dockerfile.arch misc -# docker run -ti --rm -v $PWD:/anklang -w /anklang arch:latest +# docker build -t ghcr.io/tim-janik/anklang-ci:arch-latest -f misc/Dockerfile.arch misc +# docker run -ti --rm -v $PWD:/hostwd -w /cirun ghcr.io/tim-janik/anklang-ci:arch-latest From 0961a8f96c5913606162054d5302815c17e16ac7 Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Tue, 25 Jun 2024 02:31:09 +0200 Subject: [PATCH 09/10] .github/workflows/testing.yml: use new images with actions/checkout@v4.1.1 Signed-off-by: Tim Janik --- .github/workflows/testing.yml | 39 ++++++++++++++++++----------------- 1 file changed, 20 insertions(+), 19 deletions(-) diff --git a/.github/workflows/testing.yml b/.github/workflows/testing.yml index c764dfbf..69c5d74d 100644 --- a/.github/workflows/testing.yml +++ b/.github/workflows/testing.yml @@ -15,16 +15,11 @@ jobs: runs-on: ubuntu-latest container: { image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' } steps: - - run: | - sudo chown -R `id -u`:`id -g` . ~ ;# /github/home - actions/runner/issues/863 - export HOME=$(env -i bash -c 'echo ~') && echo HOME=$HOME | sudo tee -a $GITHUB_ENV - ! [[ $RUNNER_TEMP =~ _ ]] || sudo chmod -R 0777 $RUNNER_TEMP ;# for GH action cache - - name: 'Git Checkout' - run: | - git --version && git clone -q --recurse-submodules https://github.com/$GITHUB_REPOSITORY . - git fetch origin $GITHUB_REF # e.g. refs/pull/nnn/merge - [[ $GITHUB_REF =~ ^refs/heads/ ]] && BRANCHORSHA=$GITHUB_REF_NAME || BRANCHORSHA=$GITHUB_SHA - git checkout -q $BRANCHORSHA && git describe --always + - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0, submodules: recursive } } + - name: 'Fetch all tags' + run: | + sed 's,git@github.com:,https://github.com/,' -i .git/config ; # fetch without ssh creds + git fetch -f --tags && git describe --always --long ; # Fix actions/checkout#290 - name: 'Configure build presets' run: | echo -e ' prefix=/\n CC=clang \n CXX=clang++ \n CLANG_TIDY=clang-tidy ' > config-defaults.mk @@ -41,9 +36,11 @@ jobs: runs-on: ubuntu-latest container: { image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' } steps: - - run: id && pwd && env && ls -al - - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - - run: git fetch -f --tags && git submodule update --init --recursive && git describe + - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0, submodules: recursive } } + - name: 'Fetch all tags' + run: | + sed 's,git@github.com:,https://github.com/,' -i .git/config ; # fetch without ssh creds + git fetch -f --tags && git describe --always --long ; # Fix actions/checkout#290 - name: 'Configure build presets' run: | echo -e ' prefix=/\n CC=clang \n CXX=clang++ \n CLANG_TIDY=clang-tidy ' > config-defaults.mk @@ -57,9 +54,11 @@ jobs: runs-on: ubuntu-latest container: { image: 'ghcr.io/tim-janik/anklang-ci:arch-latest' } steps: - - run: id && pwd && env && ls -al - - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - - run: git fetch -f --tags && git submodule update --init --recursive && git describe + - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0, submodules: recursive } } + - name: 'Fetch all tags' + run: | + sed 's,git@github.com:,https://github.com/,' -i .git/config ; # fetch without ssh creds + git fetch -f --tags && git describe --always --long ; # Fix actions/checkout#290 - name: 'Configure build presets' run: | echo 'prefix=/' > config-defaults.mk ;# reset any previous config-defaults.mk @@ -82,9 +81,11 @@ jobs: runs-on: ubuntu-latest container: { image: 'ghcr.io/tim-janik/anklang-ci:focal-latest' } steps: - - run: id && pwd && env && ls -al - - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0 } } # Fix actions/checkout#290 - - run: git fetch -f --tags && git submodule update --init --recursive && git describe + - { uses: actions/checkout@v4.1.1, with: { fetch-depth: 0, submodules: recursive } } + - name: 'Fetch all tags' + run: | + sed 's,git@github.com:,https://github.com/,' -i .git/config ; # fetch without ssh creds + git fetch -f --tags && git describe --always --long ; # Fix actions/checkout#290 - name: 'Configure build presets' run: | echo -e ' prefix=/\n CC=clang \n CXX=clang++ \n CLANG_TIDY=clang-tidy ' > config-defaults.mk From 01650632f0b64f4ffd23691dd1c32b48fa2ebcbe Mon Sep 17 00:00:00 2001 From: Tim Janik Date: Tue, 25 Jun 2024 02:55:31 +0200 Subject: [PATCH 10/10] misc/cirun: remove, now unused Signed-off-by: Tim Janik --- misc/Dockerfile.arch | 2 +- misc/Dockerfile.focal | 2 +- misc/cirun | 114 ------------------------------------------ 3 files changed, 2 insertions(+), 116 deletions(-) delete mode 100755 misc/cirun diff --git a/misc/Dockerfile.arch b/misc/Dockerfile.arch index dc917ec9..05b66157 100644 --- a/misc/Dockerfile.arch +++ b/misc/Dockerfile.arch @@ -33,4 +33,4 @@ RUN groupadd -g 127 docker && useradd -u 1001 -g 127 -m -d /github/home -s /bin/ USER runner # docker build -t ghcr.io/tim-janik/anklang-ci:arch-latest -f misc/Dockerfile.arch misc -# docker run -ti --rm -v $PWD:/hostwd -w /cirun ghcr.io/tim-janik/anklang-ci:arch-latest +# docker run -ti --rm -v $PWD:/hostwd ghcr.io/tim-janik/anklang-ci:arch-latest diff --git a/misc/Dockerfile.focal b/misc/Dockerfile.focal index f144e720..094e1c94 100644 --- a/misc/Dockerfile.focal +++ b/misc/Dockerfile.focal @@ -106,4 +106,4 @@ RUN groupadd -g 127 docker && useradd -u 1001 -g 127 -m -d /github/home -s /bin/ USER runner # docker build -t ghcr.io/tim-janik/anklang-ci:focal-latest -f misc/Dockerfile.focal misc -# docker run -ti --rm -v $PWD:/hostwd -w /cirun ghcr.io/tim-janik/anklang-ci:focal-latest +# docker run -ti --rm -v $PWD:/hostwd ghcr.io/tim-janik/anklang-ci:focal-latest diff --git a/misc/cirun b/misc/cirun deleted file mode 100755 index 4fc36ae8..00000000 --- a/misc/cirun +++ /dev/null @@ -1,114 +0,0 @@ -#!/usr/bin/env bash -# This Source Code Form is licensed MPL-2.0: http://mozilla.org/MPL/2.0 -set -Eeuo pipefail #-x - -SCRIPTNAME=${0##*/} && die() { [ -z "$*" ] || echo "$SCRIPTNAME: $*" >&2; exit 127 ; } -ABSPATHSCRIPT=`readlink -f "$0"`&& ABSDIR=`readlink -f "${ABSPATHSCRIPT%/*}"` - -help() { - echo "Usage: $0 [OPTIONS] [command…]" - echo 'Build docker image cirun:$CITAG and run command under mountpoint /cirun/.' - echo 'Options:' - echo ' -B Force docker build even if tag exists' - echo ' -C DIR Change to DIR before performing any operations' - echo ' -u UID User ID used inside docker run' - echo ' -x Enable `set -x` to echo all commands before execution' - echo 'Commands:' - echo ' build [dcache] Build image cirun:$CITAG from Dockerfile.$CITAG with an' - echo ' optional directory [dcache] to use as docker image cache' - echo ' dir2vol Copy contents to $CIVOLUME' - echo ' vol2dir Copy $CIVOLUME contents to ' - echo ' rmvol Remove volume without copying its contents' - echo ' ... Any other executable shell command' - echo 'Environemt variables:' - echo ' CITAG= Build image cirun: from Dockerfile.' - echo ' CIVOLUME= Name of the data volume for the build tree' - echo ' GITHUB_JOB Used to construct $CIVOLUME fallback' - exit 0 -} - -# Parse OPTIONS -DOCKERUID=1000 # hard coded in Dockerfile -FORCE_BUILD=false -test $# -eq 0 && help -while test $# -ne 0 ; do - case "$1" in \ - -B) FORCE_BUILD=true ;; - -C) shift ; mkdir -p "$1" && echo "cd $1" >&2 && cd "$1" ;; - -h|--help) help ;; - -u) shift; DOCKERUID="$1" ;; - -x) set -x ;; - *) break ;; - esac - shift -done -test -n "$CITAG" -test -n "${CIVOLUME:-}" || CIVOLUME=cirun-${GITHUB_JOB:-$CITAG} - -# Build or check existing docker image -if test "build" == "${1:-}" ; then - docker image inspect --format=1 cirun:$CITAG >/dev/null 2>&1 && - { echo "$0: found 'cirun:$CITAG' - reusing existing image"; exit 0; } - # Utilize CI cache dir when present - CACHETYPE= - if test -n "${2:-}" ; then - # Use cache-from XOR cache-to, so buildx cannot mess up good caches - test -r "$2/index.json" && - CACHETYPE="--cache-from=type=local,src=$2" || - CACHETYPE="--cache-to=type=local,mode=max,compression=zstd,dest=$2" - fi - # Require buildx backend - docker buildx >/dev/null 2>&1 || die "missing docker-buildx-plugin" - # Build image and cleanup temporary driver - ( - trap "docker buildx rm --builder cirunsh$$ 2>/dev/null" 0 HUP INT QUIT TRAP USR1 PIPE TERM ERR EXIT - set -x - docker buildx create --name cirunsh$$ --driver=docker-container - time docker buildx build --builder cirunsh$$ $CACHETYPE --load -t cirun:$CITAG -f "$ABSDIR/Dockerfile.$CITAG" "$ABSDIR/" - ) - exit 0 -elif ! docker image inspect --format=1 cirun:$CITAG >/dev/null 2>&1; then - die "cirun:$CITAG: no such docker image, try: $0 build" -fi - -# Copy host dir -> container volume -if test "dir2vol" == "${1:-}" ; then - docker volume ls -q | grep -Fxq $CIVOLUME && { - docker stop "cirun_$CITAG" || : - docker rm "cirun_$CITAG" || : - docker volume rm $CIVOLUME - } - docker volume create $CIVOLUME - docker create --name "cirun_$CITAG" -v $CIVOLUME:/cirun "cirun:$CITAG" - tar -cf - "$2" | docker cp - "cirun_$CITAG:/cirun" - docker rm "cirun_$CITAG" - docker run -t --rm --name "cirun_$CITAG" -v $CIVOLUME:/cirun -w / -u 0:0 "cirun:$CITAG" /usr/bin/chown -R "$DOCKERUID:$DOCKERUID" /cirun - exit 0 -fi - -# Move container volume -> host dir -if test "vol2dir" == "${1:-}" ; then - docker volume ls -q | grep -Fxq $CIVOLUME || - die "$0: no such volume: $CIVOLUME" - mkdir -p "$2" - docker create --name "cirun_$CITAG" -v $CIVOLUME:/cirun "cirun:$CITAG" - docker cp "cirun_$CITAG:/cirun/." - | tar -xf - -C "$2" - docker rm "cirun_$CITAG" - exit 0 -elif test "rmvol" == "${1:-}" ; then - docker volume rm $CIVOLUME || : - exit 0 -fi - -# Prepare $RUNARGS -RUNARGS="-t -w /cirun -v $CIVOLUME:/cirun" -#RUNARGS="$RUNARGS -e DISPLAY=$DISPLAY -v /tmp/.X11-unix:/tmp/.X11-unix:ro -v $HOME/.Xauthority:/home/builder/.Xauthority:ro" # X11 connect -#RUNARGS="$RUNARGS --net host" # needed to connect to AnklangSynthEngine *outside* docker -#RUNARGS="$RUNARGS -e DBUS_SESSION_BUS_ADDRESS=$DBUS_SESSION_BUS_ADDRESS -v /run/user/1000/bus:/run/user/1000/bus -v /var/run/dbus/system_bus_socket:/var/run/dbus/system_bus_socket" -#RUNARGS="$RUNARGS --privileged --cap-add SYS_ADMIN --device /dev/fuse -v /var/run/docker.sock:/var/run/docker.sock" # run as root with fuse, docker -tty -s && INTERACTIVE="-i" || INTERACTIVE= -RUN="docker run --rm $INTERACTIVE $RUNARGS -u $DOCKERUID:$DOCKERUID cirun:$CITAG" - -# Run user provided command -set -x -exec $RUN "$@"