fix: downgrade docker-image-size-limit to 2.0.0 #494
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: build-push | |
on: | |
push: | |
branches: [ main ] | |
tags: | |
- '*' | |
pull_request: | |
workflow_dispatch: | |
concurrency: | |
group: '${{ github.workflow }}-${{ github.job }}-${{ github.head_ref || github.ref_name }}' | |
cancel-in-progress: true | |
jobs: | |
job_info: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.version.outputs.result }} | |
head_tag: ${{ steps.check.outputs.head_tag }} | |
foreign_pr: ${{ steps.check.outputs.foreign_pr }} | |
steps: | |
- uses: actions/checkout@v4 | |
- id: version | |
run: | | |
export CLI_VERSION=$(cat VERSION.mak | cut -d ' ' -f 3) | |
echo "result=${CLI_VERSION}" >> $GITHUB_OUTPUT | |
- name: Show version number | |
run: echo ${{ steps.version.outputs.result }} | |
- name: Retrieve tags | |
run: git fetch --depth=1 origin +refs/tags/*:refs/tags/* | |
- name: Set output variables | |
id: check | |
run: | | |
fpr="no" | |
tag="" | |
if [[ "${{ github.ref }}" == refs/heads/* ]]; then | |
tag="$(git tag --points-at HEAD)" | |
elif [[ "${{ github.ref }}" == refs/pull/* ]] && [ "${{ github.event.pull_request.head.repo.full_name }}" != "${{ github.event.pull_request.base.repo.full_name }}" ]; then | |
fpr="yes" | |
fi | |
echo "foreign_pr=${fpr}" >> $GITHUB_OUTPUT | |
echo "head_tag=${tag}" >> $GITHUB_OUTPUT | |
build: | |
name: Build (${{ matrix.image_type }}-${{ matrix.root_image.id }}) | |
runs-on: ubuntu-latest | |
needs: job_info | |
if: "(github.event_name == 'push' && needs.job_info.outputs.head_tag == '') || github.event_name == 'pull_request'" | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
root_image: | |
- id: ruby | |
image: ruby:3.1.1-slim-bullseye | |
- id: ubuntu | |
image: ubuntu:20.04 | |
- id: alpine | |
image: ruby:3.1.1-alpine | |
image_type: | |
- metanorma | |
# - mn | |
experimental: [false] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- id: label_prefix | |
env: | |
IS_PRERELEASE: ${{matrix.image_type == 'mn'}} | |
IS_MAIN: ${{matrix.image_type == 'metanorma' && matrix.root_image.id == 'ruby'}} | |
run: | | |
if [ "$IS_MAIN" == "true" ]; then | |
echo "result=" >> $GITHUB_OUTPUT | |
elif [ "$IS_PRERELEASE" == "true" ]; then | |
echo "result=prefix=pre-${{ matrix.root_image.id }}-,onlatest=true" >> $GITHUB_OUTPUT | |
else | |
echo "result=prefix=${{ matrix.root_image.id }}-,onlatest=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Show label prefix calculation | |
run: echo ${{ steps.label_prefix.outputs.result }} | |
- id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
metanorma/metanorma | |
ghcr.io/metanorma/metanorma | |
flavor: | | |
${{ steps.label_prefix.outputs.result }} | |
tags: | | |
type=edge,branch=main | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
labels: | | |
org.opencontainers.image.vendor=Ribose Inc. | |
org.opencontainers.image.licenses=BSD-3-Clause | |
org.opencontainers.image.documentation=https://www.metanorma.org | |
org.opencontainers.image.ref.name=metanorma/${{ matrix.image_type }}:${{ matrix.root_image.id }} | |
org.opencontainers.image.base.name=${{ matrix.root_image.image }} | |
org.opencontainers.image.title=Metanorma official public image | |
org.opencontainers.image.description=Metanorma official public image on ${{ matrix.root_image.image }} | |
org.opencontainers.image.version=${{needs.job_info.outputs.version}} | |
# Build on linux/amd64 for testing first as it is fastest | |
- id: build_container | |
name: Build and export | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64 | |
file: Dockerfile.${{ matrix.root_image.id }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
METANORMA_IMAGE_NAME=${{ matrix.image_type }}-${{ matrix.root_image.id }} | |
secret-files: | | |
bundle_config=.bundle/config | |
outputs: type=docker,dest=/tmp/docker-image.tar | |
# cache-from: type=gha | |
# cache-to: type=gha,mode=min | |
- run: | | |
echo "${{ steps.meta.outputs.tags }}" > /tmp/docker-tags.txt | |
echo "${{ steps.meta.outputs.labels }}" > /tmp/docker-labels.txt | |
- name: Upload artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.image_type }}-${{ matrix.root_image.id }}-${{ github.run_id }} | |
path: /tmp/docker-image.tar | |
retention-days: 1 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: tags-${{ matrix.image_type }}-${{ matrix.root_image.id }}-${{ github.run_id }} | |
path: /tmp/docker-tags.txt | |
retention-days: 1 | |
- uses: actions/upload-artifact@v4 | |
with: | |
name: labels-${{ matrix.image_type }}-${{ matrix.root_image.id }}-${{ github.run_id }} | |
path: /tmp/docker-labels.txt | |
retention-days: 1 | |
lint: | |
name: Lint (${{ matrix.image_type }}-${{ matrix.root_image.id }}) | |
runs-on: ubuntu-latest | |
needs: build | |
continue-on-error: ${{ matrix.experimental }} | |
strategy: | |
fail-fast: false | |
matrix: | |
root_image: | |
- id: ruby | |
image: ruby:3.1.1-slim-bullseye | |
max_size: '2.0 GiB' | |
- id: ubuntu | |
image: ubuntu:20.04 | |
max_size: '2.0 GB' | |
- id: alpine | |
image: ruby:3.1.1-alpine | |
max_size: '1.8 GB' | |
image_type: | |
- metanorma | |
experimental: [false] | |
steps: | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ matrix.image_type }}-${{ matrix.root_image.id }}-${{ github.run_id }} | |
path: /tmp | |
- uses: actions/download-artifact@v4 | |
with: | |
name: tags-${{ matrix.image_type }}-${{ matrix.root_image.id }}-${{ github.run_id }} | |
path: /tmp | |
- id: loaded_image | |
name: Load image | |
run: | | |
docker load --input /tmp/docker-image.tar | |
echo "full_name<<EOF" >> $GITHUB_OUTPUT | |
echo "$(head -n 1 /tmp/docker-tags.txt)" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- run: docker history --no-trunc ${{ steps.loaded_image.outputs.full_name }} | |
- run: docker inspect -f "{{ .Size }}" ${{ steps.loaded_image.outputs.full_name }} | |
- uses: metanorma/ci/dive-action@main | |
with: | |
image: ${{ steps.loaded_image.outputs.full_name }} | |
github-token: ${{ github.token }} | |
- uses: wemake-services/[email protected] | |
with: | |
image: ${{ steps.loaded_image.outputs.full_name }} | |
size: ${{ matrix.root_image.max_size }} | |
samples-matrix: | |
name: Samples matrix | |
uses: metanorma/ci/.github/workflows/build-sample-matrix.yml@main | |
with: | |
smoke: false | |
flavors-only: true | |
public-only: true | |
test-matrix: | |
name: Test matrix | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.build.outputs.matrix }} | |
needs: samples-matrix | |
steps: | |
- name: Build full test matrix | |
id: build | |
run: | | |
echo "{\"root_image\": [\"ruby\", \"ubuntu\", \"alpine\"], \"image_type\": [\"metanorma\"]}" > docker-matrix.json | |
echo '${{ needs.samples-matrix.outputs.samples-matrix }}' > samples-matrix.json | |
echo "matrix=$(jq -s add docker-matrix.json samples-matrix.json | tr '\n' ' ')" >> $GITHUB_OUTPUT | |
test: | |
name: Test (${{ matrix.image_type }}-${{ matrix.root_image }}, ${{ matrix.flavor.id }}) | |
runs-on: ubuntu-latest | |
needs: | |
- build | |
- job_info | |
- test-matrix | |
continue-on-error: ${{ matrix.flavor.experimental || matrix.root_image == 'alpine' }} | |
strategy: | |
max-parallel: 5 | |
fail-fast: false | |
matrix: ${{ fromJson(needs.test-matrix.outputs.matrix) }} | |
steps: | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- uses: actions/download-artifact@v4 | |
with: | |
name: ${{ matrix.image_type }}-${{ matrix.root_image }}-${{ github.run_id }} | |
path: /tmp | |
- uses: actions/download-artifact@v4 | |
with: | |
name: tags-${{ matrix.image_type }}-${{ matrix.root_image }}-${{ github.run_id }} | |
path: /tmp | |
- id: loaded_image | |
name: Load image | |
run: | | |
docker load --input /tmp/docker-image.tar | |
echo "full_name=$(head -n 1 /tmp/docker-tags.txt)" >> $GITHUB_OUTPUT | |
- name: Fetch samples (${{ matrix.flavor.id }}) | |
uses: actions/checkout@v4 | |
with: | |
submodules: recursive | |
repository: metanorma/mn-samples-${{ matrix.flavor.id }} | |
token: ${{ secrets.METANORMA_CI_PAT_TOKEN }} | |
path: ${{ github.workspace }}/samples | |
fetch-depth: 1 | |
- name: Run tests | |
env: | |
IMAGE_NAME: ${{ steps.loaded_image.outputs.full_name }} | |
run: | | |
docker run --rm \ | |
-v ${{ github.workspace }}/samples:/metanorma \ | |
-w /metanorma \ | |
${IMAGE_NAME} \ | |
metanorma site generate --strict --agree-to-terms . | |
publish: | |
name: Build+publish (${{ matrix.image_type }}-${{ matrix.root_image.id }} | |
runs-on: ubuntu-latest | |
if: github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/v') | |
needs: | |
- test | |
- job_info | |
strategy: | |
max-parallel: 3 | |
fail-fast: false | |
matrix: | |
root_image: | |
- id: ruby | |
image: ruby:3.1.1-slim-bullseye | |
- id: ubuntu | |
image: ubuntu:20.04 | |
- id: alpine | |
image: ruby:3.1.1-alpine | |
image_type: | |
- metanorma | |
# - mn | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
with: | |
driver-opts: image=moby/buildkit:master | |
- name: Download artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: ${{ matrix.image_type }}-${{ matrix.root_image.id }}-${{ github.run_id }} | |
path: /tmp | |
- id: loaded_image | |
name: Load image | |
run: | | |
docker load --input /tmp/docker-image.tar | |
docker image ls -a | |
docker image ls --format "{{.Repository}}:{{.Tag}}" metanorma/metanorma | |
result=$(docker image ls --format "{{.Repository}}:{{.Tag}}" metanorma/metanorma | head -1 | tr -d '\n') | |
echo "result=${result}" >> $GITHUB_OUTPUT | |
- uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_LOGIN_USERNAME }} | |
password: ${{ secrets.DOCKER_LOGIN_PASSWORD }} | |
- uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: metanorma-ci | |
password: ${{ secrets.METANORMA_CI_PAT_TOKEN }} | |
- id: label_prefix | |
env: | |
IS_PRERELEASE: ${{matrix.image_type == 'mn'}} | |
IS_MAIN: ${{matrix.image_type == 'metanorma' && matrix.root_image.id == 'ruby'}} | |
run: | | |
echo '::echo::on' | |
if [ "$IS_MAIN" == "true" ]; then | |
echo "result=" >> $GITHUB_OUTPUT | |
elif [ "$IS_PRERELEASE" == "true" ]; then | |
echo "result=prefix=pre-${{ matrix.root_image.id }}-,onlatest=true" >> $GITHUB_OUTPUT | |
else | |
echo "result=prefix=${{ matrix.root_image.id }}-,onlatest=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Show label prefix calculation | |
run: echo "${{ steps.label_prefix.outputs.result }}" | |
- id: meta | |
uses: docker/metadata-action@v5 | |
with: | |
images: | | |
docker.io/metanorma/metanorma | |
ghcr.io/metanorma/metanorma | |
flavor: | | |
${{ steps.label_prefix.outputs.result }} | |
tags: | | |
type=edge,branch=main | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
labels: | | |
org.opencontainers.image.vendor=Ribose Inc. | |
org.opencontainers.image.licenses=BSD-3-Clause | |
org.opencontainers.image.documentation=https://www.metanorma.org | |
org.opencontainers.image.ref.name=metanorma/${{ matrix.image_type }}:${{ matrix.root_image.id }} | |
org.opencontainers.image.base.name=${{ matrix.root_image.image }} | |
org.opencontainers.image.title=Metanorma official public image | |
org.opencontainers.image.description=Metanorma official public image on ${{ matrix.root_image.image }} | |
org.opencontainers.image.version=${{needs.job_info.outputs.version}} | |
- id: build_container | |
name: Build+push to registries | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
platforms: linux/amd64,linux/arm64 | |
push: true | |
file: Dockerfile.${{ matrix.root_image.id }} | |
tags: ${{ steps.meta.outputs.tags }} | |
labels: ${{ steps.meta.outputs.labels }} | |
build-args: | | |
METANORMA_IMAGE_NAME=${{ matrix.image_type }}-${{ matrix.root_image.id }} | |
secret-files: | | |
bundle_config=.bundle/config | |
# cache-from: type=gha | |
# cache-to: type=gha,mode=min | |
announce: | |
name: Announce to mn-samples-* | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
needs: publish | |
steps: | |
- name: Trigger samples repositories | |
env: | |
GH_USERNAME: metanorma-ci | |
GH_ACCESS_TOKEN: ${{ secrets.METANORMA_CI_PAT_TOKEN }} | |
run: | | |
curl -LO --retry 3 https://raw.githubusercontent.com/metanorma/metanorma-build-scripts/main/trigger-gh-actions.sh | |
for repo in iso cc gb iec itu ogc un iho nist | |
do | |
sh trigger-gh-actions.sh $ORGANISATION mn-samples-$repo $GH_USERNAME $GH_ACCESS_TOKEN $GITHUB_REPOSITORY | |
done |