Skip to content

Commit

Permalink
Merge pull request #353 from una-auxme/320-bug-cicd-not-running-in-of…
Browse files Browse the repository at this point in the history
…fscreen-mode

Added offscreen cicd & local cache
  • Loading branch information
JulianTrommer authored Oct 25, 2024
2 parents 4e5f863 + bcbb6e2 commit 384aa5e
Show file tree
Hide file tree
Showing 4 changed files with 40 additions and 9 deletions.
26 changes: 21 additions & 5 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,15 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create cache directory
run: |
mkdir -p ./.buildx-cache/cache
mkdir ./.buildx-cache/cache-new
mkdir ./.buildx-cache/cache/test
mkdir ./.buildx-cache/cache/latest
mkdir ./.buildx-cache/cache-new/test
mkdir ./.buildx-cache/cache-new/latest
- name: Test build
if: github.event_name == 'pull_request'
uses: docker/build-push-action@v3
Expand All @@ -50,8 +59,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,src=./.buildx-cache/cache/test/
cache-to: type=local,dest=./.buildx-cache/cache-new/test/,mode=max
build-args: |
USERNAME=paf
USER_UID=1000
Expand All @@ -67,8 +76,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,src=./.buildx-cache/cache/latest/
cache-to: type=local,dest=./.buildx-cache/cache-new/latest/,mode=max
build-args: |
USERNAME=paf
USER_UID=1000
Expand All @@ -85,4 +94,11 @@ jobs:
uses: actions/upload-artifact@v4
with:
name: pr_id
path: pr/
path: pr/
retention-days: 1

- name: Clean up cache
run: |
rm -rf ./.buildx-cache/cache/test
rm -rf ./.buildx-cache/cache/latest
mv ./.buildx-cache/cache-new ./.buildx-cache/cache
19 changes: 17 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,23 @@ 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
- name: Check PR ID
uses: actions/github-script@v6
with:
script: |
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 384aa5e

Please sign in to comment.