Install OneClickInstall DocSpace #322
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: Install OneClickInstall DocSpace | |
on: | |
# push: | |
# branches: | |
# - 'feature/oci-build' | |
# paths: | |
# - '.github/workflows/ci-oci-install.yml' | |
pull_request: | |
types: [opened, reopened, synchronize] | |
paths: | |
- '.github/workflows/ci-oci-install.yml' | |
- 'install/OneClickInstall/install-Debian/**' | |
- 'install/OneClickInstall/install-RedHat/**' | |
- 'install/OneClickInstall/install-Debian.sh' | |
- 'install/OneClickInstall/install-RedHat.sh' | |
# schedule: | |
# - cron: '00 20 * * 6' # At 23:00 on Saturday. | |
workflow_dispatch: | |
inputs: | |
deb_built: | |
type: boolean | |
description: "DEB packages were built" | |
default: false | |
rpm_built: | |
type: boolean | |
description: "RPM packages were built" | |
default: false | |
centos9s: | |
type: boolean | |
description: 'CentOS 9 Stream' | |
default: true | |
debian11: | |
type: boolean | |
description: 'Debian 11' | |
default: true | |
debian12: | |
type: boolean | |
description: 'Debian 12' | |
default: true | |
ubuntu2004: | |
type: boolean | |
description: 'Ubuntu 20.04' | |
default: true | |
ubuntu2204: | |
type: boolean | |
description: 'Ubuntu 22.04' | |
default: true | |
ubuntu2404: | |
type: boolean | |
description: 'Ubuntu 24.04' | |
default: true | |
fedora40: | |
type: boolean | |
description: 'Fedora 40' | |
default: true | |
fedora41: | |
type: boolean | |
description: 'Fedora 41' | |
default: true | |
jobs: | |
prepare: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- name: Checkout code | |
if: github.event_name == 'pull_request' | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Determine affected distributions | |
id: determine-distros | |
if: github.event_name == 'pull_request' | |
run: | | |
CHANGED_FILES=$(git diff --name-only ${{ github.event.pull_request.base.sha }} ${{ github.sha }}) | |
echo "debian_changed=$(echo "$CHANGED_FILES" | grep -q 'install-Debian' && echo true || echo false)" >> $GITHUB_ENV | |
echo "redhat_changed=$(echo "$CHANGED_FILES" | grep -q 'install-RedHat' && echo true || echo false)" >> $GITHUB_ENV | |
- name: Set matrix names | |
id: set-matrix | |
run: | | |
DEB_BUILT=true | |
RPM_BUILT=false | |
deb_machines=$(jq -n --argjson debian12 true \ | |
--argjson ubuntu2204 true \ | |
'{include: [ | |
{"name":"Debian12","os":"debian12","distr":"generic","execute":$debian12}, | |
{"name":"Ubuntu22.04","os":"ubuntu2204","distr":"generic","execute":$ubuntu2204} | |
]}') | |
rpm_machines=$(jq -n --argjson centos9s true \ | |
--argjson fedora40 true \ | |
'{include: [ | |
{"name":"CentOS9S","os":"centos9s","distr":"generic","execute":$centos9s}, | |
{"name":"Fedora40","os":"fedora-40","distr":"bento","execute":$fedora40} | |
]}') | |
if [ "$DEB_BUILT" = "true" ] && [ "$RPM_BUILT" = "true" ]; then | |
combined=$(jq -c -s '{"include": (.[0].include + .[1].include)}' <(echo "$deb_machines") <(echo "$rpm_machines")) | |
elif [ "$DEB_BUILT" = "true" ]; then | |
combined=$deb_machines | |
elif [ "$RPM_BUILT" = "true" ]; then | |
combined=$rpm_machines | |
else | |
combined='{"include":[]}' | |
fi | |
REDHAT_CHANGED=false | |
DEBIAN_CHANGED=false | |
if [ "$GITHUB_EVENT_NAME" = "pull_request" ]; then | |
combined=$(echo "$combined" | jq -c --arg REDHAT_CHANGED "$REDHAT_CHANGED" --arg DEBIAN_CHANGED "$DEBIAN_CHANGED" ' | |
{ include: [ .include[] | |
| select( | |
($REDHAT_CHANGED == $DEBIAN_CHANGED and .execute == true) | |
or ($REDHAT_CHANGED == "true" and (.name | test("CentOS|Fedora"))) | |
or ($DEBIAN_CHANGED == "true" and (.name | test("Debian|Ubuntu"))) | |
) | |
] }') | |
fi | |
echo "deb_machines=$deb_machines" | |
echo "rpm_machines=$rpm_machines" | |
echo "combined=$combined" | |
if ! echo "$combined" | jq . > /dev/null 2>&1; then | |
echo "Error: Generated JSON is invalid" | |
exit 1 | |
fi | |
echo "matrix=$(echo "$combined" | jq -c)" >> $GITHUB_OUTPUT | |
vagrant-up: | |
name: "Test DocSpace with ${{ matrix.name}}" | |
runs-on: ubuntu-24.04 | |
needs: prepare | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJSON(needs.prepare.outputs.matrix)}} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up Python 3. | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.x' | |
- name: Get update and install vagrant | |
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 [signed-by=/usr/share/keyrings/hashicorp-archive-keyring.gpg] https://apt.releases.hashicorp.com $(lsb_release -cs) main" | sudo tee /etc/apt/sources.list.d/hashicorp.list | |
sudo apt update -y | |
sudo apt install vagrant virtualbox -y | |
- name: Free Disk Space | |
run: | | |
sudo rm -rf /usr/local/lib/android /opt/ghc | |
sudo docker image prune --all --force | |
- name: "Test production scripts with ${{matrix.name}}" | |
if: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} | |
uses: nick-fields/retry@v3 | |
with: | |
max_attempts: 2 | |
timeout_minutes: 80 | |
retry_on: error | |
command: | | |
set -eux | |
cd tests/vagrant | |
TEST_CASE='--production-install' \ | |
DISTR='${{ matrix.distr }}' \ | |
OS='${{ matrix.os }}' \ | |
DOWNLOAD_SCRIPT='-ds true' \ | |
RAM='8192' \ | |
CPU='3' \ | |
ARGUMENTS="-arg '--skiphardwarecheck true' '-gb hotfix/v3.0.1'" \ | |
vagrant up | |
on_retry_command: | | |
echo "RUN CLEAN UP: Destroy vagrant and one more try" | |
cd tests/vagrant | |
sleep 10 | |
vagrant destroy --force | |
- name: "Test Local scripts with ${{matrix.name}}" | |
if: ${{ (github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch' || github.event_name == 'push') && (github.event.inputs.deb_built == true || github.event.inputs.rpm_built == true) }} | |
uses: nick-fields/retry@v3 | |
with: | |
max_attempts: 2 | |
timeout_minutes: 80 | |
retry_on: error | |
command: | | |
set -eux | |
cd tests/vagrant | |
TEST_CASE='--local-install' \ | |
DISTR='${{ matrix.distr }}' \ | |
OS='${{matrix.os}}' \ | |
RAM='8192' \ | |
CPU='3' \ | |
DOWNLOAD_SCRIPT='-ds false' \ | |
TEST_REPO='-tr true' \ | |
ARGUMENTS="-arg '--skiphardwarecheck true --localscripts true' '-gb hotfix/v3.0.1'" \ | |
vagrant up | |
on_retry_command: | | |
echo "RUN CLEAN UP: Destroy vagrant and one more try" | |
cd tests/vagrant | |
sleep 10 | |
vagrant destroy --force | |