Skip to content

GitHub CI

GitHub CI #22

Workflow file for this run

name: GitHub CI
on:
pull_request:
push:
workflow_dispatch:
schedule:
- cron: 0 0 * * 0
defaults:
run:
shell: 'bash -Eeuo pipefail -x {0}'
concurrency:
group: ${{ github.ref }}
cancel-in-progress: true
jobs:
generate-jobs:
name: Generate Jobs
runs-on: ubuntu-latest
environment: docker-hub
outputs:
strategy: ${{ steps.generate-jobs.outputs.strategy }}
steps:
- uses: actions/checkout@v3
- uses: docker-library/bashbrew@HEAD
- id: generate-jobs
name: Generate Jobs
run: |
strategy="$("$BASHBREW_SCRIPTS/github-actions/generate.sh")"
# https://github.com/docker-library/python/pull/706 (ensure we don't have any unexpected ".a" leftovers in "/usr/local")
strategy="$(jq <<<"$strategy" -c '
.matrix.include |= map(
if .os == "ubuntu-latest" then
.runs.test += "\n" + (
.meta.entries
| map(
.tags[0]
| "aFiles=\"$(docker run --rm \(. | @sh) find /usr/local -name \"*.a\" | tee /dev/stderr)\"; [ -z \"$aFiles\" ]"
)
| join("\n")
)
else . end
)
')"
base_tag="${{vars.REGISTRY_ADDRESS}}/${{vars.REGISTRY_USERNAME}}/${{vars.REGISTRY_REPOSITORY}}"
strategy="$(jq <<<"$strategy" --arg prefix "$base_tag" -c '
.matrix.include |= map(
.runs.push = (
.meta.entries
| map(
.tags
| map(
"\(. | gsub("^[^:]+"; $prefix) )" as $replaced |
"docker tag \(.) \($replaced)",
"docker push \($replaced)"
)[]
)
| join("\n")
)
)
')"
EOF="EOF-$RANDOM-$RANDOM-$RANDOM"
echo "strategy<<$EOF" >> "$GITHUB_OUTPUT"
jq <<<"$strategy" . | tee -a "$GITHUB_OUTPUT"
echo "$EOF" >> "$GITHUB_OUTPUT"
test:
needs: generate-jobs
strategy: ${{ fromJson(needs.generate-jobs.outputs.strategy) }}
name: ${{ matrix.name }}
runs-on: ${{ matrix.os }}
environment: docker-hub
steps:
- uses: actions/checkout@v3
- name: Login ${{ vars.REGISTRY_ADDRESS }}
uses: docker/login-action@28218f9b04b4f3f62068d7b6ce6ca5b26e35336c
with:
registry: ${{ vars.REGISTRY_ADDRESS }}
username: ${{ vars.REGISTRY_USERNAME }}
password: ${{ secrets.REGISTRY_TOKEN }}
- 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: Images ${{ matrix.name }}
run: ${{ matrix.runs.images }}
- name: Push ${{ matrix.name }}
run: ${{ matrix.runs.push }}