From 059ee78c5cdefaa4b6e03851c927daf52b56fd8e Mon Sep 17 00:00:00 2001 From: Geoff Bourne Date: Wed, 24 May 2023 21:27:44 -0500 Subject: [PATCH] Simplify PR github action (#196) --- .github/workflows/pr.yml | 47 +++-------------------------------- .github/workflows/release.yml | 2 +- 2 files changed, 4 insertions(+), 45 deletions(-) diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml index 151304b..051228b 100644 --- a/.github/workflows/pr.yml +++ b/.github/workflows/pr.yml @@ -3,54 +3,13 @@ name: Validate PR on: pull_request: branches: [ master ] - types: [assigned, opened, synchronize, labeled] - -env: - IMAGE_TO_TEST: itzg/mc-router:test-${{ github.repository_owner }}-${{ github.run_id }} jobs: test: runs-on: ubuntu-20.04 - steps: - uses: actions/checkout@v3 - - - name: Setup Docker Buildx - uses: docker/setup-buildx-action@v2 - - - name: Build - uses: docker/build-push-action@v3.3.0 + - uses: actions/setup-go@v4 with: - tags: ${{ env.IMAGE_TO_TEST }} - load: true - cache-from: type=gha - target: builder - - - name: Run tests - run: | - docker run --rm --entrypoint go ${{ env.IMAGE_TO_TEST }} test ./... - - - name: Gather Docker metadata - if: contains(github.event.pull_request.labels.*.name, 'ci/push-image') - id: meta - uses: docker/metadata-action@v4 - with: - images: | - itzg/mc-router - - - name: Login to DockerHub - if: contains(github.event.pull_request.labels.*.name, 'ci/push-image') - uses: docker/login-action@v2 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_TOKEN }} - - - name: Push - if: contains(github.event.pull_request.labels.*.name, 'ci/push-image') - uses: docker/build-push-action@v3.3.0 - with: - tags: ${{ steps.meta.outputs.tags }} - pull: true - push: true - cache-from: type=gha - labels: ${{ steps.meta.outputs.labels }} + go-version-file: 'go.mod' + - run: go test ./... diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d2a11e0..9e48ac8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Go uses: actions/setup-go@v4 with: - go-version: 1.20 + go-version-file: 'go.mod' - name: Setup docker buildx uses: docker/setup-buildx-action@v2