Merge pull request #196 from moby/dependabot/go_modules/github.com/mo… #599
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: ci | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
on: | |
schedule: | |
- cron: '0 3 * * 0' # every Sunday at 3:00 UTC | |
workflow_dispatch: | |
push: | |
branches: | |
- 'master' | |
pull_request: | |
env: | |
GO_VERSION: 1.23 | |
SETUP_BUILDX_VERSION: latest | |
SETUP_BUILDKIT_IMAGE: moby/buildkit:latest | |
BUILDKIT_CACHE_REPO: moby/buildkit-bench-cache | |
## | |
BUILDKIT_REPO: moby/buildkit | |
BUILDKIT_CANDIDATES_KEY: buildkit-candidates | |
BUILDKIT_ARTIFACT_KEY: buildkit-binaries | |
BUILDKIT_CACHE_PREFIX: bkbins | |
BUILDKIT_CANDIDATES_REFS: master | |
BUILDKIT_CANDIDATES_LAST_DAYS: 15 | |
BUILDKIT_CANDIDATES_LAST_RELEASES: 8 | |
## | |
BUILDX_REPO: docker/buildx | |
BUILDX_CANDIDATES_KEY: buildx-candidates | |
BUILDX_ARTIFACT_KEY: buildx-binaries | |
BUILDX_CACHE_PREFIX: bxbins | |
BUILDX_CANDIDATES_REFS: master | |
BUILDX_CANDIDATES_LAST_DAYS: 15 | |
BUILDX_CANDIDATES_LAST_RELEASES: 8 | |
## | |
GEN_VALIDATION_MODE: strict | |
WEBSITE_PUBLIC_PATH: /buildkit-bench/ | |
jobs: | |
# limitation to using envs in a reusable workflow input | |
# https://github.com/actions/runner/issues/2372 | |
get-env: | |
runs-on: ubuntu-24.04 | |
outputs: | |
BUILDKIT_REPO: ${{ env.BUILDKIT_REPO }} | |
BUILDKIT_ARTIFACT_KEY: ${{ env.BUILDKIT_ARTIFACT_KEY }} | |
BUILDKIT_CACHE_PREFIX: ${{ env.BUILDKIT_CACHE_PREFIX }} | |
BUILDKIT_CANDIDATES_KEY: ${{ env.BUILDKIT_CANDIDATES_KEY }} | |
BUILDKIT_CANDIDATES_REFS: ${{ env.BUILDKIT_CANDIDATES_REFS }} | |
BUILDKIT_CANDIDATES_LAST_DAYS: ${{ env.BUILDKIT_CANDIDATES_LAST_DAYS }} | |
BUILDKIT_CANDIDATES_LAST_RELEASES: ${{ env.BUILDKIT_CANDIDATES_LAST_RELEASES }} | |
## | |
BUILDX_REPO: ${{ env.BUILDX_REPO }} | |
BUILDX_ARTIFACT_KEY: ${{ env.BUILDX_ARTIFACT_KEY }} | |
BUILDX_CACHE_PREFIX: ${{ env.BUILDX_CACHE_PREFIX }} | |
BUILDX_CANDIDATES_KEY: ${{ env.BUILDX_CANDIDATES_KEY }} | |
BUILDX_CANDIDATES_REFS: ${{ env.BUILDX_CANDIDATES_REFS }} | |
BUILDX_CANDIDATES_LAST_DAYS: ${{ env.BUILDX_CANDIDATES_LAST_DAYS }} | |
BUILDX_CANDIDATES_LAST_RELEASES: ${{ env.BUILDX_CANDIDATES_LAST_RELEASES }} | |
steps: | |
- run: "true" | |
prepare: | |
runs-on: ubuntu-24.04 | |
steps: | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: ${{ env.SETUP_BUILDX_VERSION }} | |
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} | |
buildkitd-flags: --debug | |
- | |
name: Login to Docker Hub | |
if: github.event_name != 'pull_request' | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ vars.DOCKERHUB_USER }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- | |
name: Build tests base | |
uses: docker/bake-action@v5 | |
with: | |
source: "{{defaultContext}}" | |
targets: tests-base | |
provenance: false | |
set: | | |
*.cache-from=type=registry,ref=${{ env.BUILDKIT_CACHE_REPO }}:tests-base | |
*.cache-to=type=registry,ignore-error=true,mode=max,ref=${{ env.BUILDKIT_CACHE_REPO }}:tests-base | |
buildkit-binaries: | |
uses: ./.github/workflows/.binaries.yml | |
needs: | |
- get-env | |
secrets: inherit | |
with: | |
target: buildkit | |
repo: ${{ needs.get-env.outputs.BUILDKIT_REPO }} | |
artifact_key: ${{ needs.get-env.outputs.BUILDKIT_ARTIFACT_KEY }} | |
cache_prefix: ${{ needs.get-env.outputs.BUILDKIT_CACHE_PREFIX }} | |
candidates_key: ${{ needs.get-env.outputs.BUILDKIT_CANDIDATES_KEY }} | |
refs: ${{ needs.get-env.outputs.BUILDKIT_CANDIDATES_REFS }} | |
last_days: ${{ needs.get-env.outputs.BUILDKIT_CANDIDATES_LAST_DAYS }} | |
last_releases: ${{ needs.get-env.outputs.BUILDKIT_CANDIDATES_LAST_RELEASES }} | |
buildx-binaries: | |
uses: ./.github/workflows/.binaries.yml | |
needs: | |
- get-env | |
secrets: inherit | |
with: | |
target: buildx | |
repo: ${{ needs.get-env.outputs.BUILDX_REPO }} | |
artifact_key: ${{ needs.get-env.outputs.BUILDX_ARTIFACT_KEY }} | |
cache_prefix: ${{ needs.get-env.outputs.BUILDX_CACHE_PREFIX }} | |
candidates_key: ${{ needs.get-env.outputs.BUILDX_CANDIDATES_KEY }} | |
refs: ${{ needs.get-env.outputs.BUILDX_CANDIDATES_REFS }} | |
last_days: ${{ needs.get-env.outputs.BUILDX_CANDIDATES_LAST_DAYS }} | |
last_releases: ${{ needs.get-env.outputs.BUILDX_CANDIDATES_LAST_RELEASES }} | |
test: | |
runs-on: ubuntu-24.04 | |
needs: | |
- prepare | |
- buildkit-binaries | |
env: | |
TEST_FLAGS: -v | |
TEST_IMAGE_BUILD: 0 | |
TEST_IMAGE_ID: buildkit-bench | |
TEST_RESULTS_DIR: bin/results | |
steps: | |
- | |
name: Download binaries | |
uses: actions/download-artifact@v4 | |
with: | |
path: /tmp/buildkit-binaries | |
pattern: ${{ env.BUILDKIT_ARTIFACT_KEY }}-* | |
merge-multiple: true | |
- | |
name: Extract binaries | |
run: | | |
mkdir -p ./bin/buildkit-binaries | |
for f in "/tmp/buildkit-binaries"/*.tar.gz; do | |
(set -x ; tar -xzvf "$f" -C ./bin/buildkit-binaries && rm "$f") | |
done | |
tree -nph ./bin/buildkit-binaries | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: ${{ env.SETUP_BUILDX_VERSION }} | |
driver: docker | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- | |
name: Build test image | |
uses: docker/bake-action@v5 | |
with: | |
source: "{{defaultContext}}" | |
targets: tests-buildkit | |
provenance: false | |
set: | | |
*.cache-from=type=registry,ref=${{ env.BUILDKIT_CACHE_REPO }}:tests-base | |
*.contexts.buildkit-binaries=cwd://bin/buildkit-binaries | |
*.output=type=docker,name=${{ env.TEST_IMAGE_ID }} | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Test | |
run: | | |
make test | |
env: | |
TEST_TYPES: test | |
- | |
name: Result | |
run: | | |
resultPath=./${{ env.TEST_RESULTS_DIR }}/gotestoutput-tests.json | |
mv ./${{ env.TEST_RESULTS_DIR }}/gotestoutput.json $resultPath | |
jq . $resultPath | |
- | |
name: Upload results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: tests-results | |
path: ${{ env.TEST_RESULTS_DIR }} | |
if-no-files-found: error | |
retention-days: 7 | |
benchmark-buildkit: | |
uses: ./.github/workflows/.benchmark.yml | |
needs: | |
- get-env | |
- prepare | |
- buildkit-binaries | |
secrets: inherit | |
with: | |
target: buildkit | |
artifact_key: ${{ needs.get-env.outputs.BUILDKIT_ARTIFACT_KEY }} | |
benchmark-buildx: | |
uses: ./.github/workflows/.benchmark.yml | |
needs: | |
- get-env | |
- prepare | |
- buildx-binaries | |
secrets: inherit | |
with: | |
target: buildx | |
artifact_key: ${{ needs.get-env.outputs.BUILDX_ARTIFACT_KEY }} | |
report: | |
runs-on: ubuntu-24.04 | |
needs: | |
- test | |
- benchmark-buildkit | |
- benchmark-buildx | |
steps: | |
- | |
name: Download results | |
uses: actions/download-artifact@v4 | |
with: | |
path: /tmp/bench-results | |
pattern: bench-results-* | |
merge-multiple: true | |
- | |
name: Download candidates | |
uses: actions/download-artifact@v4 | |
with: | |
path: /tmp/bench-results | |
pattern: "*-candidates" | |
merge-multiple: true | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
version: ${{ env.SETUP_BUILDX_VERSION }} | |
driver-opts: image=${{ env.SETUP_BUILDKIT_IMAGE }} | |
buildkitd-flags: --debug | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Create metadata files | |
run: | | |
cp ./testconfig.yml /tmp/bench-results/ | |
echo "$(date +'%Y%m%d-%H%M%S')" > /tmp/bench-results/name.txt | |
env|sort > /tmp/bench-results/env.txt | |
if [ -f "$GITHUB_EVENT_PATH" ]; then | |
cp $GITHUB_EVENT_PATH /tmp/bench-results/gha-event.json | |
fi | |
- | |
name: Generate HTML report | |
uses: docker/bake-action@v5 | |
with: | |
source: "{{defaultContext}}" | |
targets: tests-gen | |
provenance: false | |
set: | | |
*.cache-from=type=registry,ref=${{ env.BUILDKIT_CACHE_REPO }}:tests-base | |
*.contexts.tests-results=cwd:///tmp/bench-results | |
*.output=./bin/report | |
env: | |
BAKE_ALLOW_REMOTE_FS_ACCESS: 1 | |
- | |
name: Include results to report | |
run: | | |
cp -r /tmp/bench-results/* ./bin/report/ | |
- | |
name: Upload report | |
uses: actions/upload-artifact@v4 | |
with: | |
name: report | |
path: ./bin/report | |
if-no-files-found: error | |
publish: | |
runs-on: ubuntu-24.04 | |
needs: | |
- report | |
steps: | |
- | |
name: Free disk space | |
uses: jlumbroso/free-disk-space@54081f138730dfa15788a46383842cd2f914a1be # v1.3.1 | |
with: | |
android: true | |
dotnet: true | |
haskell: true | |
large-packages: true | |
swap-storage: true | |
- | |
name: Checkout | |
uses: actions/checkout@v4 | |
- | |
name: Checkout gh-pages | |
uses: actions/checkout@v4 | |
with: | |
ref: gh-pages | |
path: bin/gh-pages | |
- | |
name: Download report | |
uses: actions/download-artifact@v4 | |
with: | |
name: report | |
path: /tmp/bench-report | |
- | |
name: Move reports | |
run: | | |
reportDir=$(cat /tmp/bench-report/name.txt) | |
mkdir -p ./website/public/result/$reportDir | |
mv /tmp/bench-report/* ./website/public/result/$reportDir/ | |
if [ -d ./bin/gh-pages/result ]; then | |
mv ./bin/gh-pages/result/* ./website/public/result/ | |
fi | |
- | |
name: Build website | |
uses: docker/bake-action@v5 | |
with: | |
no-cache: true | |
targets: website | |
provenance: false | |
- | |
name: Publish | |
uses: crazy-max/ghaction-github-pages@v4 | |
with: | |
target_branch: gh-pages | |
build_dir: ./bin/website | |
jekyll: false | |
dry_run: ${{ github.event_name == 'pull_request' }} | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |