From b67becc37320ef863ca5ed2552e9ab94a17fc28e Mon Sep 17 00:00:00 2001 From: Aleksei Larkov Date: Wed, 22 Jan 2025 09:46:43 +0200 Subject: [PATCH] Fix promxy-operator build --- .../{release.yml => release_charts.yml} | 3 +- .../{build.yml => release_operator.yml} | 28 +--------- .github/workflows/test_pr.yml | 55 +++++++++++++++++++ 3 files changed, 60 insertions(+), 26 deletions(-) rename .github/workflows/{release.yml => release_charts.yml} (97%) rename .github/workflows/{build.yml => release_operator.yml} (72%) create mode 100644 .github/workflows/test_pr.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release_charts.yml similarity index 97% rename from .github/workflows/release.yml rename to .github/workflows/release_charts.yml index 88b3878..2fae570 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release_charts.yml @@ -44,4 +44,5 @@ jobs: uses: helm/chart-releaser-action@v1.6.0 env: CR_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - CR_SKIP_EXISTING: true \ No newline at end of file + CR_SKIP_EXISTING: true + diff --git a/.github/workflows/build.yml b/.github/workflows/release_operator.yml similarity index 72% rename from .github/workflows/build.yml rename to .github/workflows/release_operator.yml index f8a85c6..ef04998 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/release_operator.yml @@ -1,20 +1,10 @@ -name: promxy-operator-build +name: promxy-operator-release on: - pull_request_target: - types: - - labeled - - opened - - synchronize - - reopened - branches: - - main - - release-* - paths: - - "promxy-operator/**" - - "!**.md" push: tags: - "*" + branches: + - main env: GO_VERSION: "1.22" @@ -28,24 +18,12 @@ jobs: runs-on: ubuntu-latest outputs: version: ${{ steps.vars.outputs.version }} - pr: ${{ steps.pr.outputs.result }} permissions: packages: write steps: - - name: Get PR ref - uses: actions/github-script@v7 - id: pr - with: - script: | - const { data: pullRequest } = await github.rest.pulls.get({ - ...context.repo, - pull_number: context.payload.pull_request.number, - }); - return pullRequest - name: Checkout repository uses: actions/checkout@v4 with: - ref: ${{fromJSON(steps.pr.outputs.result).merge_commit_sha}} fetch-depth: 0 - name: Setup Go uses: actions/setup-go@v5 diff --git a/.github/workflows/test_pr.yml b/.github/workflows/test_pr.yml new file mode 100644 index 0000000..d7a0e9e --- /dev/null +++ b/.github/workflows/test_pr.yml @@ -0,0 +1,55 @@ +name: promxy-operator-build +on: + pull_request_target: + types: + - labeled + - opened + - synchronize + - reopened + branches: + - main + - release-* + paths: + - "promxy-operator/**" + - "!**.md" + +env: + GO_VERSION: "1.22" + +jobs: + build: + concurrency: + group: build-${{ github.head_ref || github.run_id }} + cancel-in-progress: true + name: Build and Unit Test + runs-on: ubuntu-latest + outputs: + version: ${{ steps.vars.outputs.version }} + pr: ${{ steps.pr.outputs.result }} + permissions: + packages: write + steps: + - name: Get PR ref + uses: actions/github-script@v7 + id: pr + with: + script: | + const { data: pullRequest } = await github.rest.pulls.get({ + ...context.repo, + pull_number: context.payload.pull_request.number, + }); + return pullRequest + - name: Checkout repository + uses: actions/checkout@v4 + with: + ref: ${{fromJSON(steps.pr.outputs.result).merge_commit_sha}} + fetch-depth: 0 + - name: Setup Go + uses: actions/setup-go@v5 + with: + go-version: ${{ env.GO_VERSION }} + cache: false + - name: Unit tests + working-directory: ./promxy-operator + run: | + make test