Skip to content

Commit

Permalink
try composite action
Browse files Browse the repository at this point in the history
  • Loading branch information
Benedikt Haas committed May 28, 2024
1 parent cacac52 commit 7bb0663
Show file tree
Hide file tree
Showing 2 changed files with 113 additions and 41 deletions.
58 changes: 58 additions & 0 deletions .github/composite/simulation-testing/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: 'simulation-testing'
description: 'Deploys a customizable, dockerized simulation environment to execute and evaluate OpenSCENARIO files'

inputs:
# Env deploy
composefile-path:
description: Path to Composefile that will be used directly or via merge with a remote file for the deployment
required: true
remote-repository:
description: Optional GitHub repository containing Composefiles ( org1/repo1 => https://github.com/org1/repo1 )
remote-deploytoken:
description: Deploy token that will be used to access the remote repository
remote-composefile:
description: Path to the Composefile(s) from the remote repository which should be downloaded
# Scenario exec
scenario-runner-image:
description: 'Image of the CARLA scenario runner'
default: 'rwthika/carla-scenario-runner:latest'
scenario-folder-path:
description: 'Path to folder containing the scenario(s) and optional catalogs subfolder'
required: true
scenario-file-name:
description: 'Filename of scenario'
required: true
carla-hostname:
description: 'Hostname of CARLA simulator that the scenario runner should connect to'
default: 'carla-simulator'
docker-network:
description: 'Docker network that the scenario runner should attach to'
default: 'simtest_default'

runs:

using: 'composite'
steps:
- name: Deploy simulation environment
uses: ./.github/actions/deploy-environment
env:
RENDERCOMPOSE_OUTFILE: ${GITHUB_ACTION_PATH}/rendered-composefile.yml
with:
composefile-path: ${{ inputs.composefile-path }}
remote-repository: ${{ inputs.remote-repository }}
remote-deploytoken: ${{ inputs.remote-deploytoken }}
remote-composefile: ${{ inputs.remote-composefile }}
remote-path: ${GITHUB_ACTION_PATH}/rendercompose-remote
- name: Run scenario
uses: ./.github/actions/run-scenario
with:
scenario-folder-path: ${{ inputs.scenario-folder-path }}
scenario-file-name: ${{ inputs.scenario-file-name }}
carla-hostname: ${{ inputs.carla-hostname }}
docker-network: ${{ inputs.docker-network }}
- name: Destroy simulation environment
shell: bash
if: ${{ always() }}
run: |
docker compose -f ${GITHUB_ACTION_PATH}/rendered-composefile.yml kill
docker compose -f ${GITHUB_ACTION_PATH}/rendered-composefile.yml down
96 changes: 55 additions & 41 deletions .github/workflows/testing.yml
Original file line number Diff line number Diff line change
@@ -1,74 +1,88 @@
name: testing-workflow
on: push
jobs:
deploy-environment:
runs-on: [self-hosted, i2100038]
name: deploy environment
steps:
- uses: actions/checkout@v4
- shell: bash
run: |
xhost +local:
- uses: ./.github/actions/deploy-environment
with:
composefile-path: temp-composefile.yml
remote-repository: BenediktHaas96/testing
remote-deploytoken: ${{ secrets.SSH_PRIVKEY }}
remote-composefile: "myfolder/myfile.yml"
remote-path: ./deploy-env/

# check-rendered-composefile:
# needs: deploy-environment
# deploy-environment:
# runs-on: [self-hosted, i2100038]
# name: check rendered composefile
# name: deploy environment
# steps:
# - uses: actions/download-artifact@v4
# with:
# name: rendered-composefile
# - uses: actions/checkout@v4
# - shell: bash
# run: cat temp-composefile.yml
# run: |
# xhost +local:
# - uses: ./.github/actions/deploy-environment
# with:
# composefile-path: temp-composefile.yml
# remote-repository: BenediktHaas96/testing
# remote-deploytoken: ${{ secrets.SSH_PRIVKEY }}
# remote-composefile: "myfolder/myfile.yml"
# remote-path: ./deploy-env/

generate-scenario-job-matrix:
# needs: check-rendered-composefile
needs: deploy-environment
# needs: deploy-environment
runs-on: [self-hosted, i2100038]
name: generate scenario job matrix
name: Generate scenario job matrix
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
steps:
- uses: actions/checkout@v4
- id: generate
uses: ./.github/actions/generate-job-matrix
with:
starting-point: ./tmpfolder
query-string: '*.xosc'
exclude-string: '*/catalogs/*'

run-scenarios:
simulation-scenario-tests:
needs: generate-scenario-job-matrix
runs-on: [self-hosted, i2100038]
name: Run ${{ matrix.filename }}
name: Evaluate ${{ matrix.filename }}
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.generate-scenario-job-matrix.outputs.matrix) }}
steps:
- uses: ./.github/actions/run-scenario
- shell: bash
run: |
xhost +local:
- uses: ./.github/composite/simulation-testing
with:
composefile-path: temp-composefile.yml
remote-repository: BenediktHaas96/testing
remote-deploytoken: ${{ secrets.SSH_PRIVKEY }}
remote-composefile: "myfolder/myfile.yml"
scenario-folder-path: ${{ matrix.filedir }}
scenario-file-name: ${{ matrix.filename }}
carla-hostname: carla-simulator
docker-network: tempcompose_default

destroy-environment:
needs: run-scenarios
if: ${{ always() && !cancelled() }}
runs-on: [self-hosted, i2100038]
name: destroy environment
steps:
- uses: actions/download-artifact@v4
with:
name: rendered-composefile
- shell: bash
run: |
docker compose -f temp-composefile.yml kill
docker compose -f temp-composefile.yml down
xhost -local:
# run-scenarios:
# needs: generate-scenario-job-matrix
# runs-on: [self-hosted, i2100038]
# name: Run ${{ matrix.filename }}
# strategy:
# fail-fast: false
# matrix: ${{ fromJson(needs.generate-scenario-job-matrix.outputs.matrix) }}
# steps:
# - uses: ./.github/actions/run-scenario
# with:
# scenario-folder-path: ${{ matrix.filedir }}
# scenario-file-name: ${{ matrix.filename }}
# carla-hostname: carla-simulator
# docker-network: tempcompose_default

# destroy-environment:
# needs: run-scenarios
# if: ${{ always() && !cancelled() }}
# runs-on: [self-hosted, i2100038]
# name: destroy environment
# steps:
# - uses: actions/download-artifact@v4
# with:
# name: rendered-composefile
# - shell: bash
# run: |
# docker compose -f temp-composefile.yml kill
# docker compose -f temp-composefile.yml down
# xhost -local:

0 comments on commit 7bb0663

Please sign in to comment.