From 0e466265ad248ae8988b49c80a259cdf80b046ed Mon Sep 17 00:00:00 2001 From: Knut Ahlers Date: Sat, 13 Apr 2024 13:31:41 +0200 Subject: [PATCH] CI: Fix bugs in new CI flow Signed-off-by: Knut Ahlers --- .github/workflows/generated_workflow.yml | 95 +++---------------- Makefile | 2 +- ci/workflow-parts/part_doc-generator.yml | 13 +-- ci/workflow-parts/part_docker-publish.yml | 1 - ci/workflow-parts/part_integration-crdb.yml | 15 ++- .../part_integration-mariadb.yml | 13 ++- ci/workflow-parts/part_integration-mysql.yml | 13 ++- .../part_integration-postgres.yml | 17 ++-- ci/workflow-parts/part_release.yml | 25 +---- ci/workflow-parts/part_test.yml | 25 +---- 10 files changed, 43 insertions(+), 176 deletions(-) diff --git a/.github/workflows/generated_workflow.yml b/.github/workflows/generated_workflow.yml index 19f7f70..ec21162 100644 --- a/.github/workflows/generated_workflow.yml +++ b/.github/workflows/generated_workflow.yml @@ -11,7 +11,7 @@ jobs: run: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go @@ -21,18 +21,11 @@ jobs: id-token: write runs-on: ubuntu-latest steps: - - name: Install required packages - run: | - pacman -Syy --noconfirm \ - curl \ - git \ - git-lfs \ - make \ - tar - uses: actions/checkout@v4 with: lfs: true show-progress: false + submodules: true - name: Marking workdir safe run: git config --global --add safe.directory /__w/twitch-bot/twitch-bot - name: Generate documentation @@ -54,7 +47,6 @@ jobs: steps: - uses: actions/checkout@v4 with: - lfs: true show-progress: false - name: Log into registry uses: docker/login-action@v3 @@ -72,7 +64,7 @@ jobs: run: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go @@ -80,16 +72,12 @@ jobs: services: crdb: image: luzifer/crdb-gh-service + options: --health-cmd 'curl -sSf http://localhost:8080/health' --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - name: Enable custom AUR package repo - run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - name: Install required packages run: | pacman -Syy --noconfirm \ - cockroachdb-bin \ - git \ - go \ - make + cockroachdb-bin - uses: actions/checkout@v4 with: show-progress: false @@ -115,7 +103,7 @@ jobs: run: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go @@ -127,15 +115,11 @@ jobs: MYSQL_PASSWORD: twitch-bot-pass MYSQL_ROOT_PASSWORD: root-pass MYSQL_USER: twitch-bot + options: --health-cmd 'healthcheck.sh --connect --innodb_initialized' --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - name: Enable custom AUR package repo - run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - name: Install required packages run: | pacman -Syy --noconfirm \ - git \ - go \ - make \ mariadb-clients - uses: actions/checkout@v4 with: @@ -161,7 +145,7 @@ jobs: run: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go @@ -173,15 +157,11 @@ jobs: MYSQL_PASSWORD: twitch-bot-pass MYSQL_ROOT_PASSWORD: root-pass MYSQL_USER: twitch-bot + options: --health-cmd 'mysqladmin ping' --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - name: Enable custom AUR package repo - run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - name: Install required packages run: | pacman -Syy --noconfirm \ - git \ - go \ - make \ mariadb-clients - uses: actions/checkout@v4 with: @@ -207,7 +187,7 @@ jobs: run: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go @@ -217,15 +197,8 @@ jobs: image: postgres:15 env: POSTGRES_PASSWORD: twitch-bot-pass + options: --health-cmd pg_isready --health-interval 10s --health-timeout 5s --health-retries 5 steps: - - name: Enable custom AUR package repo - run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - - name: Install required packages - run: | - pacman -Syy --noconfirm \ - git \ - go \ - make - uses: actions/checkout@v4 with: show-progress: false @@ -244,35 +217,14 @@ jobs: run: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go runs-on: ubuntu-latest steps: - - name: Enable custom AUR package repo - run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - - name: Install required packages - run: | - pacman -Syy --noconfirm \ - awk \ - curl \ - diffutils \ - git \ - git-lfs \ - go \ - golangci-lint-bin \ - make \ - nodejs-lts-hydrogen \ - npm \ - tar \ - trivy \ - unzip \ - which \ - zip - uses: actions/checkout@v4 with: - lfs: true show-progress: false - name: Marking workdir safe run: | @@ -300,35 +252,14 @@ jobs: run: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go runs-on: ubuntu-latest steps: - - name: Enable custom AUR package repo - run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - - name: Install required packages - run: | - pacman -Syy --noconfirm \ - awk \ - curl \ - diffutils \ - git \ - git-lfs \ - go \ - golangci-lint-bin \ - make \ - nodejs-lts-hydrogen \ - npm \ - tar \ - trivy \ - unzip \ - which \ - zip - uses: actions/checkout@v4 with: - lfs: true show-progress: false - name: Marking workdir safe run: | diff --git a/Makefile b/Makefile index 493968b..6bc850f 100644 --- a/Makefile +++ b/Makefile @@ -36,7 +36,7 @@ frontend_lint: node_modules src node_modules: - npm ci + npm ci --include dev # --- Tools diff --git a/ci/workflow-parts/part_doc-generator.yml b/ci/workflow-parts/part_doc-generator.yml index 582575f..5de90b8 100644 --- a/ci/workflow-parts/part_doc-generator.yml +++ b/ci/workflow-parts/part_doc-generator.yml @@ -8,7 +8,7 @@ defaults: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go @@ -21,20 +21,11 @@ permissions: runs-on: ubuntu-latest steps: - - - name: Install required packages - run: | - pacman -Syy --noconfirm \ - curl \ - git \ - git-lfs \ - make \ - tar - - uses: actions/checkout@v4 with: lfs: true show-progress: false + submodules: true - name: Marking workdir safe run: git config --global --add safe.directory /__w/twitch-bot/twitch-bot diff --git a/ci/workflow-parts/part_docker-publish.yml b/ci/workflow-parts/part_docker-publish.yml index b380224..b46a1e7 100644 --- a/ci/workflow-parts/part_docker-publish.yml +++ b/ci/workflow-parts/part_docker-publish.yml @@ -12,7 +12,6 @@ runs-on: ubuntu-latest steps: - uses: actions/checkout@v4 with: - lfs: true show-progress: false - name: Log into registry diff --git a/ci/workflow-parts/part_integration-crdb.yml b/ci/workflow-parts/part_integration-crdb.yml index 3d6c234..6401508 100644 --- a/ci/workflow-parts/part_integration-crdb.yml +++ b/ci/workflow-parts/part_integration-crdb.yml @@ -8,7 +8,7 @@ defaults: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go @@ -18,18 +18,17 @@ runs-on: ubuntu-latest services: crdb: image: luzifer/crdb-gh-service + options: >- + --health-cmd 'curl -sSf http://localhost:8080/health' + --health-interval 10s + --health-timeout 5s + --health-retries 5 steps: - - name: Enable custom AUR package repo - run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - - name: Install required packages run: | pacman -Syy --noconfirm \ - cockroachdb-bin \ - git \ - go \ - make + cockroachdb-bin - uses: actions/checkout@v4 with: diff --git a/ci/workflow-parts/part_integration-mariadb.yml b/ci/workflow-parts/part_integration-mariadb.yml index df42c9e..2bf751c 100644 --- a/ci/workflow-parts/part_integration-mariadb.yml +++ b/ci/workflow-parts/part_integration-mariadb.yml @@ -8,7 +8,7 @@ defaults: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go @@ -22,17 +22,16 @@ services: MYSQL_PASSWORD: twitch-bot-pass MYSQL_ROOT_PASSWORD: root-pass MYSQL_USER: twitch-bot + options: >- + --health-cmd 'healthcheck.sh --connect --innodb_initialized' + --health-interval 10s + --health-timeout 5s + --health-retries 5 steps: - - name: Enable custom AUR package repo - run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - - name: Install required packages run: | pacman -Syy --noconfirm \ - git \ - go \ - make \ mariadb-clients - uses: actions/checkout@v4 diff --git a/ci/workflow-parts/part_integration-mysql.yml b/ci/workflow-parts/part_integration-mysql.yml index 1db4fef..8debd1a 100644 --- a/ci/workflow-parts/part_integration-mysql.yml +++ b/ci/workflow-parts/part_integration-mysql.yml @@ -8,7 +8,7 @@ defaults: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go @@ -22,17 +22,16 @@ services: MYSQL_PASSWORD: twitch-bot-pass MYSQL_ROOT_PASSWORD: root-pass MYSQL_USER: twitch-bot + options: >- + --health-cmd 'mysqladmin ping' + --health-interval 10s + --health-timeout 5s + --health-retries 5 steps: - - name: Enable custom AUR package repo - run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - - name: Install required packages run: | pacman -Syy --noconfirm \ - git \ - go \ - make \ mariadb-clients - uses: actions/checkout@v4 diff --git a/ci/workflow-parts/part_integration-postgres.yml b/ci/workflow-parts/part_integration-postgres.yml index 0ee3b0a..9ce8c4c 100644 --- a/ci/workflow-parts/part_integration-postgres.yml +++ b/ci/workflow-parts/part_integration-postgres.yml @@ -8,7 +8,7 @@ defaults: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go @@ -20,18 +20,13 @@ services: image: postgres:15 env: POSTGRES_PASSWORD: twitch-bot-pass + options: >- + --health-cmd pg_isready + --health-interval 10s + --health-timeout 5s + --health-retries 5 steps: - - name: Enable custom AUR package repo - run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - - - name: Install required packages - run: | - pacman -Syy --noconfirm \ - git \ - go \ - make - - uses: actions/checkout@v4 with: show-progress: false diff --git a/ci/workflow-parts/part_release.yml b/ci/workflow-parts/part_release.yml index f0fd4c9..36715ee 100644 --- a/ci/workflow-parts/part_release.yml +++ b/ci/workflow-parts/part_release.yml @@ -8,7 +8,7 @@ defaults: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go @@ -16,31 +16,8 @@ container: runs-on: ubuntu-latest steps: - - name: Enable custom AUR package repo - run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - - - name: Install required packages - run: | - pacman -Syy --noconfirm \ - awk \ - curl \ - diffutils \ - git \ - git-lfs \ - go \ - golangci-lint-bin \ - make \ - nodejs-lts-hydrogen \ - npm \ - tar \ - trivy \ - unzip \ - which \ - zip - - uses: actions/checkout@v4 with: - lfs: true show-progress: false - name: Marking workdir safe diff --git a/ci/workflow-parts/part_test.yml b/ci/workflow-parts/part_test.yml index ac27886..602163e 100644 --- a/ci/workflow-parts/part_test.yml +++ b/ci/workflow-parts/part_test.yml @@ -7,7 +7,7 @@ defaults: shell: bash container: - image: luzifer/archlinux + image: luzifer/gh-arch-env env: CGO_ENABLED: 0 GOPATH: /go @@ -15,31 +15,8 @@ container: runs-on: ubuntu-latest steps: - - name: Enable custom AUR package repo - run: echo -e "[luzifer]\nSigLevel = Never\nServer = https://archrepo.hub.luzifer.io/\$arch" >>/etc/pacman.conf - - - name: Install required packages - run: | - pacman -Syy --noconfirm \ - awk \ - curl \ - diffutils \ - git \ - git-lfs \ - go \ - golangci-lint-bin \ - make \ - nodejs-lts-hydrogen \ - npm \ - tar \ - trivy \ - unzip \ - which \ - zip - - uses: actions/checkout@v4 with: - lfs: true show-progress: false - name: Marking workdir safe