From b70f84456cb5a09666f123959cf206030c87b56e Mon Sep 17 00:00:00 2001 From: hmgowda Date: Tue, 20 Feb 2024 09:57:05 -0800 Subject: [PATCH] Updated github workflow for open github (#86) * Updated github workflow for open github * minor fixes --- .github/workflows/onmergerelease.yml | 70 ++++++---------------------- .github/workflows/onpullrequest.yml | 50 ++++++-------------- 2 files changed, 30 insertions(+), 90 deletions(-) diff --git a/.github/workflows/onmergerelease.yml b/.github/workflows/onmergerelease.yml index be4fbb9..87c40aa 100644 --- a/.github/workflows/onmergerelease.yml +++ b/.github/workflows/onmergerelease.yml @@ -10,7 +10,7 @@ on: jobs: build-test-scan: - runs-on: [ self-hosted ] + runs-on: [ ubuntu-20.04 ] env: http_proxy: ${{ secrets.HTTP_PROXY }} https_proxy: ${{ secrets.HTTPS_PROXY }} @@ -20,6 +20,19 @@ jobs: with: fetch-depth: 0 + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.21.6' + + + - name: Style Checker + run: | + make go-fmt + if [ "$(make go-fmt | tail -n 1 | grep gofmt | wc -l)" -eq 0 ]; then + exit 1 + fi + - name: Unit Test run: | make test @@ -35,57 +48,4 @@ jobs: if [[ $COVERAGE -lt 80 ]]; then echo "Unit test coverage must be above 80% " exit 1 - fi - - - name: Build Image - run: make - - - name: Style Checker - run: | - make go-fmt - if [ "$(make go-fmt | tail -n 1 | grep gofmt | wc -l)" -eq 0 ]; then - exit 1 - fi - - checkmarx: - runs-on: [ self-hosted, taas ] - environment: Pull_Request_Environment - steps: - - uses: actions/checkout@v3 - - name: Scan - uses: intel-innersource/frameworks.devops.github.actions.checkmarx@main - with: - username: ${{ secrets.CHECKMARX_USERNAME }} - password: ${{ secrets.CHECKMARX_PASSWORD }} - project: Key Broker Service - team: /CxServer/SP/Intel/IntelProjects/IAP/36221 - - docker-push: - runs-on: [ self-hosted ] - needs: [ "checkmarx" ] - steps: - - uses: actions/checkout@v2 - with: - fetch-depth: 0 - - - name: Build Image - run: make - - - name: Docker Login - uses: docker/login-action@v2 - with: - registry: amr-registry.caas.intel.com - username: ${{ secrets.HARBOR_USERNAME }} - password: ${{ secrets.HARBOR_PASSWORD }} - logout: false - - - name: Push Image - run: | - make REPO=amr-registry.caas.intel.com/amber push-commit - - docker-prune: - runs-on: [ self-hosted ] - needs: [ "docker-push" ] - steps: - - name: Docker prune - run: docker system prune -f + fi \ No newline at end of file diff --git a/.github/workflows/onpullrequest.yml b/.github/workflows/onpullrequest.yml index 2fe8bfe..c16cb3e 100644 --- a/.github/workflows/onpullrequest.yml +++ b/.github/workflows/onpullrequest.yml @@ -2,13 +2,10 @@ name: OnPullRequest on: pull_request: - branches: - - 'main' - - 'release/*' jobs: build-test-scan: - runs-on: [ self-hosted ] + runs-on: [ ubuntu-20.04 ] env: http_proxy: ${{ secrets.HTTP_PROXY }} https_proxy: ${{ secrets.HTTPS_PROXY }} @@ -18,6 +15,19 @@ jobs: with: fetch-depth: 0 + - name: Setup Go + uses: actions/setup-go@v4 + with: + go-version: '1.21.6' + + + - name: Style Checker + run: | + make go-fmt + if [ "$(make go-fmt | tail -n 1 | grep gofmt | wc -l)" -eq 0 ]; then + exit 1 + fi + - name: Unit Test run: | make test @@ -33,34 +43,4 @@ jobs: if [[ $COVERAGE -lt 80 ]]; then echo "Unit test coverage must be above 80% " exit 1 - fi - - - name: Build Image - run: make - - - name: Style Checker - run: | - make go-fmt - if [ "$(make go-fmt | tail -n 1 | grep gofmt | wc -l)" -eq 0 ]; then - exit 1 - fi - - checkmarx: - runs-on: [ self-hosted, taas ] - environment: Pull_Request_Environment - steps: - - uses: actions/checkout@v3 - - name: Scan - uses: intel-innersource/frameworks.devops.github.actions.checkmarx@main - with: - username: ${{ secrets.CHECKMARX_USERNAME }} - password: ${{ secrets.CHECKMARX_PASSWORD }} - project: Key Broker Service - team: /CxServer/SP/Intel/IntelProjects/IAP/36221 - - clean-untagged-images: - runs-on: [ self-hosted ] - needs: [ "build-test-scan" ] - steps: - - name: Clean unused\untagged docker images. - run: docker rmi $(docker images --filter "dangling=true" -q --no-trunc) || true + fi \ No newline at end of file