-
Notifications
You must be signed in to change notification settings - Fork 6
168 lines (149 loc) · 6.65 KB
/
Copy pathci-update.yml
File metadata and controls
168 lines (149 loc) · 6.65 KB
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
name: Update OCI Docs
on:
workflow_dispatch:
inputs:
distros:
type: string
description: Select distros (comma-separated)
default: |
centos8s,
centos9s,
centos10,
debian10,
debian11,
debian12,
debian13,
ubuntu2004,
ubuntu2204,
ubuntu2404
deb_build:
type: boolean
description: "Override: All DEB-based distros"
default: false
rpm_build:
type: boolean
description: "Override: All RPM-based distros"
default: false
schedule:
- cron: '0 21 * * 0'
concurrency:
group: ${{ github.workflow }}-${{ github.ref_name }}
cancel-in-progress: true
jobs:
prepare:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
version: ${{ steps.get-version.outputs.version }}
steps:
- name: Set matrix names
id: set-matrix
env:
OS_ORDER: centos8s centos9s centos10 debian10 debian11 debian12 debian13 ubuntu2004 ubuntu2204 ubuntu2404
OS_MAP: |
{
"centos8s": ["CentOS 8 Stream", "onlyoffice", "docs-centos8s"],
"centos9s": ["CentOS 9 Stream", "onlyoffice", "docs-centos9s"],
"centos10": ["CentOS 10 Stream","onlyoffice", "docs-centos10"],
"debian10": ["Debian 10", "onlyoffice", "docs-debian10"],
"debian11": ["Debian 11", "onlyoffice", "docs-debian11"],
"debian12": ["Debian 12", "onlyoffice", "docs-debian12"],
"debian13": ["Debian 13", "onlyoffice", "docs-debian13"],
"ubuntu2004": ["Ubuntu 20.04", "onlyoffice", "docs-ubuntu2004"],
"ubuntu2204": ["Ubuntu 22.04", "onlyoffice", "docs-ubuntu2204"],
"ubuntu2404": ["Ubuntu 24.04", "onlyoffice", "docs-ubuntu2404"]
}
run: |
declare -A os_set
# Handle individual distro selection (only when no override flags set)
if [[ "${{ github.event.inputs.deb_build }}" != "true" && "${{ github.event.inputs.rpm_build }}" != "true" ]]; then
DISTROS_INPUT="${{ github.event.inputs.distros }}"
for os in ${DISTROS_INPUT//,/ }; do
os_trimmed="$(echo "$os" | xargs)"
[[ -n "$os_trimmed" ]] && os_set["$os_trimmed"]=1
done
fi
# Override: All DEB-based distros (Debian/Ubuntu)
[[ "${{ github.event.inputs.deb_build }}" == "true" ]] && \
for os in $(jq -r 'to_entries[] | select(.value[0] | test("Debian|Ubuntu")) | .key' <<< "$OS_MAP"); do os_set["$os"]=1; done
# Override: All RPM-based distros (CentOS)
[[ "${{ github.event.inputs.rpm_build }}" == "true" ]] && \
for os in $(jq -r 'to_entries[] | select(.value[0] | test("CentOS")) | .key' <<< "$OS_MAP"); do os_set["$os"]=1; done
# Build matrix in defined order
matrix=$(jq -c -n --argjson map "$OS_MAP" --arg order "$OS_ORDER" \
--argjson list "$(printf '%s\n' "${!os_set[@]}" | jq -R . | jq -s .)" \
'{include: [($order | split(" "))[] | select(. as $k | $list[] == $k) | {name: $map[.][0], os: ($map[.][2] // .), distr: $map[.][1]}]}')
echo "matrix=$matrix" >> $GITHUB_OUTPUT
- id: get-version
run: |
VERSION=$(curl -sL --max-time 10 -H "Accept: application/vnd.github+json" -H "Authorization: Bearer ${{ github.token }}" https://api.github.com/repos/ONLYOFFICE/document-server-package/branches?per_page=100 \
| jq -r '.[] | select(.name|test("^(release|hotfix)/")) | .name' | sort -Vr | head -n1 | sed 's#.*/v##') || echo "99.99.99"
echo "version=$VERSION" >> "$GITHUB_OUTPUT"
update-test:
name: "Update (${{ matrix.name }})"
runs-on: ubuntu-22.04
needs: [prepare]
defaults:
run:
working-directory: tests/vagrant
env:
VER: ${{ needs.prepare.outputs.version }}
strategy:
fail-fast: false
matrix: ${{fromJSON(needs.prepare.outputs.matrix)}}
steps:
- name: Free Disk Space
working-directory: ${{ github.workspace }}
run: |
sudo docker image prune --all --force
sudo rm -rf /usr/local/lib/android || true
- name: Checkout code
uses: actions/checkout@v6
- name: Get update and install vagrant
working-directory: ${{ github.workspace }}
run: |
set -eux
sudo wget -O- https://apt.releases.hashicorp.com/gpg | sudo gpg --dearmor -o /usr/share/keyrings/hashicorp-archive-keyring.gpg
sudo echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(grep -oP '(?<=UBUNTU_CODENAME=).*' /etc/os-release || lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list
sudo apt update -y
sudo apt-get install -y vagrant
# Temporary install VBox 7.1.12 via curl (.deb) to avoid SSH/NAT issues in 7.1.14
VBOX_DEB=$(curl -fsSL https://download.virtualbox.org/virtualbox/7.1.12/MD5SUMS | grep -oE 'virtualbox-7\.1_7\.1\.12-[0-9]+~Ubuntu~jammy_amd64\.deb' | head -n1)
[ -n "$VBOX_DEB" ] || { echo "ERROR: could not detect VBox .deb filename"; exit 1; }
curl -fsSL "https://download.virtualbox.org/virtualbox/7.1.12/${VBOX_DEB}" -o /tmp/vbox.deb
sudo apt-get install -y /tmp/vbox.deb
- name: Update
timeout-minutes: 90
env:
DISTR: ${{ matrix.distr }}
RAM: '4096'
CPU: '2'
OS: ${{ matrix.os }}
IT: '-it enterprise'
run: |
set -eux
export DOWNLOAD_SCRIPT='-ds false'
export TEST_REPO='-tr true'
export VER="-v ${VER}"
export ARGUMENTS="-arg '--skiphardwarecheck true --makeswap false --localscripts true --update true'"
vagrant up --provider=virtualbox
- name: Health check
run: |
if vagrant status | grep -q "running"; then
vagrant ssh -c "sudo bash /home/vagrant/tests/vagrant/post-install.sh healthcheck" || true
else
echo "VM is not running, skipping health check"
fi
- name: Collect logs
if: always()
run: |
if vagrant status | grep -q "running"; then
vagrant ssh -c "sudo bash /home/vagrant/tests/vagrant/post-install.sh logs" || true
else
echo "VM is not running, skipping log collection"
fi
- name: Cleanup
if: always()
run: |
vagrant destroy --force || true
vagrant global-status --prune || true