Skip to content

Commit

Permalink
Test linting OCI
Browse files Browse the repository at this point in the history
  • Loading branch information
isboston committed Jan 16, 2025
1 parent e4d938c commit 934f79b
Showing 1 changed file with 90 additions and 76 deletions.
166 changes: 90 additions & 76 deletions .github/workflows/ci-oci-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ on:
- 'install/OneClickInstall/install-RedHat/**'
- 'install/OneClickInstall/install-Debian.sh'
- 'install/OneClickInstall/install-RedHat.sh'

schedule:
- cron: '00 20 * * 6' # At 23:00 on Saturday.
push:
branches:
- 'feature/lint-check'

workflow_dispatch:
inputs:
Expand Down Expand Up @@ -55,10 +55,24 @@ jobs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- name: Checkout code
if: github.event_name == 'pull_request'
#if: github.event_name == 'pull_request'
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: "Lint scripts with ShellCheck"
run: |
set -eux
sudo apt-get install -y shellcheck
find install/OneClickInstall tests -type f -name "*.sh" ! -path "install/OneClickInstall/install-Docker.sh" \
| xargs shellcheck --exclude=SC2034 | tee shellcheck_output
awk '
/\(warning\):/ { warnings++ }
/\(error\):/ { errors++ }
END {
warnings += 0; errors += 0;
printf "::warning ::ShellCheck detected %d warnings and %d errors\n", warnings, errors
}' shellcheck_output
- name: Determine affected distributions
id: determine-distros
Expand Down Expand Up @@ -101,81 +115,81 @@ jobs:
echo "matrix=$matrix" >> $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)}}
# 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
# steps:
# - name: Checkout code
# uses: actions/checkout@v4

- name: Set up Python 3.
uses: actions/setup-python@v5
with:
python-version: '3.x'
# - 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: 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: 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' }}
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'" \
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 production scripts with ${{matrix.name}}"
# if: ${{ github.event_name == 'schedule' }}
# 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'" \
# 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' }}
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'" \
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' }}
# 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'" \
# vagrant up
# on_retry_command: |
# echo "RUN CLEAN UP: Destroy vagrant and one more try"
# cd tests/vagrant
# sleep 10
# vagrant destroy --force

0 comments on commit 934f79b

Please sign in to comment.