Linux build (develop) #1490
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Linux build (develop) | |
on: | |
schedule: | |
- cron: '0 23 * * *' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
webots-build: | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'test webots build') }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, ubuntu-22.04] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
fetch-depth: 15 | |
ref: develop | |
- name: Install Webots Compilation Dependencies | |
run: | | |
sudo scripts/install/linux_compilation_dependencies.sh | |
- name: Build Webots | |
run: | | |
export LIBGL_ALWAYS_SOFTWARE=true | |
xvfb-run --auto-servernum make webots_target -j4 | |
build: | |
if: ${{ github.event_name == 'push' || github.event_name == 'schedule' || contains(github.event.pull_request.labels.*.name, 'test distribution') || contains(github.event.pull_request.labels.*.name, 'test suite') || contains(github.event.pull_request.labels.*.name, 'test ros') || contains(github.event.pull_request.labels.*.name, 'test worlds') }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, ubuntu-22.04] | |
include: | |
- os: ubuntu-20.04 | |
JAVA_VERSION: "16" | |
ROS_DISTRO: "noetic" | |
- os: ubuntu-22.04 | |
JAVA_VERSION: "18" | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
fetch-depth: 15 | |
ref: develop | |
- name: Install Webots Compilation Dependencies | |
run: | | |
sudo scripts/install/linux_optional_compilation_dependencies.sh | |
- name: Set Commit SHA in Version | |
if: ${{ github.event_name == 'schedule' }} | |
run: python scripts/packaging/set_commit_and_date_in_version.py $(git log -1 --format='%H') | |
- name: Webots Package Creation | |
run: | | |
export JAVA_HOME=/usr/lib/jvm/java-${{ matrix.JAVA_VERSION }}-openjdk-amd64 | |
export PATH=$JAVA_HOME/bin:$PATH | |
export LIBGL_ALWAYS_SOFTWARE=true | |
export ROS_DISTRO=${{ matrix.ROS_DISTRO }} | |
xvfb-run --auto-servernum make distrib -j4 | |
- name: Create/Update GitHub release | |
if: ${{ matrix.os == 'ubuntu-20.04' && (github.event_name == 'push' || github.event_name == 'schedule') }} | |
run: | | |
sudo python -m pip install requests PyGithub | |
pip install pyopenssl --upgrade | |
scripts/packaging/publish_release.py --key=${{ secrets.GITHUB_TOKEN }} --repo=${{ github.repository }} --branch=${{ github.ref }} --commit=$(git log -1 --format='%H') --tag=${{ github.ref }} | |
- uses: actions/upload-artifact@v4 | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'test suite') || contains(github.event.pull_request.labels.*.name, 'test ros') || contains(github.event.pull_request.labels.*.name, 'test worlds') }} | |
with: | |
name: build-${{ matrix.os }} | |
path: | | |
distribution/*.tar.bz2 | |
distribution/*.zip | |
- uses: actions/upload-artifact@v4 | |
if: ${{ !contains(github.event.pull_request.labels.*.name, 'test suite') && !contains(github.event.pull_request.labels.*.name, 'test ros') && !contains(github.event.pull_request.labels.*.name, 'test worlds') }} | |
with: | |
name: build-${{ matrix.os }} | |
path: | | |
distribution/*.tar.bz2 | |
distribution/*.deb | |
distribution/*.zip | |
test-suite: | |
needs: build | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'test suite') || github.event_name == 'schedule' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04, ubuntu-22.04] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: develop | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: build-ubuntu-20.04 | |
path: artifact | |
- name: Extract Webots | |
run: tar xjf artifact/webots-*-x86-64*.tar.bz2 -C artifact | |
- name: Install Webots Dependencies | |
run: sudo scripts/install/linux_test_dependencies.sh --exclude-ros | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Test Suite | |
run: | | |
export LIBGL_ALWAYS_SOFTWARE=true | |
export WEBOTS_DISABLE_SAVE_SCREEN_PERSPECTIVE_ON_CLOSE=true | |
xvfb-run --auto-servernum python scripts/packaging/update_urls.py $(git log -1 --format='%H') | |
export WEBOTS_HOME=$PWD/artifact/webots | |
export TESTS_HOME=$PWD # required by cache group in the test suite | |
export BRANCH_HASH=$(git log -1 --format='%H') | |
xvfb-run --auto-servernum python tests/test_suite.py | |
test-ros: | |
needs: build | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'test ros') || github.event_name == 'schedule' }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [ubuntu-20.04] | |
include: | |
- os: ubuntu-20.04 | |
ROS_DISTRO: noetic | |
python: 3.8 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true | |
ref: develop | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: build-${{ matrix.os }} | |
path: artifact | |
- name: Extract Webots | |
run: tar xjf artifact/webots-*-x86-64*.tar.bz2 -C artifact | |
- name: Install Webots Dependencies | |
run: sudo scripts/install/linux_test_dependencies.sh | |
- name: Set up Python ${{ matrix.python }} | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python }} | |
- name: Run Test | |
run: | | |
export WEBOTS_HOME=$PWD/artifact/webots | |
export ROS_DISTRO=${{ matrix.ROS_DISTRO }} | |
python -m pip install rospkg catkin_pkg empy defusedxml netifaces | |
Xvfb :99 & | |
export DISPLAY=:99 | |
./tests/ros.sh | |
timeout-minutes: 15 | |
test-worlds: | |
needs: build | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'test worlds') || github.event_name == 'schedule' }} | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4.1.7 | |
with: | |
name: build-ubuntu-20.04 | |
path: artifact | |
- name: Get branch name | |
id: branch-name | |
uses: tj-actions/branch-names@v7.0.7 | |
- name: Extract Webots and Cache | |
run: | | |
tar xjf artifact/webots-*-x86-64*.tar.bz2 -C artifact | |
cp -R artifact/ untouched-artifact/ | |
mkdir -p ~/.cache/Cyberbotics/Webots/ | |
unzip -q artifact/assets-*.zip -d ~/.cache/Cyberbotics/Webots/assets | |
- name: Set up Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Update World, Check Warnings and Validate Cache | |
run: | | |
wget https://raw.githubusercontent.com/cyberbotics/webots/${{ steps.branch-name.outputs.current_branch }}/scripts/install/linux_runtime_dependencies.sh && sudo bash linux_runtime_dependencies.sh | |
export LIBGL_ALWAYS_SOFTWARE=true | |
export WEBOTS_DISABLE_SAVE_SCREEN_PERSPECTIVE_ON_CLOSE=true | |
export WEBOTS_HOME=$PWD/artifact/webots | |
sudo apt install -y wget && wget https://raw.githubusercontent.com/cyberbotics/webots/${{ steps.branch-name.outputs.current_branch }}/tests/test_worlds.py | |
xvfb-run --auto-servernum python3 test_worlds.py | |
if [[ "$(diff -qr artifact/ untouched-artifact/ | wc -l)" -ne "0" ]]; then echo Some world and/or wbproj files are not up to date: "$(diff -qr artifact/ untouched-artifact/)"; exit 1; fi | |
delete-artifacts: | |
needs: [build, test-suite, test-ros, test-worlds] | |
if: ${{ always() && !contains(github.event.pull_request.labels.*.name, 'test distribution') && !contains(github.event.pull_request.labels.*.name, 'test webots build') }} | |
strategy: | |
matrix: | |
os: [ubuntu-20.04, ubuntu-22.04] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Delete artifacts | |
uses: geekyeggo/delete-artifact@v1 | |
with: | |
name: build-${{ matrix.os }} |