From 03e284cb61c325b472ea8f72bfc5a3227938426a Mon Sep 17 00:00:00 2001 From: Larry Silverman Date: Thu, 14 Nov 2024 09:04:51 -0600 Subject: [PATCH 1/5] Attempt to get more CI workflows running in our GH Actions env. --- .github/workflows/ci.yml | 4 ++-- .github/workflows/codeql-analysis.yml | 8 ++++---- .github/workflows/docker-image.yml | 20 +++++++++++++++----- 3 files changed, 21 insertions(+), 11 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 35b02a5c..30b57519 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,10 +3,10 @@ name: CI on: push: branches: - - master + - main pull_request: branches: - - master + - main jobs: build: diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 0c0dbfa2..41ab35ae 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -2,10 +2,10 @@ name: "CodeQL" on: push: - branches: [ "master" ] + branches: [ "main" ] pull_request: # The branches below must be a subset of the branches above - branches: [ "master" ] + branches: [ "main" ] # Skip the workflow if PR only contains changes to files matching the following path patterns paths-ignore: - tests.py @@ -36,10 +36,10 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v3 + uses: github/codeql-action/init@v4 with: languages: ${{ matrix.language }} config-file: ./.github/codeql-config.yml - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v3 + uses: github/codeql-action/analyze@v4 diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index d9c787ec..efe3fe84 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -29,21 +29,31 @@ jobs: - name: Log in to Docker Hub if: github.event_name != 'pull_request' - uses: docker/login-action@v2 + uses: docker/login-action@v3 with: username: ${{ secrets.DOCKER_HUB_USERNAME }} password: ${{ secrets.DOCKER_HUB_KEY }} - name: Set up QEMU - uses: docker/setup-qemu-action@v2 + uses: docker/setup-qemu-action@v3 - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v2 + uses: docker/setup-buildx-action@v3 + + - name: Cache Docker layers + uses: actions/cache@v4 + with: + path: /tmp/.buildx-cache + key: ${{ runner.os }}-buildx-${{ github.sha }} + restore-keys: | + ${{ runner.os }}-buildx- - name: Build container image, publish if not a PR - uses: docker/build-push-action@v4 + uses: docker/build-push-action@v5 with: context: . push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta.outputs.labels }} + cache-from: type=local,src=/tmp/.buildx-cache + cache-to: type=local,dest=/tmp/.buildx-cache \ No newline at end of file From 714b982b8d0ac87bf00848f66538a261f3c6e43c Mon Sep 17 00:00:00 2001 From: Larry Silverman Date: Thu, 14 Nov 2024 09:15:28 -0600 Subject: [PATCH 2/5] roll back change --- .github/workflows/codeql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 41ab35ae..cbc72b4d 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -36,7 +36,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v4 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} config-file: ./.github/codeql-config.yml From 2d28495ba67212e4b63b44378a1fed7101a9fa3d Mon Sep 17 00:00:00 2001 From: Larry Silverman Date: Thu, 14 Nov 2024 09:17:47 -0600 Subject: [PATCH 3/5] rollback change --- .github/workflows/codeql-analysis.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index cbc72b4d..c267e9fb 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -42,4 +42,4 @@ jobs: config-file: ./.github/codeql-config.yml - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v4 + uses: github/codeql-action/analyze@v3 From dd9a89d1ddcc2097c2ed0565b0e9a6a95efcda44 Mon Sep 17 00:00:00 2001 From: Larry Silverman Date: Thu, 14 Nov 2024 09:23:33 -0600 Subject: [PATCH 4/5] Always try to build the docker container but only push if merging to main. --- .github/workflows/docker-image.yml | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index efe3fe84..68ff8468 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -27,13 +27,6 @@ jobs: with: images: trackabout/snappass - - name: Log in to Docker Hub - if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKER_HUB_USERNAME }} - password: ${{ secrets.DOCKER_HUB_KEY }} - - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -48,12 +41,19 @@ jobs: restore-keys: | ${{ runner.os }}-buildx- + - name: Log in to Docker Hub + if: github.event_name == 'push' && github.ref == 'refs/heads/main' + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_HUB_USERNAME }} + password: ${{ secrets.DOCKER_HUB_KEY }} + - name: Build container image, publish if not a PR uses: docker/build-push-action@v5 with: context: . - push: ${{ github.event_name != 'pull_request' }} + push: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - cache-from: type=local,src=/tmp/.buildx-cache - cache-to: type=local,dest=/tmp/.buildx-cache \ No newline at end of file + cache-from: type=gha,scope=${{ github.repository }} + cache-to: type=gha,mode=max,scope=${{ github.repository }} \ No newline at end of file From ac95baa73ece26ccaf50cbcbe00efe23ca88d208 Mon Sep 17 00:00:00 2001 From: Larry Silverman Date: Thu, 14 Nov 2024 09:27:57 -0600 Subject: [PATCH 5/5] update some action versions --- .github/workflows/docker-image.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker-image.yml b/.github/workflows/docker-image.yml index 68ff8468..d2db74ea 100644 --- a/.github/workflows/docker-image.yml +++ b/.github/workflows/docker-image.yml @@ -19,11 +19,11 @@ jobs: steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v4 + uses: docker/metadata-action@v5 with: images: trackabout/snappass