From d294bdcce03ad2e9ce31f803463d0623c2f6f07e Mon Sep 17 00:00:00 2001 From: Iain Samuel McLean Elder Date: Mon, 1 Jul 2024 04:26:51 +0200 Subject: [PATCH] Refactor workflow for all installers --- .github/workflows/test_all.yml | 33 +++++++++++++++++ .github/workflows/test_installer.yml | 54 ---------------------------- 2 files changed, 33 insertions(+), 54 deletions(-) create mode 100644 .github/workflows/test_all.yml delete mode 100644 .github/workflows/test_installer.yml diff --git a/.github/workflows/test_all.yml b/.github/workflows/test_all.yml new file mode 100644 index 0000000..4c56f15 --- /dev/null +++ b/.github/workflows/test_all.yml @@ -0,0 +1,33 @@ +name: Test all installers +on: + schedule: + # To decrease the chance of delay, avoid the start of the hour. + # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule + - cron: "17 5 * * *" + workflow_dispatch: + +jobs: + list_installers: + name: List installers + runs-on: ubuntu-latest + outputs: + installers: ${{steps.list_step.outputs.installers}} + steps: + - name: Check out code + uses: actions/checkout@v4 + + - name: List installers + id: list_step + run: | + { + printf "installers=" + find programs -mindepth 1 -maxdepth 1 -printf "%P\n" \ + | sort | jq -R | jq -s -c -M + } >> "$GITHUB_OUTPUT" + + test_installers: + name: Test installers + needs: list_installers + uses: ./.github/workflows/test_installers.yml + with: + installers: ${{needs.list_installers.outputs.installers}} diff --git a/.github/workflows/test_installer.yml b/.github/workflows/test_installer.yml deleted file mode 100644 index dd72dde..0000000 --- a/.github/workflows/test_installer.yml +++ /dev/null @@ -1,54 +0,0 @@ -name: Test Installer -on: - schedule: - # To decrease the chance of delay, avoid the start of the hour. - # https://docs.github.com/en/actions/using-workflows/events-that-trigger-workflows#schedule - - cron: "17 5 * * *" - workflow_dispatch: - -jobs: - list_installers: - name: List installers - runs-on: ubuntu-latest - outputs: - installers: ${{ steps.list_step.outputs.installers}} - steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: List installers - id: list_step - run: | - { - printf "installers=" - find programs -mindepth 1 -maxdepth 1 -printf "%P\n" \ - | sort | jq -R | jq -s -c -M - } >> "$GITHUB_OUTPUT" - - test_installers: - name: Test installers - needs: list_installers - runs-on: ubuntu-latest - container: - image: ${{matrix.os}} - strategy: - fail-fast: false - matrix: - installer: ${{ fromJson(needs.list_installers.outputs.installers) }} - os: ["ubuntu:20.04", "ubuntu:22.04"] - steps: - - name: Check out code - uses: actions/checkout@v4 - - - name: Prepare Docker - run: ./scripts/prepare_docker.bash - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Install ${{matrix.installer}} - shell: su norm --command "bash --login {0}" - run: programs/${{matrix.installer}}/install.bash - - - name: Install ${{matrix.installer}} again (test idempotency) - shell: su norm --command "bash --login {0}" - run: programs/${{matrix.installer}}/install.bash