Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Support Installing Nightly Builds #8

Merged
merged 8 commits into from
Jul 28, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 6 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@ jobs:
fail-fast: false
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
webotsVersion: [ R2023b, R2024a ]
include:
- webotsVersion: R2024a
webotsTag: nightly_26_7_2024
runs-on: ${{ matrix.os }}

steps:
Expand All @@ -21,7 +25,8 @@ jobs:
id: setupWebots
uses: ./
with:
webotsVersion: R2023b
webotsVersion: ${{ matrix.webotsVersion }}
webotsTag: ${{ matrix.webotsTag || '' }}

- name: Run Webots
run: $RUN_WEBOTS --sysinfo
Expand Down
15 changes: 15 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,21 @@ This GitHub action can be used in a [GitHub workflow](https://docs.github.com/en
shell: bash
```

Alternatively, the `webotsTag` option can be used to install a specific tag from the Webots repository (such as a nightly build).

``` YAML
- name: Setup Webots
id: setupWebots
uses: DeepBlueRobotics/setup-webots@main
with:
webotsVersion: R2024a # Set this to your Webots version
webotsTag: nightly_26_7_2024

- name: Run Webots
run: $RUN_WEBOTS /path/to/worlds/MyWorld.wbt
shell: bash
```

In a step that uses the `bash` shell, `$RUN_WEBOTS` will expand to the start of a command line that will start Webots on any of the aforementioned runners with the `--no-rendering --stdout --stderr --minimize --batch` options. Those options allow Webots to run in a headless environment and redirect the controller's output/error to stdout/stderr.

Note:
Expand Down
18 changes: 16 additions & 2 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ inputs:
webotsVersion:
description: "Version of Webots to install."
required: true
webotsTag:
description: "Optionally specify a specific tag from the Webots repository to install. (Defaults to webotsVersion)"
required: false
default: ''

outputs:
bashCmd:
description: "Start of a command line in bash which will run webots on all runners with options suitable for headless execution. This is also put in the RUN_WEBOTS environment variable."
Expand All @@ -20,6 +25,9 @@ outputs:
bin:
description: "Full path to the Webots executable, suitable for running webots directly (albeit probably not succesfully, that's what bashCmd or $RUN_WEBOTS is for)"
value: ${{ steps.setup.outputs.bin }}
tag:
description: "The git tag of the Webots release being used"
value: ${{ steps.setup.outputs.bin }}

runs:
using: 'composite'
Expand All @@ -28,6 +36,11 @@ runs:
id: setup
run: |
webotsOptions="--no-rendering --stdout --stderr --minimize --batch"
if [ -n '${{ inputs.webotsTag }}' ]; then
webotsTag=${{ inputs.webotsTag }}
else
webotsTag=${{ inputs.webotsVersion }}
fi
if [ '${{ runner.os }}' = 'Linux' ]; then
webotsCachePath="$HOME/cache/webots"
webotsHome="$HOME/webots"
Expand Down Expand Up @@ -60,6 +73,7 @@ runs:
echo "binDir=${webotsBinDir}" >> $GITHUB_OUTPUT
echo "bin=${webotsBin}" >> $GITHUB_OUTPUT
echo "pkgName=$pkgName" >> $GITHUB_OUTPUT
echo "tag=$webotsTag" >> $GITHUB_OUTPUT
echo "RUN_WEBOTS=$webotsBashCmd" >> $GITHUB_ENV
echo "LIBGL_ALWAYS_SOFTWARE=true" >> $GITHUB_ENV
echo "WEBOTS_DISABLE_SAVE_SCREEN_PERSPECTIVE_ON_CLOSE=true" >> $GITHUB_ENV
Expand All @@ -69,12 +83,12 @@ runs:
id: cache
with:
path: ${{ steps.setup.outputs.cachePath }}
key: ${{ runner.os }}-webots-${{ inputs.webotsVersion }}
key: ${{ runner.os }}-webots-${{ steps.setup.outputs.tag }}
save-always: true
- name: 'Download Webots'
if: steps.cache.outputs.cache-hit != 'true'
run: |
curl -L -o "${{ steps.setup.outputs.cachePath }}/${{ steps.setup.outputs.pkgName }}" --create-dirs "https://github.com/cyberbotics/webots/releases/download/${{ inputs.webotsVersion }}/${{ steps.setup.outputs.pkgName }}"
curl -L -o "${{ steps.setup.outputs.cachePath }}/${{ steps.setup.outputs.pkgName }}" --create-dirs "https://github.com/cyberbotics/webots/releases/download/${{ steps.setup.outputs.tag }}/${{ steps.setup.outputs.pkgName }}"
if [ '${{ runner.os }}' = 'Windows' ]; then
curl -L -o "${{ steps.setup.outputs.cachePath }}/Mesa.7z" --create-dirs https://downloads.fdossena.com/geth.php?r=mesa64-latest
fi
Expand Down
Loading