-
Notifications
You must be signed in to change notification settings - Fork 1
115 lines (112 loc) · 4.61 KB
/
snap-creation.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
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 }}