diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e5ef30b4..6cf5e93e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,50 +1,51 @@ name: GitHub CI on: - pull_request: - push: branches: - master - schedule: - cron: 0 0 * * 0 -jobs: - - build-test: +defaults: + run: + shell: 'bash -Eeuo pipefail -x {0}' - strategy: - matrix: - libc: - - glibc - - musl - - uclibc +jobs: + generate-jobs: + name: Generate Jobs runs-on: ubuntu-latest - + outputs: + strategy: ${{ steps.generate-jobs.outputs.strategy }} steps: - - uses: actions/checkout@v1 - with: - fetch-depth: 1 - - - name: Prepare Environment - run: docker system prune --all --force --volumes - - name: Happy Eyeballs - run: wget -qO- 'https://github.com/tianon/pgp-happy-eyeballs/raw/master/hack-my-builds.sh' | bash - - - name: Build Tarball - run: ./build.sh ${{ matrix.libc }} - - - name: Build Image - run: docker build -t busybox:${{ matrix.libc }} ${{ matrix.libc }} - - - name: Run Tests + - id: generate-jobs + name: Generate Jobs run: | - git clone --depth 1 https://github.com/docker-library/official-images.git ~/oi - ~/oi/test/run.sh busybox:${{ matrix.libc }} - + git clone --depth 1 https://github.com/docker-library/bashbrew.git -b master ~/bashbrew + strategy="$(GENERATE_STACKBREW_LIBRARY='.github/workflows/fake-gsl.sh' ~/bashbrew/scripts/github-actions/generate.sh)" + strategy="$(jq -c '.matrix.include = [ .matrix.include[] | .runs.build = "./build.sh " + (.meta.entries[].directory | @sh) + "\n" + .runs.build ]' <<<"$strategy")" + jq . <<<"$strategy" # sanity check / debugging aid + echo "::set-output name=strategy::$strategy" + + test: + needs: generate-jobs + strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }} + name: ${{ matrix.name }} + runs-on: ${{ matrix.os }} + steps: + - uses: actions/checkout@v1 + - name: Prepare Environment + run: ${{ matrix.runs.prepare }} + - name: Pull Dependencies + run: ${{ matrix.runs.pull }} + - name: Build ${{ matrix.name }} + run: ${{ matrix.runs.build }} + - name: History ${{ matrix.name }} + run: ${{ matrix.runs.history }} + - name: Test ${{ matrix.name }} + run: ${{ matrix.runs.test }} - name: '"docker images"' - run: docker images + run: ${{ matrix.runs.images }} diff --git a/.github/workflows/fake-gsl.sh b/.github/workflows/fake-gsl.sh new file mode 100755 index 00000000..20f1b8a3 --- /dev/null +++ b/.github/workflows/fake-gsl.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -Eeuo pipefail + +# this is a fake version of "generate-stackbrew-library.sh" just so https://github.com/docker-library/bashbrew/blob/c74be66ae6a019e0baee601287187dc6df29b384/scripts/github-actions/generate.sh can generate us a sane starter matrix + +echo 'Maintainers: foo (@bar)' +echo 'GitRepo: https://github.com/docker-library/busybox.git' +for f in */Dockerfile.builder; do + d="$(dirname "$f")" + commit="$(git log -1 --format='format:%H' "$d/Dockerfile")" + echo + echo "Tags: $d" + echo "Directory: $d" + echo "GitCommit: $commit" +done