Skip to content

Refactoring: fix duplicates #106

Refactoring: fix duplicates

Refactoring: fix duplicates #106

Workflow file for this run

name: saptuneUnittst
# Controls when the workflow will run
on:
# Triggers the workflow on pull request events but only for the master and sle-12 branch
push:
branches: [ master, saptune_test ]
pull_request:
branches: [ master ]
env:
CC_TEST_REPORTER_URL: https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
CC_PREFIX: github.com/SUSE/saptune/
jobs:
saptuneUt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- 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'
- 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'
- name: Download test coverage reporter
run: |
curl -L $CC_TEST_REPORTER_URL > ./cc-test-reporter
chmod +x ./cc-test-reporter
./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
- name: Run Container Image
run: docker run --name saptune-ci --privileged --tmpfs /run -v /sys/fs/cgroup:/sys/fs/cgroup:rw --cgroupns=host -td -v "${{ github.workspace }}:/app" registry.opensuse.org/home/angelabriel/st-ci-base/containers/st-ci-base:latest
- name: Get Container Logs
run: docker logs saptune-ci
- name: Run saptune unit tests
run: docker exec -t saptune-ci /bin/sh -c "cd /app; ./run_saptune_ci_tst.sh;"
- 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