From d181e80f43e5cbf93bb1be76b741747267679444 Mon Sep 17 00:00:00 2001 From: Vladimir Ischenko Date: Thu, 16 Jan 2025 12:37:22 +0300 Subject: [PATCH] Test linting OCI --- .github/workflows/ci-oci-install.yml | 163 +++++++++++++++------------ 1 file changed, 88 insertions(+), 75 deletions(-) diff --git a/.github/workflows/ci-oci-install.yml b/.github/workflows/ci-oci-install.yml index 3b8421c760..fe731999d7 100644 --- a/.github/workflows/ci-oci-install.yml +++ b/.github/workflows/ci-oci-install.yml @@ -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: @@ -59,6 +59,19 @@ jobs: 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" | 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 @@ -101,81 +114,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