diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdee4aa..ff1e3bd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,9 @@ jobs: include: - webotsVersion: R2024a webotsTag: nightly_26_7_2024 + - webotsVersion: R2024a + webotsTag: R2024a_DeepBlueSim_2024_07_28 + webotsRepository: DeepBlueRobotics/webots - webotsVersion: R2024a webotsBaseUrl: https://github.com/DeepBlueRobotics/webots/releases/download/R2024a_DeepBlueSim_2024_07_28 runs-on: ${{ matrix.os }} diff --git a/README.md b/README.md index 70af506..20f4c78 100644 --- a/README.md +++ b/README.md @@ -2,6 +2,9 @@ This GitHub action can be used in a [GitHub workflow](https://docs.github.com/en/free-pro-team@latest/actions) to setup a version of [Webots](https://cyberbotics.com/) on ubuntu-latest, windows-latest, or macos-latest GitHub-hosted runner. Usage: +## Installing Webots + +### Install a Stable Webots Release ``` YAML - name: Setup Webots id: setupWebots @@ -14,8 +17,7 @@ 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 official Webots repository (such as a nightly build). - +### Install a Nightly Prerelease from the Official Webots Repository ``` YAML - name: Setup Webots id: setupWebots @@ -29,9 +31,24 @@ Alternatively, the `webotsTag` option can be used to install a specific tag from shell: bash ``` -Alternatively, the `webotsBaseUrl` option can be used to install from an arbitrary location (such as -a fork of the official repo). Note that if you use the `webotsBaseUrl` option, the `webotsTag` -option will be ignored, so the URL should contain any needed tag information. +### Install a Custom Release from a Webots Fork +``` YAML + - name: Setup Webots + id: setupWebots + uses: DeepBlueRobotics/setup-webots@main + with: + webotsVersion: R2024a # Set this to your Webots version + webotsTag: R2024a_DeepBlueSim_2024_07_28 + webotsRepository: DeepBlueRobotics/webots + + - name: Run Webots + run: $RUN_WEBOTS /path/to/worlds/MyWorld.wbt + shell: bash +``` + +### Install a Custom Release from an Arbitrary URL +Note that if you use the `webotsBaseUrl` option, the `webotsTag` and `webotsRepository` options +will be ignored, so the URL should contain any needed tag information. ``` YAML - name: Setup Webots @@ -46,6 +63,7 @@ option will be ignored, so the URL should contain any needed tag information. shell: bash ``` +## Running Webots 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: diff --git a/action.yml b/action.yml index 8c5356b..8b56f17 100644 --- a/action.yml +++ b/action.yml @@ -5,11 +5,15 @@ inputs: description: "Version of Webots to install." required: true webotsTag: - description: "Optionally specify a specific tag from the Webots repository to install. (Defaults to webotsVersion)" + description: "Optionally specify a specific tag from the Webots repository to install. (Defaults to )" + required: false + default: '' + webotsRepository: + description: "Optionally specify a specific repository to download Webots from (Defaults to cyberbotics/webots)" required: false default: '' webotsBaseUrl: - description: "Optionally specify a base URL containing the distribution files (Defaults to https://github.com/cyberbotics/webots/releases/download/)" + description: "Optionally specify a base URL containing the distribution files (Defaults to https://github.com//releases/download/)" required: false default: '' @@ -40,19 +44,21 @@ runs: id: setup run: | webotsOptions="--no-rendering --stdout --stderr --minimize --batch" - if [ -n '${{ inputs.webotsTag }}' ]; then - webotsTag=${{ inputs.webotsTag }} - else - webotsTag=${{ inputs.webotsVersion }} - fi + webotsTag=${{ inputs.webotsTag || inputs.webotsVersion }} + webotsRepository=${{ inputs.webotsRepository || 'cyberbotics/webots' }} + if [ -n '${{ inputs.webotsBaseUrl }}' ]; then if [ -n '${{ inputs.webotsTag }}' ]; then echo "WARNING: Ignoring webotsTag=${{ inputs.webotsTag }} because webotsBaseUrl was specified." fi + if [ -n '${{ inputs.webotsRepository }}' ]; then + echo "WARNING: Ignoring webotsRepository=${{ inputs.webotsRepository }} because webotsBaseUrl was specified." + fi webotsBaseUrl=${{ inputs.webotsBaseUrl }} else - webotsBaseUrl="https://github.com/cyberbotics/webots/releases/download/$webotsTag" + webotsBaseUrl="https://github.com/$webotsRepository/releases/download/$webotsTag" fi + if [ '${{ runner.os }}' = 'Linux' ]; then webotsCachePath="$HOME/cache/webots" webotsHome="$HOME/webots" @@ -85,6 +91,7 @@ runs: echo "binDir=${webotsBinDir}" >> $GITHUB_OUTPUT echo "bin=${webotsBin}" >> $GITHUB_OUTPUT echo "pkgName=$pkgName" >> $GITHUB_OUTPUT + echo "cacheKey=$cacheKey" >> $GITHUB_OUTPUT echo "baseUrl=$webotsBaseUrl" >> $GITHUB_OUTPUT echo "RUN_WEBOTS=$webotsBashCmd" >> $GITHUB_ENV echo "LIBGL_ALWAYS_SOFTWARE=true" >> $GITHUB_ENV