diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ee57cd..8f056ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,9 +12,19 @@ jobs: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] webotsVersion: [ R2023b, R2024a ] - include: + webotsTag: [ nightly_26_7_2024, '' ] + webotsBaseUrl: [ 'https://github.com/DeepBlueRobotics/webots/releases/download/R2024a_DeepBlueSim_2024_07_28', '' ] + exclude: - webotsVersion: R2024a + webotsTag: '' + webotsBaseUrl: '' + - webotsVersion: R2024a + webotsTag: nightly_26_7_2024 + os: windows-latest + - webotsVersion: R2023b webotsTag: nightly_26_7_2024 + - webotsVersion: R2023b + webotsBaseUrl: 'https://github.com/DeepBlueRobotics/webots/releases/download/R2024a_DeepBlueSim_2024_07_28' runs-on: ${{ matrix.os }} steps: @@ -27,6 +37,7 @@ jobs: with: webotsVersion: ${{ matrix.webotsVersion }} webotsTag: ${{ matrix.webotsTag || '' }} + webotsBaseUrl: ${{ matrix.webotsBaseUrl || '' }} - name: Run Webots run: $RUN_WEBOTS --sysinfo diff --git a/README.md b/README.md index ec836b0..70af506 100644 --- a/README.md +++ b/README.md @@ -14,7 +14,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 Webots repository (such as a nightly build). +Alternatively, the `webotsTag` option can be used to install a specific tag from the official Webots repository (such as a nightly build). ``` YAML - name: Setup Webots @@ -29,6 +29,23 @@ 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. + +``` YAML + - name: Setup Webots + id: setupWebots + uses: DeepBlueRobotics/setup-webots@main + with: + webotsVersion: R2024a # Set this to your Webots version + webotsBaseUrl: https://github.com/DeepBlueRobotics/webots/releases/download/R2024a_DeepBlueSim_2024_07_28 + + - 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 d77c834..8c5356b 100644 --- a/action.yml +++ b/action.yml @@ -8,6 +8,10 @@ inputs: description: "Optionally specify a specific tag from the Webots repository to install. (Defaults to webotsVersion)" required: false default: '' + webotsBaseUrl: + description: "Optionally specify a base URL containing the distribution files (Defaults to https://github.com/cyberbotics/webots/releases/download/)" + required: false + default: '' outputs: bashCmd: @@ -25,9 +29,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 }} + baseUrl: + description: "The location of the Webots release being used" + value: ${{ steps.setup.outputs.baseUrl }} runs: using: 'composite' @@ -41,6 +45,14 @@ runs: else webotsTag=${{ inputs.webotsVersion }} fi + if [ -n '${{ inputs.webotsBaseUrl }}' ]; then + if [ -n '${{ inputs.webotsTag }}' ]; then + echo "WARNING: Ignoring webotsTag=${{ inputs.webotsTag }} because webotsBaseUrl was specified." + fi + webotsBaseUrl=${{ inputs.webotsBaseUrl }} + else + webotsBaseUrl="https://github.com/cyberbotics/webots/releases/download/$webotsTag" + fi if [ '${{ runner.os }}' = 'Linux' ]; then webotsCachePath="$HOME/cache/webots" webotsHome="$HOME/webots" @@ -73,7 +85,7 @@ runs: echo "binDir=${webotsBinDir}" >> $GITHUB_OUTPUT echo "bin=${webotsBin}" >> $GITHUB_OUTPUT echo "pkgName=$pkgName" >> $GITHUB_OUTPUT - echo "tag=$webotsTag" >> $GITHUB_OUTPUT + echo "baseUrl=$webotsBaseUrl" >> $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 @@ -83,12 +95,12 @@ runs: id: cache with: path: ${{ steps.setup.outputs.cachePath }} - key: ${{ runner.os }}-webots-${{ steps.setup.outputs.tag }} + key: ${{ runner.os }}-webots-${{ steps.setup.outputs.baseUrl }} 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/${{ steps.setup.outputs.tag }}/${{ steps.setup.outputs.pkgName }}" + curl -L -o "${{ steps.setup.outputs.cachePath }}/${{ steps.setup.outputs.pkgName }}" --create-dirs "${{ steps.setup.outputs.baseUrl }}/${{ 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