-
Notifications
You must be signed in to change notification settings - Fork 1.2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ci: move frontend integration tests and build to a dedicated workflow
Signed-off-by: CrazyMax <[email protected]>
- Loading branch information
Showing
2 changed files
with
219 additions
and
88 deletions.
There are no files selected for viewing
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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,203 @@ | ||
name: frontend | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- 'master' | ||
tags: | ||
- 'dockerfile/*' | ||
pull_request: | ||
paths-ignore: | ||
- 'README.md' | ||
- 'docs/**' | ||
- 'frontend/dockerfile/docs/**' | ||
|
||
env: | ||
REPO_SLUG_ORIGIN: "moby/buildkit:latest" | ||
REPO_SLUG_TARGET: "docker/dockerfile-upstream" | ||
PLATFORMS: "linux/amd64,linux/arm/v7,linux/arm64,linux/mips,linux/mipsle,linux/mips64,linux/mips64le,linux/s390x,linux/ppc64le,linux/riscv64" | ||
CACHE_GHA_SCOPE_IT: "frontend-integration-tests" | ||
TESTFLAGS: "-v --parallel=6 --timeout=30m" | ||
BUILDX_VERSION: "v0.9.1" # leave empty to use the one available on GitHub virtual environment | ||
|
||
jobs: | ||
base: | ||
runs-on: ubuntu-20.04 | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Expose GitHub Runtime | ||
uses: crazy-max/ghaction-github-runtime@v2 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
version: ${{ env.BUILDX_VERSION }} | ||
driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} | ||
buildkitd-flags: --debug | ||
- | ||
name: Build ${{ env.CACHE_GHA_SCOPE_IT }} | ||
run: | | ||
./hack/build_ci_first_pass integration-tests | ||
env: | ||
CACHE_FROM: type=gha,scope=${{ env.CACHE_GHA_SCOPE_IT }} | ||
CACHE_TO: type=gha,scope=${{ env.CACHE_GHA_SCOPE_IT }} | ||
|
||
test: | ||
runs-on: ubuntu-20.04 | ||
needs: | ||
- base | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
pkg: | ||
- ./frontend/dockerfile | ||
worker: | ||
- containerd | ||
- containerd-rootless | ||
- containerd-1.5 | ||
- containerd-1.4 | ||
- containerd-snapshotter-stargz | ||
- oci | ||
- oci-rootless | ||
- oci-snapshotter-stargz | ||
typ: | ||
- integration | ||
- dockerfile | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Expose GitHub Runtime | ||
uses: crazy-max/ghaction-github-runtime@v2 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
version: ${{ env.BUILDX_VERSION }} | ||
driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} | ||
buildkitd-flags: --debug | ||
- | ||
name: Test pkg=${{ matrix.pkg }} ; typ=${{ matrix.typ }} ; worker=${{ matrix.worker }} | ||
run: | | ||
if [ -n "${{ matrix.worker }}" ]; then | ||
export TESTFLAGS="${TESTFLAGS} --run=//worker=${{ matrix.worker }}$" | ||
fi | ||
./hack/test ${{ matrix.typ }} | ||
mv ./coverage/coverage.txt ./coverage/coverage-${{ github.job }}-$(echo "${{ matrix.pkg }}-${{ matrix.typ }}-${{ matrix.worker }}" | tr -dc '[:alnum:]-\n\r' | tr '[:upper:]' '[:lower:]').txt | ||
env: | ||
TEST_COVERAGE: 1 | ||
TESTPKGS: ${{ matrix.pkg }} | ||
CACHE_FROM: type=gha,scope=${{ env.CACHE_GHA_SCOPE_IT }} | ||
- | ||
name: Upload coverage file | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: coverage | ||
path: ./coverage | ||
|
||
upload-coverage: | ||
runs-on: ubuntu-20.04 | ||
needs: | ||
- test | ||
steps: | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
- | ||
name: Download coverage files | ||
uses: actions/download-artifact@v3 | ||
with: | ||
name: coverage | ||
path: ./coverage | ||
- | ||
name: List coverage files | ||
uses: actions/github-script@v6 | ||
id: files | ||
with: | ||
result-encoding: string | ||
script: | | ||
return require('fs').readdirSync('./coverage', {withFileTypes: true}) | ||
.filter(item => !item.isDirectory()) | ||
.map(item => `./coverage/${item.name}`) | ||
.join(','); | ||
- | ||
name: Send to Codecov | ||
uses: codecov/codecov-action@v2 | ||
with: | ||
files: ${{ steps.files.outputs.result }} | ||
|
||
image: | ||
runs-on: ubuntu-20.04 | ||
needs: | ||
- test | ||
steps: | ||
- | ||
name: Prepare | ||
run: | | ||
TYP=master | ||
TAG=mainline | ||
PUSH=false | ||
if [[ $GITHUB_REF == refs/tags/dockerfile/* ]]; then | ||
TYP=tag | ||
TAG=${GITHUB_REF#refs/tags/} | ||
PUSH=push | ||
elif [[ $GITHUB_REF == refs/heads/* ]]; then | ||
PUSH=push | ||
fi | ||
echo "TYP=${TYP}" >> $GITHUB_ENV | ||
echo "TAG=${TAG}" >> $GITHUB_ENV | ||
echo "PUSH=${PUSH}" >> $GITHUB_ENV | ||
- | ||
name: Checkout | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- | ||
name: Expose GitHub Runtime | ||
uses: crazy-max/ghaction-github-runtime@v2 | ||
- | ||
name: Set up QEMU | ||
uses: docker/setup-qemu-action@v2 | ||
- | ||
name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v2 | ||
with: | ||
version: ${{ env.BUILDX_VERSION }} | ||
driver-opts: image=${{ env.REPO_SLUG_ORIGIN }} | ||
buildkitd-flags: --debug | ||
- | ||
name: Login to DockerHub | ||
uses: docker/login-action@v2 | ||
if: env.PUSH == 'push' | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
- | ||
name: Build ${{ env.TYP }}/${{ env.TAG }} | ||
run: | | ||
./frontend/dockerfile/cmd/dockerfile-frontend/hack/release "${{ env.TYP }}" "${{ env.TAG }}" "$REPO_SLUG_TARGET" "${{ env.PUSH }}" | ||
env: | ||
CACHE_FROM: type=gha,scope=frontend-${{ env.TYP }} | ||
CACHE_TO: type=gha,scope=frontend-${{ env.TYP }} | ||
- | ||
name: Build ${{ env.TYP }}/labs | ||
if: env.TYP == 'master' | ||
run: | | ||
./frontend/dockerfile/cmd/dockerfile-frontend/hack/release "${{ env.TYP }}" labs "$REPO_SLUG_TARGET" "${{ env.PUSH }}" | ||
env: | ||
CACHE_FROM: type=gha,scope=frontend-${{ env.TYP }} |