Skip to content

Commit

Permalink
Updated github workflow for open github (#86)
Browse files Browse the repository at this point in the history
* Updated github workflow for open github

* minor fixes
  • Loading branch information
hmgowda authored and ddhawal committed Feb 22, 2024
1 parent 3fef2ec commit b70f844
Show file tree
Hide file tree
Showing 2 changed files with 30 additions and 90 deletions.
70 changes: 15 additions & 55 deletions .github/workflows/onmergerelease.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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
50 changes: 15 additions & 35 deletions .github/workflows/onpullrequest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand All @@ -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
Expand All @@ -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

0 comments on commit b70f844

Please sign in to comment.