Skip to content

Commit

Permalink
CV2-4794:Add coverage results to upload to s3 bucket on push event (#…
Browse files Browse the repository at this point in the history
…1965)

* CV2-4794:Add coverage results to upload to s3 bucket on push event

* change the variable name from GITHUB_PULL_REQUEST to GITHUB_EVENT to match action

* fix syntax error

* fix fmt error

---------

Co-authored-by: chinelo-obitube <[email protected]>
  • Loading branch information
chinelo-obitube and chinelo-obitube authored Jul 22, 2024
1 parent 1caff4d commit fb82962
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 20 deletions.
36 changes: 18 additions & 18 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: set up enviroments
- name: Set up Enviroments
run: |
export RECORD_RUNTIME=true
export LC_ALL=C.UTF-8
Expand All @@ -48,7 +48,7 @@ jobs:
export PATH=/root/.local/bin:$PATH
rm -rf tmp/cache tmp/cache1 tmp/cache2 tmp/cache3 tmp/cache4 tmp/cache5 && mkdir -p tmp/cache tmp/cache1 tmp/cache2 tmp/cache3 tmp/cache4 tmp/cache5
- name: set up comfiguration files
- name: Set up Configuration Files
run: |
cp config/config.yml.example config/config.yml
cp config/database.yml.example config/database.yml
Expand All @@ -72,10 +72,10 @@ jobs:
- name: Set up parallel environment
run: docker-compose exec -T api test/setup-parallel-env.sh

- name: Precompile assets
- name: Precompile Assets
run: docker-compose exec -T api bundle exec rake assets:precompile

- name: Prepare parallel runtime log
- name: Prepare Parallel Runtime Log
run: |
sleep 10
touch tmp/parallel_runtime_test.log
Expand All @@ -90,7 +90,7 @@ jobs:
- name: After Functional Test
env:
GITHUB_PULL_REQUEST: ${{ github.event_name}}
GITHUB_EVENT: ${{ github.event_name}}
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
GITHUB_REPO: ${{ github.repository }}
GITHUB_TEST_RESULT: ${{ steps.functional-tests.outcome}}
Expand All @@ -104,7 +104,7 @@ jobs:
AWS_REGION: eu-west-1
run: |
docker-compose exec -T -e GIT_BRANCH=$GIT_BRANCH \
-e GITHUB_PULL_REQUEST=$GITHUB_PULL_REQUEST \
-e GITHUB_EVENT=$GITHUB_EVENT \
-e GITHUB_TEST_RESULT=$GITHUB_TEST_RESULT \
-e GITHUB_REPO=$GITHUB_REPO \
-e GITHUB_BUILD_NUMBER=$GITHUB_BUILD_NUMBER \
Expand Down Expand Up @@ -151,7 +151,7 @@ jobs:
export PATH=/root/.local/bin:$PATH
rm -rf tmp/cache tmp/cache1 tmp/cache2 tmp/cache3 tmp/cache4 tmp/cache5 && mkdir -p tmp/cache tmp/cache1 tmp/cache2 tmp/cache3 tmp/cache4 tmp/cache5
- name: set up comfiguration files
- name: Set up Configuration Files
run: |
cp config/config.yml.example config/config.yml
cp config/database.yml.example config/database.yml
Expand All @@ -175,10 +175,10 @@ jobs:
- name: Set up parallel environment
run: docker-compose exec -T api test/setup-parallel-env.sh

- name: Precompile assets
- name: Precompile Assets
run: docker-compose exec -T api bundle exec rake assets:precompile

