diff --git a/.github/workflows/build-packages.yml b/.github/workflows/build-packages.yml index ccded3edc6..5d98b4df33 100644 --- a/.github/workflows/build-packages.yml +++ b/.github/workflows/build-packages.yml @@ -1,10 +1,10 @@ name: Build packages -# Start build process only on E2E completion # Big chunk of the build process logic is in the mage build targets on: - workflow_run: - workflows: [E2E tests] - types: [completed] + workflow_call: + push: + branches: [master] + tags: # Mage's `GenerateEnvFile` talks to GH API to setup tags, versions, etc. env: @@ -15,10 +15,7 @@ env: jobs: build-packages: - if: | - ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest - environment: production strategy: max-parallel: 4 @@ -62,10 +59,7 @@ jobs: go run mage.go -v ${{ matrix.platform }} build-swagger: - if: | - ${{ github.event.workflow_run.conclusion == 'success' }} runs-on: ubuntu-latest - environment: production needs: [build-packages] steps: diff --git a/.github/workflows/e2e.yml b/.github/workflows/e2e.yml deleted file mode 100644 index ab79e58419..0000000000 --- a/.github/workflows/e2e.yml +++ /dev/null @@ -1,33 +0,0 @@ -name: E2E tests -# Run E2E tests after Unit tests (currently, they run on PRs) -on: - workflow_run: - workflows: [Unit tests and linters] - types: [completed] - -jobs: - e2e-tests: - # Parent workflow (unit tests) must succeed - if: | - ${{ github.event.workflow_run.conclusion == 'success' }} - runs-on: ubuntu-latest - environment: production - - steps: - - uses: actions/checkout@v4 - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: '1.21.x' - - - name: Login to Docker Hub - uses: docker/login-action@v3 - with: - username: ${{ secrets.DOCKERHUB_USERNAME }} - password: ${{ secrets.DOCKERHUB_PASSWORD }} - - - name: E2E basic test - run: go run mage.go -v TestE2EBasic - - - name: E2E NAT test - run: go run mage.go -v TestE2ENAT diff --git a/.github/workflows/tests-and-linters.yml b/.github/workflows/tests-and-linters.yml new file mode 100644 index 0000000000..b3ff7ad3a7 --- /dev/null +++ b/.github/workflows/tests-and-linters.yml @@ -0,0 +1,60 @@ +name: Tests +on: + pull_request: + +env: + GOFLAGS: "-count=1" + +jobs: + unit-tests: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.21.x' + + - name: Install protoc + run: sudo apt install -y protobuf-compiler + + - name: Unit tests and linters + run: | + go run mage.go -v Generate + go run mage.go -v Check + go run mage.go -v TestWithCoverage + + - name: Upload codecov report + uses: codecov/codecov-action@v4 + with: + file: ./coverage.txt + token: ${{ secrets.CODECOV_TOKEN }} + + e2e-tests: + runs-on: ubuntu-latest + needs: unit-tests + + steps: + - uses: actions/checkout@v4 + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.21.x' + + - name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_PASSWORD }} + + - name: E2E basic test + run: go run mage.go -v TestE2EBasic + + - name: E2E NAT test + run: go run mage.go -v TestE2ENAT + + verify-build: + needs: [unit-tests, e2e-tests] + uses: ./.github/workflows/build-packages.yml + secrets: inherit diff --git a/.github/workflows/unit-tests-and-linters.yml b/.github/workflows/unit-tests-and-linters.yml deleted file mode 100644 index 3b7899733c..0000000000 --- a/.github/workflows/unit-tests-and-linters.yml +++ /dev/null @@ -1,37 +0,0 @@ -name: Unit tests and linters -# Run unit tests on all pull requests -on: - pull_request: - -env: - GOFLAGS: "-count=1" - -jobs: - unit-tests: - runs-on: ubuntu-latest - environment: production - - steps: - - uses: actions/checkout@v4 - - name: Setup Go - uses: actions/setup-go@v4 - with: - go-version: '1.21.x' - - - name: Install protoc - run: sudo apt install -y protobuf-compiler - - - name: Unit tests and linters - run: | - go run mage.go -v Generate - go run mage.go -v Check - go run mage.go -v TestWithCoverage - - - name: Upload codecov report - uses: codecov/codecov-action@v4 - with: - file: ./coverage.txt - token: ${{ secrets.CODECOV_TOKEN }} - - -