need to remove slash from digest artifact name #142
Workflow file for this run
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 | |
on: | |
push: | |
paths-ignore: | |
- 'README.md' | |
- 'docs/**' | |
- 'LICENSE' | |
- '.gitignore' | |
- '.github/ISSUE_TEMPLATE/**' | |
- '.github/PULL_REQUEST_TEMPLATE.md' | |
branches: | |
- "**" | |
tags: | |
- "**" | |
env: | |
REGISTRY_IMAGE: ldmx/dev | |
jobs: | |
build: | |
runs-on: self-hosted | |
timeout-minutes: 43200 | |
strategy: | |
fail-fast: false | |
matrix: | |
platform: | |
- linux/amd64 | |
- linux/arm64 | |
steps: | |
- | |
name: Checkout | |
uses: actions/checkout@v3 | |
- | |
name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY_IMAGE }} | |
- | |
name: Set up QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- | |
name: Build and push by digest | |
id: build | |
uses: docker/build-push-action@v4 | |
with: | |
context: . | |
cache-from: type=local,src=/home/github/layer-cache/${{matrix.platform}} | |
cache-to: type=local,dest=/home/github/layer-cache/${{matrix.platform}},mode=max | |
platforms: ${{ matrix.platform }} | |
labels: ${{ steps.meta.outputs.labels }} | |
outputs: type=image,name=${{ env.REGISTRY_IMAGE }},push-by-digest=true,name-canonical=true,push=true | |
- | |
name: Export digest | |
id: export-digest | |
run: | | |
mkdir digest | |
digest="${{ steps.build.outputs.digest }}" | |
platform="${{ matrix.platform }}" | |
digest_name="${platform#linux/}-digest" | |
digest_file="digest/${digest#sha256:}" | |
touch "${digest_file}" | |
echo "name=${digest_name}" >> "$GITHUB_OUTPUT" | |
echo "file=${digest_file}" >> "$GITHUB_OUTPUT" | |
- | |
name: Upload digest | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ steps.export-digest.outputs.name }} | |
path: ${{ steps.export-digest.outputs.file }} | |
if-no-files-found: error | |
merge: | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
steps: | |
- | |
name: Download digests | |
uses: actions/download-artifact@v3 | |
with: | |
path: digests | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY_IMAGE }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- | |
name: Login to Docker Hub | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
- | |
name: Create manifest list and push | |
working-directory: digests | |
run: | | |
docker buildx imagetools create $(jq -cr '.tags | map("-t " + .) | join(" ")' <<< "$DOCKER_METADATA_OUTPUT_JSON") \ | |
$(printf '${{ env.REGISTRY_IMAGE }}@sha256:%s ' */*) | |
- | |
name: Inspect image | |
run: | | |
docker buildx imagetools inspect ${{ env.REGISTRY_IMAGE }}:${{ steps.meta.outputs.version }} | |
test: | |
needs: merge | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
ldmx_sw_branch: [ trunk, v3.0.0, v3.0.2, v3.1.13, v3.2.0, v3.2.4 ] | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- | |
name: Setup QEMU | |
uses: docker/setup-qemu-action@v2 | |
- | |
name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v2 | |
- | |
name: Download Build Context for Test Script | |
uses: actions/checkout@v3 | |
- | |
name: Docker meta | |
id: meta | |
uses: docker/metadata-action@v4 | |
with: | |
images: ${{ env.REGISTRY_IMAGE }} | |
tags: | | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
- | |
name: Pull down ldmx-sw for testing | |
uses: actions/checkout@v3 | |
with: | |
repository: LDMX-Software/ldmx-sw | |
submodules: recursive | |
path: ldmx-sw | |
ref: ${{ matrix.ldmx_sw_branch }} | |
fetch-depth: 0 | |
- | |
name: Test the Image | |
run: | | |
echo "::group::Init Environment" | |
# extract a single tag to run tests with | |
tag=$(jq -r .tags[0] <<<"${DOCKER_METADATA_OUTPUT_JSON}") | |
export LDMX_BASE=$(pwd) | |
export _docker_parameters="-i -e LDMX_BASE -v $LDMX_BASE:$LDMX_BASE ${tag}" | |
mkdir ldmx-sw/build | |
interop_patches=".github/interop/${{ matrix.ldmx_sw_branch }}" | |
echo "::endgroup::" | |
if [ -d ${interop_patches} ]; then | |
echo "::group::Found ldmx-sw patches for ${{ matrix.ldmx_sw_branch }}" | |
for patch in ${interop_patches}/*; do | |
echo "running ${patch}" | |
./${patch} | |
done | |
echo "::endgroup::" | |
else | |
echo "::group::No patches for ${{ matrix.ldmx_sw_branch }}" | |
echo "::endgroup::" | |
fi | |
echo "::group::Build ldmx-sw" | |
docker run $_docker_parameters $(pwd)/ldmx-sw/build 'cmake .. && make install' | |
echo "::endgroup::" | |
echo "::group::Run python test script" | |
docker run $_docker_parameters $(pwd) python3 test.py | |
echo "::endgroup::" | |
if [ ! -d ${interop_patches} ]; then | |
echo "::group::ldmx-sw test program" | |
docker run $_docker_parameters $(pwd)/ldmx-sw/build ctest --verbose | |
echo "::endgroup::" | |
echo "::group::run a basic inclusive sim" | |
docker run $_docker_parameters $(pwd) \ | |
'LDMX_RUN_NUMBER=1 LDMX_NUM_EVENTS=10 fire ldmx-sw/.github/validation_samples/inclusive/config.py' | |
echo "::endgroup::" | |
fi |