From e7a0190f454a05b243a2a0a258afa88765b3dc8b Mon Sep 17 00:00:00 2001 From: Friedrich Date: Thu, 14 Dec 2023 11:37:26 +0100 Subject: [PATCH] Run github action workflows on release-branches. (#330) --- .github/workflows/e2e.yml | 12 ++-- .github/workflows/lint.yml | 12 ++-- .github/workflows/sink.yml | 100 +++++++++++++++++---------------- .github/workflows/test.yml | 22 +++++--- .github/workflows/validate.yml | 16 ++++-- 5 files changed, 88 insertions(+), 74 deletions(-) diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml index 7ab976fa..c9d3343d 100644 --- a/.github/workflows/e2e.yml +++ b/.github/workflows/e2e.yml @@ -7,11 +7,13 @@ env: on: pull_request: - branches: [ "main" ] + branches: + - main + - "release-*" paths-ignore: - - 'docs/**' - - '**.md' - - 'sec-scanners-config.yaml' + - "docs/**" + - "**.md" + - "sec-scanners-config.yaml" jobs: nats: @@ -59,7 +61,7 @@ jobs: - name: Setup and test the eventing-manager run: | - make e2e-setup + make e2e-setup - name: Setup eventing run: | diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index b714c580..ff60295c 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -2,11 +2,13 @@ name: golangci-lint on: pull_request: - branches: [ "main" ] + branches: + - main + - "release-*" paths-ignore: - - 'docs/**' - - '**.md' - - 'sec-scanners-config.yaml' + - "docs/**" + - "**.md" + - "sec-scanners-config.yaml" permissions: contents: read @@ -19,7 +21,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: "1.21" cache: false - uses: actions/checkout@v4 - name: golangci-lint diff --git a/.github/workflows/sink.yml b/.github/workflows/sink.yml index b6bd08e0..5fbb74bb 100644 --- a/.github/workflows/sink.yml +++ b/.github/workflows/sink.yml @@ -10,17 +10,19 @@ env: on: push: branches: - - main - tags: [ '*.*.*' ] + - main + - "release-*" + tags: ["*.*.*"] paths: - - 'hack/e2e/sink/**' - - '.github/workflows/sink.yml' + - "hack/e2e/sink/**" + - ".github/workflows/sink.yml" pull_request: branches: - - main + - main + - "release-*" paths: - - 'hack/e2e/sink/**' - - '.github/workflows/sink.yml' + - "hack/e2e/sink/**" + - ".github/workflows/sink.yml" jobs: build: @@ -32,51 +34,51 @@ jobs: working-directory: ${{ env.E2E_SINK_DIR }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v4 - - name: Set up Go - uses: actions/setup-go@v5 - with: - go-version: 1.19 - cache: true + - name: Set up Go + uses: actions/setup-go@v5 + with: + go-version: 1.19 + cache: true - - name: Build - run: go build -v ./... + - name: Build + run: go build -v ./... - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 - # Login against a Docker registry except on PR - # https://github.com/docker/login-action - - name: Log into registry ${{ env.REGISTRY }} - # if: github.event_name != 'pull_request' - uses: docker/login-action@v3 - with: - registry: ${{ env.REGISTRY }} - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + # Login against a Docker registry except on PR + # https://github.com/docker/login-action + - name: Log into registry ${{ env.REGISTRY }} + # if: github.event_name != 'pull_request' + uses: docker/login-action@v3 + with: + registry: ${{ env.REGISTRY }} + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Extract Docker metadata - id: meta - uses: docker/metadata-action@v5 - with: - images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: | - type=sha - type=semver,pattern={{version}},event=tag - labels: | - org.opencontainers.image.title=E2E Tests Sink - org.opencontainers.image.description=A webserver imitating an eventing sink that receives events and stores in memory - org.opencontainers.image.url=https://github.com/kyma-project/eventing-manager/${{ env.E2E_SINK_DIR }} + - name: Extract Docker metadata + id: meta + uses: docker/metadata-action@v5 + with: + images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=sha + type=semver,pattern={{version}},event=tag + labels: | + org.opencontainers.image.title=E2E Tests Sink + org.opencontainers.image.description=A webserver imitating an eventing sink that receives events and stores in memory + org.opencontainers.image.url=https://github.com/kyma-project/eventing-manager/${{ env.E2E_SINK_DIR }} - - name: Build Docker image - id: build-and-push - uses: docker/build-push-action@v5 - with: - context: ${{ env.E2E_SINK_DIR }} - push: ${{ github.event_name != 'pull_request' }} - tags: ${{ steps.meta.outputs.tags }} - labels: ${{ steps.meta.outputs.labels }} - load: ${{ github.event_name == 'pull_request' }} - cache-from: type=gha - cache-to: type=gha,mode=max + - name: Build Docker image + id: build-and-push + uses: docker/build-push-action@v5 + with: + context: ${{ env.E2E_SINK_DIR }} + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }} + load: ${{ github.event_name == 'pull_request' }} + cache-from: type=gha + cache-to: type=gha,mode=max diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index c2768a5b..2b257025 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -6,17 +6,21 @@ env: on: push: - branches: [ "main" ] + branches: + - main + - "release-*" paths-ignore: - - 'docs/**' - - '**.md' - - 'sec-scanners-config.yaml' + - "docs/**" + - "**.md" + - "sec-scanners-config.yaml" pull_request: - branches: [ "main" ] + branches: + - main + - "release-*" paths-ignore: - - 'docs/**' - - '**.md' - - 'sec-scanners-config.yaml' + - "docs/**" + - "**.md" + - "sec-scanners-config.yaml" jobs: unit: @@ -26,7 +30,7 @@ jobs: uses: actions/checkout@v4 - uses: actions/setup-go@v5 with: - go-version: '1.21' + go-version: "1.21" cache: false - name: Sync GO dependencies run: | diff --git a/.github/workflows/validate.yml b/.github/workflows/validate.yml index 6243ffa0..db16acbf 100644 --- a/.github/workflows/validate.yml +++ b/.github/workflows/validate.yml @@ -6,15 +6,19 @@ env: on: push: - branches: [ "main" ] + branches: + - main + - "release-*" paths: - - 'api/**' - - 'config/crd/**' + - "api/**" + - "config/crd/**" pull_request: - branches: [ "main" ] + branches: + - main + - "release-*" paths: - - 'api/**' - - 'config/crd/**' + - "api/**" + - "config/crd/**" jobs: crd: