diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54809ab..0ee57cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: @@ -21,7 +25,8 @@ jobs: id: setupWebots uses: ./ with: - webotsVersion: R2023b + webotsVersion: ${{ matrix.webotsVersion }} + webotsTag: ${{ matrix.webotsTag || '' }} - name: Run Webots run: $RUN_WEBOTS --sysinfo diff --git a/README.md b/README.md index 2198214..ec836b0 100644 --- a/README.md +++ b/README.md @@ -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: diff --git a/action.yml b/action.yml index 4bb0960..d77c834 100644 --- a/action.yml +++ b/action.yml @@ -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." @@ -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' @@ -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" @@ -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 @@ -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