Skip to content

Commit

Permalink
towards rostests
Browse files Browse the repository at this point in the history
  • Loading branch information
klaxalk committed Nov 15, 2023
1 parent ae23469 commit cde29ee
Show file tree
Hide file tree
Showing 7 changed files with 398 additions and 176 deletions.
37 changes: 37 additions & 0 deletions .ci/get_test_matrix.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
#!/bin/bash

set -e

trap 'last_command=$current_command; current_command=$BASH_COMMAND' DEBUG
trap 'echo "$0: \"${last_command}\" command failed with exit code $?, log:" && cat /tmp/log.txt' ERR

DEBUG=false

LIST=mrs
ARCH=amd64

YAML_FILE=$LIST.yaml

REPOS=$(./.ci/parse_yaml.py $YAML_FILE $ARCH)

FIRST=true

echo "["

echo "$REPOS" | while IFS= read -r REPO; do

$DEBUG && echo "Cloning $REPO"

PACKAGE=$(echo "$REPO" | awk '{print $1}')
URL=$(echo "$REPO" | awk '{print $2}')
TEST=$(echo "$REPO" | awk '{print $6}')

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

echo "$PACKAGE,"

done

echo "]"
16 changes: 12 additions & 4 deletions .ci/parse_yaml.py
Original file line number Diff line number Diff line change
Expand Up @@ -31,23 +31,31 @@ def main():
stable_ref = "none"
testing_ref = "none"
unstable_ref = "none"
ros_test = 0

refs = properties['git_refs']

try:
stable_ref = refs['stable']
except:
pass

try:
stable_ref = properties['stable_ref']
testing_ref = refs['testing']
except:
pass

try:
testing_ref = properties['testing_ref']
unstable_ref = refs['unstable']
except:
pass

try:
unstable_ref = properties['unstable_ref']
ros_test = bool(properties['ros_test'])
except:
pass

print("{} {} {} {} {}".format(package, url, stable_ref, testing_ref, unstable_ref))
print("{} {} {} {} {} {}".format(package, url, stable_ref, testing_ref, unstable_ref, ros_test))

if __name__ == '__main__':
main()
78 changes: 78 additions & 0 deletions .github/workflows/rostest.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: rostest

on:
workflow_dispatch:

# schedule:
# - cron: '0 20 * * *' # every day at 10pm UTC+2

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}

jobs:

generate-jobs:
runs-on: ubuntu-20.04
outputs:
packages: ${{ steps.generate.outputs.packages }}
steps:
- 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: generate
run: |
JOB_STRATEGY_MATRIX=$(./.ci/get_test_matrix.sh)
cat /tmp/log.txt
echo "packages=$JOB_STRATEGY_MATRIX" >> "$GITHUB_OUTPUT"
build-job:
needs: generate-jobs
runs-on: ubuntu-20.04
timeout-minutes: 360 # 6 hour timeout
strategy:
matrix:
job: ${{ fromJson(needs.generate-jobs.outputs.packages) }}
max-parallel: 1 # Run jobs serially
steps:
- 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: build
run: |
echo "testing..."
merge:
runs-on: ubuntu-20.04
needs: build-job
env:
PUSH_TOKEN: ${{ secrets.PUSH_TOKEN }}
steps:
- 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 }}
- name: Merge
run: echo "Merging release_candidate to release"
Loading

0 comments on commit cde29ee

Please sign in to comment.