ej52 / proxmox-scripts

MIT License
567 stars 303 forks source link

Use of Github Actions to Test Matrix Builds #169

Open tecio-first opened 6 months ago

tecio-first commented 6 months ago

Is your feature request related to a problem? Please describe.

165 has shown that sometimes a OS Version is not working

Describe the solution you'd like Something i have developed for you ;-) ---> Matrix Build for Alpine with Github Actions You don`t waste time on your side to check against each Version localy

What it does:

  1. Installation Testing for Version 3.17/18/19 (example)
  2. Verbose Loging
  3. some adaption to run NginxProxyManager directly in Github Actions

Action View:

image

Matrix View:

image

Result View:

image image

Additional context You can find this here: https://github.com/tecio-first/proxmox-scripts/tree/main/.github/workflows

name: Nginx Proxy Manager
run-name: Alpine Linux Matrix Build 🚀
on:
  workflow_dispatch:
  push:
    branches: [ '*' ]
    tags-ignore: [ '*' ]
jobs:
  ProxyManagerOnAlpine:
    runs-on: ubuntu-latest
    continue-on-error: true
    strategy:
      matrix:
        alpine: [v3.17, v3.18, v3.19]
    steps:
      - name: Check out repository code
        uses: actions/checkout@v4
        with:
          path: main

      - name: Setup Alpine Linux
        uses: jirutka/setup-alpine@v1
        with:
          mirror-url: http://dl-cdn.alpinelinux.org/alpine
          branch: ${{ matrix.alpine }}
          packages: bash openrc

      - name: Run script inside Alpine chroot as root
        run: |

          # Service related stuff for openrc
          mkdir -p /run/openrc/exclusive
          touch /run/openrc/softlevel
          echo 'rc_provide="dev net"' >> /etc/rc.conf
          # Set Variables
          export EPS_BASE_URL=$GITHUB_WORKSPACE/main
          export EPS_CT_INSTALL=false
          export EPS_CLEANUP=${EPS_CLEANUP:-false}
          EPS_APP_NAME=${EPS_APP_NAME:-nginx-proxy-manager}
          export EPS_APP_CONFIG=${EPS_APP_CONFIG:-$(cat $EPS_BASE_URL/apps/$EPS_APP_NAME/config.sh)}
          export EPS_OS_NAME=$(uname)
          export EPS_OS_DISTRO=$(awk -F'=' '/^ID=/{ print $NF }' /etc/os-release)
          # Maniuplate the common.sh file for stty/pushd/disown/popd command 
          # and activvate verbose mode and deactivate spinner
          sed -i 's/__OUTPUT=\/dev\/null/__OUTPUT=\/dev\/stdout/' $EPS_BASE_URL/utils/common.sh
          sed -i 's/__start_spinner &/#__start_spinner &/' $EPS_BASE_URL/utils/common.sh
          sed -i 's/__SPIN_PID=$!/#__SPIN_PID=$!/' $EPS_BASE_URL/utils/common.sh
          sed -i 's/stty/#stty/' $EPS_BASE_URL/utils/common.sh
          sed -i 's/pushd/cd/' $EPS_BASE_URL/utils/common.sh
          sed -i 's/disown/#disown/' $EPS_BASE_URL/utils/common.sh
          sed -i 's/popd/#popd/' $EPS_BASE_URL/utils/common.sh
          # export and execute the common.sh and alpine.sh and APP install.sh files
          export EPS_UTILS_COMMON=${EPS_UTILS_COMMON:-$(cat $EPS_BASE_URL/utils/common.sh)}
          export EPS_UTILS_DISTRO=${EPS_UTILS_DISTRO:-$(cat $EPS_BASE_URL/utils/alpine.sh)}
          source <(echo -n "$EPS_UTILS_COMMON")
          source <(echo -n "$EPS_UTILS_DISTRO")
          source <(echo -n "$EPS_APP_CONFIG")
          export EPS_APP_INSTALL=${EPS_APP_INSTALL:-$(cat $EPS_BASE_URL/apps/$EPS_APP_NAME/install.sh)}
          source <(echo -n "$EPS_APP_INSTALL")
        shell: alpine.sh --root {0}

I can also create Actions for other Distros if you like ;-) Happy Action to you !