Skip to content

Commit

Permalink
test
Browse files Browse the repository at this point in the history
  • Loading branch information
Wabri committed Aug 6, 2024
1 parent 3758cc1 commit 8b20ad2
Showing 1 changed file with 13 additions and 62 deletions.
75 changes: 13 additions & 62 deletions .github/workflows/saptune-ut.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
name: Saptune Continuous Integration

name: saptuneUnittst

# Controls when the workflow will run
on:
Expand All @@ -14,59 +15,29 @@ env:
CC_PREFIX: github.com/SUSE/saptune/

jobs:
Setup_Git_Env:
saptuneUt:
runs-on: ubuntu-latest
outputs:
branch: ${{ steps.branch.outputs.GIT_BRANCH }}
commit_sha: ${{ steps.commit_sha.outputs.GIT_COMMIT_SHA }}
steps:
- uses: actions/checkout@v4

- name: Set ENV (push)
run: |
echo "GIT_BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=${{ github.sha }}" >> $GITHUB_ENV
if: github.event_name == 'push'

- name: Set ENV (pull_request)
- name: Set ENV for codeclimate (pull_request)
run: |
git fetch --no-tags --prune --depth=1 origin +refs/heads/${{ github.base_ref }}:refs/remotes/origin/${{ github.head_ref }}
echo "GIT_BRANCH=${{ github.head_ref }}" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=$(git rev-parse origin/${{ github.head_ref }})" >> $GITHUB_ENV
if: github.event_name == 'pull_request'

- id: branch
run: echo "GIT_BRANCH=${GIT_BRANCH}" >> "$GITHUB_OUTPUT"

- id: commit_sha
run: echo "GIT_COMMIT_SHA=${GIT_COMMIT_SHA}" >> "$GITHUB_OUTPUT"
- name: Set ENV for codeclimate (push)
run: |
echo "GIT_BRANCH=${{ github.ref }}" >> $GITHUB_ENV
echo "GIT_COMMIT_SHA=${{ github.sha }}" >> $GITHUB_ENV
if: github.event_name == 'push'

Code_climate_report_before_build:
runs-on: ubuntu-latest
needs: Setup_Git_Env
steps:
- name: Download test coverage reporter
run: |
curl -L $CC_TEST_REPORTER_URL > ./cc-test-reporter
chmod +x ./cc-test-reporter
- uses: actions/upload-artifact@v4
with:
name: codeclimate-reporter
path: cc-test-reporter

- name: Run the test reporter before-build
env:
GIT_BRANCH: ${{needs.Setup_Git_Env.outputs.branch}}
GIT_COMMIT_SHA: ${{needs.Setup_Git_Env.outputs.commit_sha}}
run: ./cc-test-reporter before-build

Saptune_unit_test:
needs: Code_climate_report_before_build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

./cc-test-reporter before-build
- name: Pull the Container Image
run: docker pull registry.opensuse.org/home/angelabriel/st-ci-base/containers/st-ci-base:latest

Expand All @@ -79,31 +50,11 @@ jobs:
- name: Run saptune unit tests
run: docker exec -t saptune-ci /bin/sh -c "cd /app; ./run_saptune_ci_tst.sh;"

- uses: actions/upload-artifact@v4
with:
name: coverprofile
path: c.out
- name: Code Climate report coverage
run: ./cc-test-reporter after-build --debug --prefix ${{ env.CC_PREFIX }} --exit-code $?
if: ${{ env.CC_TEST_REPORTER_ID }}

- name: Stop and remove Container Image
run: |
docker stop saptune-ci
docker rm saptune-ci
Code_climate_report_after_build:
needs: Saptune_unit_test
runs-on: ubuntu-latest
steps:
- uses: actions/download-artifact@v4
with:
name: coverprofile

- uses: actions/download-artifact@v4
with:
name: codeclimate-reporter

- name: Code Climate report coverage
env:
GIT_BRANCH: ${{needs.Setup_Git_Env.outputs.branch}}
GIT_COMMIT_SHA: ${{needs.Setup_Git_Env.outputs.commit_sha}}
run: ./cc-test-reporter after-build --debug --prefix ${{ env.CC_PREFIX }} --exit-code $?
if: env.CC_TEST_REPORTER_ID != ''

0 comments on commit 8b20ad2

Please sign in to comment.