Enable continuous memory profiling (#1306) #72
This file contains hidden or 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: Build Container Image | |
| on: | |
| push: | |
| branches: | |
| - main | |
| tags: | |
| - '*' | |
| workflow_dispatch: | |
| jobs: | |
| build-image: | |
| runs-on: ubuntu-latest | |
| # Local registry needed to share the build-env image between steps when | |
| # using the docker-container buildkit driver | |
| services: | |
| registry: | |
| image: registry:2 | |
| ports: | |
| - 5000:5000 | |
| steps: | |
| - uses: docker/login-action@v3 | |
| with: | |
| registry: ghcr.io | |
| username: ${{ github.repository_owner }} | |
| password: ${{ secrets.GITHUB_TOKEN }} | |
| - uses: actions/checkout@v4 | |
| - name: Gather information | |
| id: info | |
| run: | | |
| echo "toolchain_version=$(yq '.toolchain.channel' --output-format=yaml rust-toolchain.toml)" >> $GITHUB_OUTPUT | |
| echo "crate_version=$(yq '.workspace.package.version' --output-format=yaml Cargo.toml)" >> $GITHUB_OUTPUT | |
| echo "git_timestamp=$(git log -1 --pretty=%ct)" >> $GITHUB_OUTPUT | |
| echo "## Build information" >> $GITHUB_STEP_SUMMARY | |
| echo "| | |" >> $GITHUB_STEP_SUMMARY | |
| echo "| --- | --- |" >> $GITHUB_STEP_SUMMARY | |
| cat $GITHUB_OUTPUT | sed 's/\(.*\)=\(.*\)/| \1 | \2 |/' >> $GITHUB_STEP_SUMMARY | |
| - uses: docker/setup-buildx-action@v3 | |
| with: | |
| # network=host driver-opt needed to push to local registry | |
| driver-opts: network=host | |
| - name: Prepare build environment image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| context: ./build/build-image | |
| build-args: RUST_TOOLCHAIN=${{ steps.info.outputs.toolchain_version }} | |
| cache-from: type=gha,scope=build-env | |
| cache-to: type=gha,mode=max,scope=build-env | |
| push: true | |
| tags: localhost:5000/build-env:latest | |
| - name: Gather image metadata | |
| id: meta | |
| uses: docker/metadata-action@v5 | |
| with: | |
| images: | | |
| ghcr.io/embarkstudios/quilkin | |
| tags: | | |
| type=ref,event=tag | |
| type=sha,prefix=${{ steps.info.outputs.crate_version }}- | |
| - name: Build container image | |
| uses: docker/build-push-action@v6 | |
| with: | |
| # build.rs runs git commands, need to preserve .git directory | |
| # https://docs.docker.com/reference/dockerfile/#buildkit-built-in-build-args | |
| build-args: BUILDKIT_CONTEXT_KEEP_GIT_DIR=1 | |
| file: image/Dockerfile.ghaction | |
| build-contexts: | | |
| build-env=docker-image://localhost:5000/build-env:latest | |
| cache-from: type=gha,scope=quilkin | |
| cache-to: type=gha,mode=max,scope=quilkin | |
| push: true | |
| tags: ${{ steps.meta.outputs.tags }} | |
| annotations: ${{ steps.meta.outputs.annotations }} | |
| env: | |
| # Set the build timestamp to the commit timestamp, so we can | |
| # hopefully get reproducible builds when built from the same commit | |
| # https://github.com/moby/buildkit/blob/master/docs/build-repro.md#source_date_epoch | |
| SOURCE_DATE_EPOCH: ${{ steps.info.outputs.git_timestamp }} |