From 93c516b34deb98f94fad0c22b5aa36a5dc460de0 Mon Sep 17 00:00:00 2001 From: Dean Brettle Date: Sun, 28 Jul 2024 16:32:50 -0700 Subject: [PATCH 1/8] Add support for arbitrary base URL to fix #9. --- .github/workflows/ci.yml | 2 ++ README.md | 19 ++++++++++++++++++- action.yml | 18 +++++++++++++++--- 3 files changed, 35 insertions(+), 4 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0ee57cd..cdee4aa 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,8 @@ jobs: include: - webotsVersion: R2024a webotsTag: nightly_26_7_2024 + - webotsVersion: R2024a + webotsBaseUrl: https://github.com/DeepBlueRobotics/webots/releases/download/R2024a_DeepBlueSim_2024_07_28 runs-on: ${{ matrix.os }} steps: 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..87ed7cf 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: @@ -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/${{ inputs.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 From c37286eee2c384c39c421967e5df8f753ae5a836 Mon Sep 17 00:00:00 2001 From: Dean Brettle Date: Sun, 28 Jul 2024 17:45:59 -0700 Subject: [PATCH 2/8] (MINOR) Address PR comments. --- action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 87ed7cf..2ecec4f 100644 --- a/action.yml +++ b/action.yml @@ -29,8 +29,8 @@ 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" + baseUrl: + description: "The location of the Webots release being used" value: ${{ steps.setup.outputs.bin }} runs: @@ -51,7 +51,7 @@ runs: fi webotsBaseUrl=${{ inputs.webotsBaseUrl }} else - webotsBaseUrl='https://github.com/cyberbotics/webots/releases/download/${{ inputs.webotsTag }}' + webotsBaseUrl="https://github.com/cyberbotics/webots/releases/download/$webotsTag" fi if [ '${{ runner.os }}' = 'Linux' ]; then webotsCachePath="$HOME/cache/webots" From d0035bd95c759ad8c0cf5cff08ae2d854b655abf Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 28 Jul 2024 17:49:46 -0700 Subject: [PATCH 3/8] fix task output --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index 2ecec4f..8c5356b 100644 --- a/action.yml +++ b/action.yml @@ -31,7 +31,7 @@ outputs: value: ${{ steps.setup.outputs.bin }} baseUrl: description: "The location of the Webots release being used" - value: ${{ steps.setup.outputs.bin }} + value: ${{ steps.setup.outputs.baseUrl }} runs: using: 'composite' From fffa2b0a7794bedcd0a6e5aa4b040a3dad82add2 Mon Sep 17 00:00:00 2001 From: Dean Brettle Date: Sun, 28 Jul 2024 17:57:31 -0700 Subject: [PATCH 4/8] Cover all the test combinations that actually exist. --- .github/workflows/ci.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdee4aa..6c7aeff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,10 +12,15 @@ 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: nightly_26_7_2024 - - webotsVersion: R2024a + 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 }} From ab7d82a4caff1f805ed9968aaf9e66f5b95114f9 Mon Sep 17 00:00:00 2001 From: Dean Brettle Date: Sun, 28 Jul 2024 18:02:08 -0700 Subject: [PATCH 5/8] Quote baseUrl used for testing. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 6c7aeff..b781209 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -12,8 +12,8 @@ jobs: matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] webotsVersion: [ R2023b, R2024a ] - webotsTag: [nightly_26_7_2024, ''] - webotsBaseUrl: [https://github.com/DeepBlueRobotics/webots/releases/download/R2024a_DeepBlueSim_2024_07_28, ''] + webotsTag: [ nightly_26_7_2024, '' ] + webotsBaseUrl: [ 'https://github.com/DeepBlueRobotics/webots/releases/download/R2024a_DeepBlueSim_2024_07_28', '' ] exclude: - webotsVersion: R2024a webotsTag: nightly_26_7_2024 From 3893e109e8e31de6e25ee3f76975db7ec7627c58 Mon Sep 17 00:00:00 2001 From: Dean Brettle Date: Sun, 28 Jul 2024 18:06:56 -0700 Subject: [PATCH 6/8] Exclude plain R2024a because it hasn't been released yet. --- .github/workflows/ci.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b781209..9f3cec3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -15,6 +15,9 @@ jobs: 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 From c3b6960e0273abe3ab59b70fda0888e475c15da6 Mon Sep 17 00:00:00 2001 From: Dean Brettle Date: Sun, 28 Jul 2024 18:22:12 -0700 Subject: [PATCH 7/8] Actually *use* the webotsUrl when running the tests! --- .github/workflows/ci.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9f3cec3..228d5e0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -24,7 +24,7 @@ jobs: - webotsVersion: R2023b webotsTag: nightly_26_7_2024 - webotsVersion: R2023b - webotsBaseUrl: https://github.com/DeepBlueRobotics/webots/releases/download/R2024a_DeepBlueSim_2024_07_28 + webotsBaseUrl: 'https://github.com/DeepBlueRobotics/webots/releases/download/R2024a_DeepBlueSim_2024_07_28' runs-on: ${{ matrix.os }} steps: @@ -37,6 +37,7 @@ jobs: with: webotsVersion: ${{ matrix.webotsVersion }} webotsTag: ${{ matrix.webotsTag || '' }} + webotsUrl: ${{ matrix.webotsUrl || '' }} - name: Run Webots run: $RUN_WEBOTS --sysinfo From 8c2eec3f4d8290e7a87d66ddb77e756ddd45d321 Mon Sep 17 00:00:00 2001 From: Dean Brettle Date: Sun, 28 Jul 2024 18:34:56 -0700 Subject: [PATCH 8/8] Update .github/workflows/ci.yml Co-authored-by: CoolSpy3 <55305038+CoolSpy3@users.noreply.github.com> --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 228d5e0..8f056ff 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -37,7 +37,7 @@ jobs: with: webotsVersion: ${{ matrix.webotsVersion }} webotsTag: ${{ matrix.webotsTag || '' }} - webotsUrl: ${{ matrix.webotsUrl || '' }} + webotsBaseUrl: ${{ matrix.webotsBaseUrl || '' }} - name: Run Webots run: $RUN_WEBOTS --sysinfo