diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 63a1a26..3e2c9e1 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,8 +18,36 @@ env: EXECUTE_CMD: "$PODMAN_CMD exec -u $USER_NAME -i $CONTAINER_NAME" jobs: + prepare: + runs-on: ubuntu-latest + outputs: + sources: ${{ steps.list-sources.outputs.sources }} + steps: + - uses: actions/checkout@v2 + - name: Build CADR Running Environment Image + run: | + sudo apt-get update + sudo apt-get upgrade podman + $PODMAN_CMD build -t $IMAGE_NAME . + $PODMAN_CMD save $IMAGE_NAME > CADR_image.tar + - name: Upload the Running Environment Image to Artifact + uses: actions/upload-artifact@v2 + if: ${{ always() }} + with: + name: CADR_image + path: CADR_image.tar + - name: Install jq + run: sudo apt-get install -y jq + - name: List sources + id: list-sources + run: echo "::set-output name=sources::$(ls pkg_specs/*.sss | sed 's/\.sss$//' | jq -R -s -c 'split("\n")[:-1]')" build: + needs: prepare + if: ${{ success() }} runs-on: ubuntu-latest + strategy: + matrix: + source: ${{ fromJson(needs.prepare.outputs.sources) }} steps: - uses: actions/checkout@v2 - name: Setup CI Build Script @@ -35,29 +63,17 @@ jobs: \$MKCMD all EOF chmod +x $CI_SCRIPT - - name: Build CADR Running Environment Image - run: | - sudo apt-get update - sudo apt-get upgrade podman - $PODMAN_CMD build -t $IMAGE_NAME . - $PODMAN_CMD save $IMAGE_NAME > CADR_image.tar - - name: Upload the Running Environment Image to Artifact - uses: actions/upload-artifact@v2 - if: ${{ always() }} - with: - name: CADR_image - path: CADR_image.tar - name: Spawn Podman Container to Prepare Running Environment run: | eval $SPAWN_CONTAINER - name: Build CADR run: | - eval $EXECUTE_CMD ${BUILD_DIR}/$CI_SCRIPT + eval SOURCES=${{ matrix.source }} $EXECUTE_CMD ${BUILD_DIR}/$CI_SCRIPT - name: Upload Debian Packages Just Built to Artifact uses: actions/upload-artifact@v2 if: ${{ always() }} with: - name: CADR_debs + name: ${{ matrix.source }} path: build/*.deb - name: Check SHA256 if: ${{ always() }} @@ -81,7 +97,7 @@ jobs: sudo chown -R $USER $PWD test: - needs: build + needs: [build, prepare] if: ${{ success() }} runs-on: ubuntu-latest strategy: @@ -120,10 +136,10 @@ jobs: $PODMAN_CMD load < CADR_image.tar mkdir build - name: Download Pre-built Debian Packages - uses: actions/download-artifact@v3 + uses: thecodenebula/download-artifact@e9e49e9bbce8ff2b901957ee034714cab099644a with: - name: CADR_debs - path: build + names: ${{ fromJson(needs.prepare.outputs.sources) }} + paths: [build] - name: Test CADR Basic run: | eval $SPAWN_CONTAINER