Skip to content

Commit

Permalink
fixing tests
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Dec 2, 2023
1 parent 60bb8a8 commit 49afa5a
Show file tree
Hide file tree
Showing 3 changed files with 126 additions and 22 deletions.
52 changes: 31 additions & 21 deletions .ci/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
trap 'echo "$0: \"${last_command}\" command failed with exit code $?"' ERR

LIST=mrs
VARIANT=testing
REPOSITORY_NAME=$1
ARTIFACT_FOLDER=$2
VARIANT=$3
WORKSPACE=/tmp/workspace

YAML_FILE=${LIST}.yaml
Expand Down Expand Up @@ -64,32 +64,36 @@ done

## | ------- clone other packages for full test coverage ------ |

echo "$FULL_COVERAGE_REPOS" | while IFS= read -r REPO; do
if [[ "$VARIANT" == "testing" ]]; then

$DEBUG && echo "Cloning $REPO"
echo "$FULL_COVERAGE_REPOS" | while IFS= read -r REPO; do

PACKAGE=$(echo "$REPO" | awk '{print $1}')
URL=$(echo "$REPO" | awk '{print $2}')
BRANCH=$(echo "$REPO" | awk '{print $3}')
TEST=$(echo "$REPO" | awk '{print $6}')
FULL_COVERAGE=$(echo "$REPO" | awk '{print $7}')
$DEBUG && echo "Cloning $REPO"

if [[ "$TEST" != "True" ]]; then
continue
fi
PACKAGE=$(echo "$REPO" | awk '{print $1}')
URL=$(echo "$REPO" | awk '{print $2}')
BRANCH=$(echo "$REPO" | awk '{print $3}')
TEST=$(echo "$REPO" | awk '{print $6}')
FULL_COVERAGE=$(echo "$REPO" | awk '{print $7}')

if [[ "$FULL_COVERAGE" != "True" ]]; then
continue
fi
if [[ "$TEST" != "True" ]]; then
continue
fi

if [[ "$PACKAGE" == "$REPOSITORY_NAME" ]]; then
continue
fi
if [[ "$FULL_COVERAGE" != "True" ]]; then
continue
fi

echo "$0: cloning '$URL --depth 1 --branch $BRANCH' into '$PACKAGE'"
git clone $URL --recurse-submodules --shallow-submodules --depth 1 --branch $BRANCH $PACKAGE
if [[ "$PACKAGE" == "$REPOSITORY_NAME" ]]; then
continue
fi

done
echo "$0: cloning '$URL --depth 1 --branch $BRANCH' into '$PACKAGE'"
git clone $URL --recurse-submodules --shallow-submodules --depth 1 --branch $BRANCH $PACKAGE

done

fi

cd $WORKSPACE/src

Expand All @@ -103,7 +107,13 @@ catkin build --limit-status-rate 0.2

echo "$0: testing"

catkin test
cd $WORKSPACE/src/$REPOSITORY_NAME
ROS_DIRS=$(find . -name package.xml -printf "%h\n")

for DIR in $ROS_DIRS; do
cd $WORKSPACE/src/$REPOSITORY_NAME/$DIR
catkin test --this
done

echo "$0: tests finished"

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/rostest_to_release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ jobs:
token: ${{ secrets.PUSH_TOKEN }}
- id: test
run: |
.ci/test.sh "${{ matrix.job }}" /tmp/artifacts
.ci/test.sh "${{ matrix.job }}" /tmp/artifacts testing
- name: Save artifacts
uses: actions/upload-artifact@v3
with:
Expand Down
94 changes: 94 additions & 0 deletions .github/workflows/test_unstable.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: test_unstable

on:

workflow_dispatch:

jobs:

init-artifacts:
runs-on: ubuntu-20.04
steps:
- id: execute
run: |
mkdir -p /tmp/artifacts
touch /tmp/artifacts/void
- name: Save artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
path: /tmp/artifacts/

generate-jobs:
needs: init-artifacts
runs-on: ubuntu-20.04
outputs:
packages: ${{ steps.generate.outputs.packages }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
- id: generate
run: |
JOB_STRATEGY_MATRIX=$(./.ci/get_test_matrix.sh)
echo "packages=$JOB_STRATEGY_MATRIX" >> "$GITHUB_OUTPUT"
test-job:
needs: generate-jobs
runs-on: ubuntu-20.04
timeout-minutes: 360 # 6 hour timeout
strategy:
fail-fast: false
matrix:
job: ${{ fromJson(needs.generate-jobs.outputs.packages) }}
steps:
- name: Load artifacts
uses: actions/download-artifact@v3
with:
name: artifacts
path: /tmp/artifacts/
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
- name: Checkout CI scripts
uses: actions/checkout@v3
with:
repository: ctu-mrs/ci_scripts
ref: master
path: .ci_scripts
token: ${{ secrets.PUSH_TOKEN }}
- id: test
run: |
.ci/test.sh "${{ matrix.job }}" /tmp/artifacts unstable
- name: Save artifacts
uses: actions/upload-artifact@v3
with:
name: artifacts
path: /tmp/artifacts/

publish_coverage:
runs-on: ubuntu-20.04
needs: test-job
steps:
- name: Load artifacts
uses: actions/download-artifact@v3
with:
name: artifacts
path: /tmp/artifacts/
- uses: actions/checkout@v3
with:
fetch-depth: 0
submodules: 'recursive'
- id: test
run: |
ls -la /tmp/artifacts
./.ci/publish_coverage.sh /tmp/artifacts
- name: Deploy
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: /tmp/coverage_html
allow_empty_commit: true
force_orphan: true

0 comments on commit 49afa5a

Please sign in to comment.