Webots Snap Package Creation #1515
Workflow file for this run
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: Webots Snap Package Creation | |
on: | |
workflow_dispatch: | |
inputs: | |
debug_enabled: | |
type: boolean | |
description: 'Run the build with tmate debugging enabled (https://github.com/marketplace/actions/debugging-with-tmate)' | |
required: false | |
default: false | |
branch: | |
description: "Branch to build" | |
required: false | |
default: "master" | |
pull_request: | |
types: [opened, synchronize, reopened, labeled, unlabeled] | |
schedule: | |
- cron: "0 23 * * *" | |
push: | |
tags: | |
- '*' | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
defaults: | |
run: | |
shell: bash | |
jobs: | |
build: | |
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' || contains(github.event.pull_request.labels.*.name, 'test creation') }} | |
strategy: | |
matrix: | |
branch: [develop] | |
# it should target a branch that this lines are added to qt_linux_installer.sh | |
# pip install --no-input aqtinstall | |
# export PATH="$PATH:$HOME/.local/bin" | |
# sudo apt update | |
# sudo apt install -y lsb-release python3-distro | |
# sudo apt install python3-distro | |
# pip3 install distro | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Snapcraft | |
uses: samuelmeuli/action-snapcraft@v1 | |
- name: Clone Webots Repository (build) | |
run: | | |
sudo apt install --yes git | |
sudo snap install snapcraft --classic | |
git clone --recurse-submodules --depth 3 --single-branch --branch ${{ matrix.branch }} https://github.com/cyberbotics/webots.git | |
export WEBOTS_VERSION=$(cat webots/scripts/packaging/webots_version.txt | sed 's/ revision /-rev/g') | |
sed -i "s/version:\s*'R[0-9]\{4\}[a-z].*'/version: '$WEBOTS_VERSION'/g" snapcraft.yaml | |
sed -i "s/set-version\s*R[0-9]\{4\}[a-z].*/set-version $WEBOTS_VERSION/g" snapcraft.yaml | |
- name: Set Commit SHA in Version | |
if: ${{ github.event_name == 'schedule' }} | |
run: python webots/scripts/packaging/set_commit_and_date_in_version.py ${{ github.sha }} | |
- name: Setup Xvfb | |
run: | | |
sudo apt install xvfb | |
export DISPLAY=:99 | |
Xvfb :99 -screen 0 1024x768x16 & | |
- name: Create Snap Package | |
run: | | |
sudo lsb_release -a | |
sudo snapcraft --destructive-mode | |
cp *.snap webots/distribution | |
- name: Start tmate session (Debugging) | |
if: ${{ github.event_name == 'workflow_dispatch' && inputs.debug_enabled }} | |
uses: mxschmitt/action-tmate@v3 | |
- uses: actions/upload-artifact@v4 | |
if: ${{ contains(github.event.pull_request.labels.*.name, 'test creation') || github.event_name == 'workflow_dispatch'}} | |
with: | |
name: build-${{ matrix.branch }} | |
path: | | |
webots/distribution/*.snap | |
- name: Create/Update `webots` GitHub Release | |
if: ${{ github.event_name == 'schedule' }} | |
run: | | |
export COMMIT_ID=$(cd webots; git rev-parse HEAD) | |
sudo python -m pip install pip --upgrade | |
sudo python -m pip install requests PyGithub | |
sudo python -m pip install pyopenssl --upgrade | |
webots/scripts/packaging/publish_release.py --key=${{ secrets.BOT_ACTION_KEY }} --repo=cyberbotics/webots --commit=$COMMIT_ID | |
release-tag: | |
if: ${{ github.event_name == 'push' }} | |
runs-on: ubuntu-22.04 | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Snapcraft | |
uses: samuelmeuli/action-snapcraft@v1 | |
- name: Clone Webots Repository (release-tag) | |
run: | | |
sudo apt install --yes git | |
sudo snap install snapcraft --classic | |
git clone --recurse-submodules --depth 3 --single-branch --branch ${GITHUB_REF#refs/tags/} https://github.com/cyberbotics/webots.git | |
export WEBOTS_VERSION=$(cat webots/scripts/packaging/webots_version.txt | sed 's/ revision /-rev/g') | |
sed -i "s/version:\s*'R[0-9]\{4\}[a-z].*'/version: '$WEBOTS_VERSION'/g" snapcraft.yaml | |
- name: Setup Xvfb | |
run: | | |
sudo apt install xvfb | |
export DISPLAY=:99 | |
Xvfb :99 -screen 0 1024x768x16 & | |
- name: Create Snap Package | |
run: | | |
sudo snapcraft --destructive-mode | |
cp *.snap webots/distribution | |
- name: Create/Update `webots` GitHub Release | |
run: | | |
export COMMIT_ID=$(cd webots; git rev-parse HEAD) | |
sudo python -m pip install pip --upgrade | |
sudo python -m pip install requests PyGithub | |
sudo python -m pip install pyopenssl --upgrade | |
webots/scripts/packaging/publish_release.py --key=${{ secrets.BOT_ACTION_KEY }} --repo=cyberbotics/webots --branch=${{ github.ref }} --commit=$COMMIT_ID --tag=${{ github.ref }} |