Skip to content

Commit

Permalink
Merge pull request #11 from DeepBlueRobotics/simplify-custom-reposito…
Browse files Browse the repository at this point in the history
…ry-usage

Simplify Workflow When Using a Custom GitHub Repository
  • Loading branch information
CoolSpy3 authored Jul 29, 2024
2 parents 17c9bee + 8b7b368 commit a58e264
Show file tree
Hide file tree
Showing 3 changed files with 51 additions and 21 deletions.
16 changes: 15 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,17 +12,30 @@ jobs:
matrix:
os: [ ubuntu-latest, macos-latest, windows-latest ]
webotsVersion: [ R2023b, R2024a ]
webotsTag: [ nightly_26_7_2024, '' ]
webotsTag: [ R2024a_DeepBlueSim_2024_07_28, nightly_26_7_2024, '' ]
webotsRepository: [ DeepBlueRobotics/webots, '' ]
webotsBaseUrl: [ 'https://github.com/DeepBlueRobotics/webots/releases/download/R2024a_DeepBlueSim_2024_07_28', '' ]
exclude:
# R2024a has not yet been released
- webotsVersion: R2024a
webotsTag: ''
webotsBaseUrl: ''
# cyberbots/webots#6586
- webotsVersion: R2024a
webotsTag: nightly_26_7_2024
os: windows-latest
# Only use tags on their corresponding repositories
- webotsTag: R2024a_DeepBlueSim_2024_07_28
webotsRepository: ''
- webotsTag: 'nightly_26_7_2024'
webotsRepository: DeepBlueRobotics/webots
- webotsTag: ''
webotsRepository: DeepBlueRobotics/webots
# R2023b Should only be run with default parameters
- webotsVersion: R2023b
webotsTag: nightly_26_7_2024
- webotsVersion: R2023b
webotsRepository: DeepBlueRobotics/webots
- webotsVersion: R2023b
webotsBaseUrl: 'https://github.com/DeepBlueRobotics/webots/releases/download/R2024a_DeepBlueSim_2024_07_28'
runs-on: ${{ matrix.os }}
Expand All @@ -37,6 +50,7 @@ jobs:
with:
webotsVersion: ${{ matrix.webotsVersion }}
webotsTag: ${{ matrix.webotsTag || '' }}
webotsRepository: ${{ matrix.webotsRepository || '' }}
webotsBaseUrl: ${{ matrix.webotsBaseUrl || '' }}

- name: Run Webots
Expand Down
33 changes: 21 additions & 12 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,36 +2,41 @@

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
uses: DeepBlueRobotics/setup-webots@main
with:
webotsVersion: R2023b # Set this to your Webots version

- name: Run Webots
run: $RUN_WEBOTS /path/to/worlds/MyWorld.wbt
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
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
### 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
```
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 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
Expand All @@ -40,7 +45,11 @@ option will be ignored, so the URL should contain any needed tag information.
with:
webotsVersion: R2024a # Set this to your Webots version
webotsBaseUrl: https://github.com/DeepBlueRobotics/webots/releases/download/R2024a_DeepBlueSim_2024_07_28
```

## Running Webots

``` YAML
- name: Run Webots
run: $RUN_WEBOTS /path/to/worlds/MyWorld.wbt
shell: bash
Expand Down
23 changes: 15 additions & 8 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 <webotsVersion>)"
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/<webotsTag>)"
description: "Optionally specify a base URL containing the distribution files (Defaults to https://github.com/<webotsRepository>/releases/download/<webotsTag>)"
required: false
default: ''

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down

0 comments on commit a58e264

Please sign in to comment.