From 8bc58352624b43803e9810a1b1852eff46e5b501 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 28 Jul 2024 02:58:00 -0700 Subject: [PATCH 1/8] (MINOR) support installing nightly builds --- .github/workflows/ci.yml | 34 +++++++++++++++++++++++++++++++++- action.yml | 9 +++++++-- 2 files changed, 40 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54809ab..a83851f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,7 +6,7 @@ on: branches: [ main ] jobs: - test: + testStableWebots: strategy: fail-fast: false matrix: @@ -37,6 +37,38 @@ jobs: echo "steps.setupWebots.outputs.cachePath: ${{ steps.setupWebots.outputs.cachePath }}" shell: bash + testNightlyWebots: + strategy: + fail-fast: false + matrix: + os: [ ubuntu-latest, macos-latest, windows-latest ] + runs-on: ${{ matrix.os }} + + steps: + - name: Checkout source + uses: actions/checkout@v3 + + - name: Setup Webots + id: setupWebots + uses: ./ + with: + webotsVersion: R2024a + webotsTag: nightly_26_7_2024 + + - name: Run Webots + run: $RUN_WEBOTS --sysinfo + shell: bash + + - name: Display outputs + run: | + echo "RUN_WEBOTS: $RUN_WEBOTS" + echo "steps.setupWebots.outputs.bashCmd: ${{ steps.setupWebots.outputs.bashCmd }}" + echo "steps.setupWebots.outputs.home: ${{ steps.setupWebots.outputs.home }}" + echo "steps.setupWebots.outputs.binDir: ${{ steps.setupWebots.outputs.binDir }}" + echo "steps.setupWebots.outputs.bin: ${{ steps.setupWebots.outputs.bin }}" + echo "steps.setupWebots.outputs.cachePath: ${{ steps.setupWebots.outputs.cachePath }}" + shell: bash + release: # Only release from the main branch if: github.ref == 'refs/heads/main' diff --git a/action.yml b/action.yml index 4bb0960..2adf6a6 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: ${{ inputs.webotsVersion }} + 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." @@ -69,12 +74,12 @@ runs: id: cache with: path: ${{ steps.setup.outputs.cachePath }} - key: ${{ runner.os }}-webots-${{ inputs.webotsVersion }} + key: ${{ runner.os }}-webots-${{ inputs.webotsTag }} 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/${{ inputs.webotsTag }}/${{ 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 9de9997244e19bd3ed49a9312eb1aa90be2d71dd Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 28 Jul 2024 03:00:08 -0700 Subject: [PATCH 2/8] update README --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) 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: From 3360cdc0a56f78a717a7a3f78c74a4dda6c278a2 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 28 Jul 2024 03:02:45 -0700 Subject: [PATCH 3/8] fix ci dependencies --- .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 a83851f..40cee71 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -72,7 +72,7 @@ jobs: release: # Only release from the main branch if: github.ref == 'refs/heads/main' - needs: test + needs: [testStableWebots, testNightlyWebots] runs-on: ubuntu-latest steps: From 3f5beb748614a04c398c92931009d009b05bc962 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 28 Jul 2024 03:09:05 -0700 Subject: [PATCH 4/8] fix default tag resolution --- action.yml | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/action.yml b/action.yml index 2adf6a6..fb2e1ea 100644 --- a/action.yml +++ b/action.yml @@ -7,7 +7,7 @@ inputs: webotsTag: description: "Optionally specify a specific tag from the Webots repository to install. (Defaults to webotsVersion)" required: false - default: ${{ inputs.webotsVersion }} + default: '' outputs: bashCmd: @@ -25,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' @@ -33,6 +36,11 @@ runs: id: setup run: | webotsOptions="--no-rendering --stdout --stderr --minimize --batch" + if [ -n '${{ inputs.webotsTag }}' ] + webotsTag=${{ inputs.webotsTag }} + else + webotsTag=${{ inputs.webotsVersion }} + fi if [ '${{ runner.os }}' = 'Linux' ]; then webotsCachePath="$HOME/cache/webots" webotsHome="$HOME/webots" @@ -65,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 @@ -74,12 +83,12 @@ runs: id: cache with: path: ${{ steps.setup.outputs.cachePath }} - key: ${{ runner.os }}-webots-${{ inputs.webotsTag }} + 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.webotsTag }}/${{ 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 From a3c48180dbb2e6234d189abd2819c5cedce355c5 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 28 Jul 2024 03:10:34 -0700 Subject: [PATCH 5/8] add missing then statement --- action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/action.yml b/action.yml index fb2e1ea..d77c834 100644 --- a/action.yml +++ b/action.yml @@ -36,7 +36,7 @@ runs: id: setup run: | webotsOptions="--no-rendering --stdout --stderr --minimize --batch" - if [ -n '${{ inputs.webotsTag }}' ] + if [ -n '${{ inputs.webotsTag }}' ]; then webotsTag=${{ inputs.webotsTag }} else webotsTag=${{ inputs.webotsVersion }} From 417b31ab4e0508798c7803f86804fbaef2a08566 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 28 Jul 2024 03:24:35 -0700 Subject: [PATCH 6/8] unify ci tests --- .github/workflows/ci.yml | 43 ++++++++-------------------------------- 1 file changed, 8 insertions(+), 35 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 40cee71..54e6fa5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,11 +6,15 @@ on: branches: [ main ] jobs: - testStableWebots: + test: strategy: fail-fast: false matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] + include: + - webotsVersion: R2023b + - webotsVersion: R2024a + webotsTag: nightly_26_7_2024 runs-on: ${{ matrix.os }} steps: @@ -21,39 +25,8 @@ jobs: id: setupWebots uses: ./ with: - webotsVersion: R2023b - - - name: Run Webots - run: $RUN_WEBOTS --sysinfo - shell: bash - - - name: Display outputs - run: | - echo "RUN_WEBOTS: $RUN_WEBOTS" - echo "steps.setupWebots.outputs.bashCmd: ${{ steps.setupWebots.outputs.bashCmd }}" - echo "steps.setupWebots.outputs.home: ${{ steps.setupWebots.outputs.home }}" - echo "steps.setupWebots.outputs.binDir: ${{ steps.setupWebots.outputs.binDir }}" - echo "steps.setupWebots.outputs.bin: ${{ steps.setupWebots.outputs.bin }}" - echo "steps.setupWebots.outputs.cachePath: ${{ steps.setupWebots.outputs.cachePath }}" - shell: bash - - testNightlyWebots: - strategy: - fail-fast: false - matrix: - os: [ ubuntu-latest, macos-latest, windows-latest ] - runs-on: ${{ matrix.os }} - - steps: - - name: Checkout source - uses: actions/checkout@v3 - - - name: Setup Webots - id: setupWebots - uses: ./ - with: - webotsVersion: R2024a - webotsTag: nightly_26_7_2024 + webotsVersion: ${{ matrix.webotsVersion }} + webotsTag: ${{ contains(matrix, 'webotsTag') && matrix.webotsTag || '' }} - name: Run Webots run: $RUN_WEBOTS --sysinfo @@ -72,7 +45,7 @@ jobs: release: # Only release from the main branch if: github.ref == 'refs/heads/main' - needs: [testStableWebots, testNightlyWebots] + needs: test runs-on: ubuntu-latest steps: From bf4bcc74d2814be2c0c2f4b863a2bbd6cc986719 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 28 Jul 2024 03:29:34 -0700 Subject: [PATCH 7/8] remove ternary operator --- .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 54e6fa5..0e5b625 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -26,7 +26,7 @@ jobs: uses: ./ with: webotsVersion: ${{ matrix.webotsVersion }} - webotsTag: ${{ contains(matrix, 'webotsTag') && matrix.webotsTag || '' }} + webotsTag: ${{ matrix.webotsTag || '' }} - name: Run Webots run: $RUN_WEBOTS --sysinfo From 171d7df73d727bcfc98b858eef532c26963a6ed4 Mon Sep 17 00:00:00 2001 From: CoolSpy3 Date: Sun, 28 Jul 2024 03:36:40 -0700 Subject: [PATCH 8/8] fix matrix --- .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 0e5b625..0ee57cd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,8 +11,8 @@ jobs: fail-fast: false matrix: os: [ ubuntu-latest, macos-latest, windows-latest ] + webotsVersion: [ R2023b, R2024a ] include: - - webotsVersion: R2023b - webotsVersion: R2024a webotsTag: nightly_26_7_2024 runs-on: ${{ matrix.os }}