Skip to content

Commit

Permalink
Fix autotest workflow.
Browse files Browse the repository at this point in the history
  • Loading branch information
domchen committed Oct 24, 2023
1 parent 806dbe2 commit 4883678
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 23 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/autotest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,8 @@ jobs:
runs-on: macos-latest
steps:
- name: Check Out Repo
uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
fetch-depth: 0
lfs: true

- name: Get Environment Cache
Expand Down Expand Up @@ -78,20 +77,17 @@ jobs:
./codeformat.sh
shell: bash

- name: Update Baseline
if: github.event_name == 'push'
run: |
chmod +x update_baseline.sh
./update_baseline.sh 1
- name: Run Autotest
if: github.event_name == 'pull_request'
run: |
chmod +x autotest.sh
./autotest.sh
- name: Update Codecov
if: github.event_name == 'push'
- name: Run Codecov
run: |
chmod +x codecov.sh
./codecov.sh
- name: Upload Codecov
uses: codecov/[email protected]
with:
token: ${{ secrets.CODECOV_TOKEN }}
Expand Down
3 changes: 1 addition & 2 deletions autotest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ cd $WORKSPACE
make_dir result
make_dir build

./update_baseline.sh 1
cp -r $WORKSPACE/test/baseline $WORKSPACE/result

cd build
Expand Down Expand Up @@ -64,8 +65,6 @@ cp -a $WORKSPACE/build/*.json $WORKSPACE/result/

cd ..

gcovr -r . -f='src/' -f='include/' --xml-pretty -o ./result/coverage.xml

rm -rf build

cp -r $WORKSPACE/test/out $WORKSPACE/result
Expand Down
4 changes: 4 additions & 0 deletions codecov.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/bash -e
cd $(dirname $0)
mkdir -p result
gcovr -r . -f='src/' -f='include/' --xml-pretty -o ./result/coverage.xml
12 changes: 2 additions & 10 deletions update_baseline.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/sh
{
CACHE_VERSION_FILE=./test/baseline/.cache/version.json
if [[ $1 != "1" ]] && [ -f "$CACHE_VERSION_FILE" ]; then
if [ -f "$CACHE_VERSION_FILE" ]; then
HAS_DIFF=$(git diff --name-only origin/main:test/baseline/version.json $CACHE_VERSION_FILE)
if [[ ${HAS_DIFF} == "" ]]; then
exit 0
Expand All @@ -16,9 +16,6 @@

if [[ $1 == "1" ]]; then
BUILD_DIR=build
if [ ! $(which gcovr) ]; then
brew install gcovr
fi
else
BUILD_DIR=cmake-build-debug
fi
Expand Down Expand Up @@ -53,7 +50,7 @@
if test $? -eq 0; then
echo "~~~~~~~~~~~~~~~~~~~Update Baseline Success~~~~~~~~~~~~~~~~~~~~~"
else
echo "~~~~~~~~~~~~~~~~~~~TGFXFullTest Failed~~~~~~~~~~~~~~~~~~"
echo "~~~~~~~~~~~~~~~~~~~Update Baseline Failed~~~~~~~~~~~~~~~~~~"
COMPLIE_RESULT=false
fi

Expand All @@ -64,11 +61,6 @@
git stash pop --index --quiet
fi

if [[ $1 == "1" ]]; then
mkdir -p result
gcovr -r . -f='src/' -f='include/' --xml-pretty -o ./result/coverage.xml
fi

if [ "$COMPLIE_RESULT" == false ]; then
mkdir -p result
cp -r test/out result
Expand Down

0 comments on commit 4883678

Please sign in to comment.