Skip to content

Commit

Permalink
Added offscreen cicd & local cache
Browse files Browse the repository at this point in the history
  • Loading branch information
JulianTrommer committed Oct 24, 2024
1 parent b3aed2c commit 92e2f9f
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 9 deletions.
11 changes: 6 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ jobs:
file: ./build/docker/agent/Dockerfile
load: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:test
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=local
cache-to: type=local,mode=max
build-args: |
USERNAME=paf
USER_UID=1000
Expand All @@ -67,8 +67,8 @@ jobs:
push: true
# tag 'latest' and version on push to main, otherwise use the commit hash
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest
cache-from: type=gha
cache-to: type=gha,mode=max
cache-from: type=local
cache-to: type=local,mode=max
build-args: |
USERNAME=paf
USER_UID=1000
Expand All @@ -85,4 +85,5 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: pr_id
path: pr/
path: pr/
retention-days: 1
14 changes: 12 additions & 2 deletions .github/workflows/drive.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@ jobs:
let matchArtifact = allArtifacts.data.artifacts.filter((artifact) => {
return artifact.name == "pr_id"
})[0];
if (!matchArtifact) {
core.setFailed('No pr_id artifact found from the build workflow');
return;
}
let download = await github.rest.actions.downloadArtifact({
owner: context.repo.owner,
repo: context.repo.repo,
Expand All @@ -42,12 +46,18 @@ jobs:
fs.writeFileSync(`${process.env.GITHUB_WORKSPACE}/pr_id.zip`, Buffer.from(download.data));
- name: 'Unzip artifact (PR ID)'
run: unzip pr_id.zip
run: |
unzip pr_id.zip
let issue_number = fs.readFileSync('./pr_id');
if (!issue_number || isNaN(Number(issue_number))) {
core.setFailed(`Invalid PR ID: ${prIdContent}`);
return;
}
- name: Run docker-compose
run: |
xhost +local:
USERNAME=$(whoami) USER_UID=$(id -u) USER_GID=$(id -g) docker compose up --quiet-pull --exit-code-from agent
USERNAME=$(whoami) USER_UID=$(id -u) USER_GID=$(id -g) RENDER_OFFSCREEN=-RenderOffScreen docker compose up --quiet-pull --exit-code-from agent
- name: Copy results
run: docker compose cp agent:/tmp/simulation_results.json .
- name: Stop docker-compose
Expand Down
2 changes: 1 addition & 1 deletion .vscode/settings.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
"docker.commands.composeUp": [
{
"label": "Compose Up",
"template": "xhost +local: && USERNAME=$(whoami) USER_UID=$(id -u) USER_GID=$(id -g) ${composeCommand} ${configurationFile} up"
"template": "xhost +local: && USERNAME=$(whoami) USER_UID=$(id -u) USER_GID=$(id -g) RENDER_OFFSCREEN= ${composeCommand} ${configurationFile} up"
}
],
"workbench.iconTheme": "vscode-icons",
Expand Down
2 changes: 1 addition & 1 deletion build/docker-compose.carla-simulator.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
services:
# based on https://github.com/ll7/paf21-1/blob/master/scenarios/docker-carla-sim-compose.yml
carla-simulator:
command: /bin/bash CarlaUE4.sh -quality-level=Epic -world-port=2000 -resx=800 -resy=600 -nosound -carla-settings="/home/carla/CarlaUE4/Config/CustomCarlaSettings.ini"
command: /bin/bash CarlaUE4.sh -quality-level=Epic -world-port=2000 -resx=800 -resy=600 -nosound -carla-settings="/home/carla/CarlaUE4/Config/CustomCarlaSettings.ini" ${RENDER_OFFSCREEN}
image: ghcr.io/una-auxme/paf23:leaderboard-2.0
init: true
deploy:
Expand Down

0 comments on commit 92e2f9f

Please sign in to comment.