- name: Prepare parallel runtime log
- name: Prepare Parallel Runtime Log
run: |
sleep 10
touch tmp/parallel_runtime_test.log
Expand All @@ -193,7 +193,7 @@ jobs:
- name: After Unit Test
env:
GITHUB_PULL_REQUEST: ${{ github.event_name}}
GITHUB_EVENT: ${{ github.event_name}}
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
GITHUB_REPO: ${{ github.repository }}
GITHUB_TEST_RESULT: ${{ steps.unit-tests.outcome}}
Expand All @@ -207,7 +207,7 @@ jobs:
AWS_REGION: eu-west-1
run: |
docker-compose exec -T -e GIT_BRANCH=$GIT_BRANCH \
-e GITHUB_PULL_REQUEST=$GITHUB_PULL_REQUEST \
-e GITHUB_EVENT=$GITHUB_EVENT \
-e GITHUB_TEST_RESULT=$GITHUB_TEST_RESULT \
-e GITHUB_REPO=$GITHUB_REPO \
-e GITHUB_BUILD_NUMBER=$GITHUB_BUILD_NUMBER \
Expand Down Expand Up @@ -245,7 +245,7 @@ jobs:
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: set up enviromnts
- name: Set up Enviroments
run: |
export RECORD_RUNTIME=true
export LC_ALL=C.UTF-8
Expand All @@ -254,7 +254,7 @@ jobs:
export PATH=/root/.local/bin:$PATH
rm -rf tmp/cache tmp/cache1 tmp/cache2 tmp/cache3 tmp/cache4 tmp/cache5 && mkdir -p tmp/cache tmp/cache1 tmp/cache2 tmp/cache3 tmp/cache4 tmp/cache5
- name: set up comfiguration files
- name: Set up Configuration Files
run: |
cp config/config.yml.example config/config.yml
cp config/database.yml.example config/database.yml
Expand All @@ -278,13 +278,13 @@ jobs:
tail -f log/test.log &
until curl --silent -I -f --fail http://localhost:3000 ; do printf .; sleep 1; done
- name: Set up parallel environment
- name: Set up Parallel Environment
run: docker-compose exec -T api test/setup-parallel-env.sh

- name: Precompile assets
- name: Precompile Assets
run: docker-compose exec -T api bundle exec rake assets:precompile

- name: Prepare parallel runtime log
- name: Prepare Parallel Runtime Log
run: |
sleep 10
touch tmp/parallel_runtime_test.log
Expand All @@ -299,7 +299,7 @@ jobs:
- name: After Contract Test
env:
GITHUB_PULL_REQUEST: ${{ github.event_name}}
GITHUB_EVENT: ${{ github.event_name}}
GIT_BRANCH: ${{ github.head_ref || github.ref_name }}
GITHUB_REPO: ${{ github.repository }}
GITHUB_TEST_RESULT: ${{ steps.run-tests.outcome}}
Expand All @@ -313,7 +313,7 @@ jobs:
AWS_REGION: eu-west-1
run: |
docker-compose exec -T -e GIT_BRANCH=$GIT_BRANCH \
-e GITHUB_PULL_REQUEST=$GITHUB_PULL_REQUEST \
-e GITHUB_EVENT=$GITHUB_EVENT \
-e GITHUB_TEST_RESULT=$GITHUB_TEST_RESULT \
-e GITHUB_REPO=$GITHUB_REPO \
-e GITHUB_BUILD_NUMBER=$GITHUB_BUILD_NUMBER \
Expand Down
2 changes: 1 addition & 1 deletion test/format-coverage.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

apt-get install -y awscli

if [ "$GITHUB_PULL_REQUEST" == "pull_request" ]
if [[ "$GITHUB_EVENT" == "pull_request" || "$GITHUB_EVENT" == "push" ]]
then
./test/cc-test-reporter format-coverage -t simplecov --output ../coverage/codeclimate.$GITHUB_JOB_NAME.json ../coverage/.resultset.json
aws s3 cp ../coverage/codeclimate.$GITHUB_JOB_NAME.json s3://check-api-github/codeclimate/$GITHUB_REPO/$GITHUB_BUILD_NUMBER/codeclimate.$GITHUB_JOB_NAME.json
Expand Down
2 changes: 1 addition & 1 deletion test/sum-upload-coverage.sh
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
#!/bin/bash

if [[ "$GITHUB_PULL_REQUEST" == "pull_request" ]] && [[ "$GITHUB_TEST_RESULT" == 'success' ]]
if [[ "$GITHUB_EVENT" == "pull_request" || "$GITHUB_EVENT" == "push" ]] && [[ "$GITHUB_TEST_RESULT" == 'success' ]]
then
rm -rf ../coverage/*
aws s3 cp --recursive s3://check-api-github/codeclimate/$GITHUB_REPO/$GITHUB_BUILD_NUMBER/ ../coverage
Expand Down

0 comments on commit fb82962

Please sign in to comment.