Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: implement linux/arm64 container #50

Merged
merged 2 commits into from
Jan 20, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 58 additions & 20 deletions .github/workflows/build-containers.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,11 @@ jobs:
- 'ubuntu-20.04'
- 'alpine-3.17'
architecture:
- { host: 'ubuntu-22.04', platform: 'linux/amd64', suffix: 'x64' }
- { host: 'ubuntu-22.04-arm', platform: 'linux/arm64', suffix: 'arm64' }
- { host: 'ubuntu-22.04', platform: linux/amd64, suffix: 'x64', suffix2: 'amd64' }
- { host: 'ubuntu-22.04-arm', platform: linux/arm64, suffix: 'arm64', suffix2: 'arm64' }

outputs:
tags: ${{ steps.meta.outputs.tags }}

steps:
- name: Checkout
Expand Down Expand Up @@ -62,13 +65,13 @@ jobs:
images: |
ghcr.io/tamatebako/tebako-${{ matrix.container }}
tags: |
type=semver,pattern={{version}},value=${{ env.VERSION }},enable=${{ github.event_name == 'workflow_run' }}
type=semver,pattern={{version}},enable=${{ github.event_name != 'workflow_run' }}
type=semver,pattern={{major}}.{{minor}},value=${{ env.VERSION }},enable=${{ github.event_name == 'workflow_run' }}
type=semver,pattern={{major}}.{{minor}},enable=${{ github.event_name != 'workflow_run' }}
type=semver,pattern={{major}},value=${{ env.VERSION }},enable=${{ github.event_name == 'workflow_run' }}
type=semver,pattern={{major}},enable=${{ github.event_name != 'workflow_run' }}
type=sha
type=semver,pattern={{version}}-${{ matrix.architecture.suffix2 }},value=${{ env.VERSION }},enable=${{ github.event_name == 'workflow_run' }}
type=semver,pattern={{version}}-${{ matrix.architecture.suffix2 }},enable=${{ github.event_name != 'workflow_run' }}
type=semver,pattern={{major}}.{{minor}}-${{ matrix.architecture.suffix2 }},value=${{ env.VERSION }},enable=${{ github.event_name == 'workflow_run' }}
type=semver,pattern={{major}}.{{minor}}-${{ matrix.architecture.suffix2 }},enable=${{ github.event_name != 'workflow_run' }}
type=semver,pattern={{major}}-${{ matrix.architecture.suffix2 }},value=${{ env.VERSION }},enable=${{ github.event_name == 'workflow_run' }}
type=semver,pattern={{major}}-${{ matrix.architecture.suffix2 }},enable=${{ github.event_name != 'workflow_run' }}
type=sha,suffix=-${{ matrix.architecture.suffix2 }}
labels: |
org.opencontainers.image.vendor=Ribose Inc.
org.opencontainers.image.licenses=BSD-2-Clause
Expand All @@ -84,7 +87,7 @@ jobs:
with:
context: .
file: ./${{ matrix.container }}.Dockerfile
push: ${{ contains(github.ref, 'refs/tags/v') || github.event_name == 'workflow_run' }}
push: ${{ contains(github.ref, 'refs/tags/v') || github.event_name == 'workflow_run' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
annotations: ${{ steps.meta.outputs.annotations }}
Expand All @@ -96,16 +99,50 @@ jobs:
continue-on-error: true
uses: actions/delete-package-versions@v5
with:
package-name: tebako-${{ matrix.container }}-amd64
package-name: amd64-tebako-${{ matrix.container }}
package-type: container
min-versions-to-keep: 10
min-versions-to-keep: 0
delete-only-untagged-versions: false

create-manifests:
name: Create manifest for ghcr.io/tamatebako/tebako-${{ matrix.container }}
if: contains(github.ref, 'refs/tags/v') || github.event_name == 'workflow_run'
runs-on: ubuntu-22.04
needs: build-containers
permissions:
contents: read
packages: write
strategy:
fail-fast: false
matrix:
container:
- 'ubuntu-20.04'
- 'alpine-3.17'
steps:
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: tamatebako
password: ${{ secrets.GITHUB_TOKEN }}

- name: Create SHA manifest and push
run: |
for tag in $(echo "${{ needs.build-containers.outputs.tags }}" | tr ',' '\n'); do
base_tag=$(echo $tag | sed -E 's/.*:(.*)-(amd64|arm64)/\1/')
echo "Processing $tag, using base tag $base_tag"
docker manifest create \
ghcr.io/tamatebako/tebako-${{ matrix.container }}:$base_tag \
--amend ghcr.io/tamatebako/tebako-${{ matrix.container }}:$base_tag-amd64 \
--amend ghcr.io/tamatebako/tebako-${{ matrix.container }}:$base_tag-arm64
docker manifest push ghcr.io/tamatebako/tebako-${{ matrix.container }}:$base_tag
done

test-packaging-in-container:
name: Package ${{ matrix.gem }} in ${{ matrix.container }} ${{ matrix.architecture.platform }} with Ruby ${{ matrix.package_ruby_ver }}
if: contains(github.ref, 'refs/tags/v') || github.event_name == 'workflow_run'
runs-on: ${{ matrix.architecture.host }}
needs: build-containers
needs: create-manifests
strategy:
fail-fast: false
matrix:
Expand All @@ -115,13 +152,14 @@ jobs:
- 'ubuntu-20.04'
- 'alpine-3.17'
architecture:
- { host: 'ubuntu-22.04', platform: 'linux/amd64' }
- { host: 'ubuntu-22.04-arm', platform: 'linux/arm64' }
- { host: 'ubuntu-22.04', platform: linux/amd64 }
- { host: 'ubuntu-22.04-arm', platform: linux/arm64 }
package_ruby_ver:
- '3.2.6'
- '3.3.6'
container:
image: ghcr.io/tamatebako/tebako-${{ matrix.container }}:latest
options: --platform ${{ matrix.architecture.platform }}

steps:
- name: Checkout fontist
Expand All @@ -140,7 +178,7 @@ jobs:
name: Package ${{ matrix.gem }} by ${{ matrix.container }} ${{ matrix.architecture.platform }} container with Ruby ${{ matrix.package_ruby_ver }}
if: contains(github.ref, 'refs/tags/v') || github.event_name == 'workflow_run'
runs-on: ${{ matrix.architecture.host }}
needs: build-containers
needs: create-manifests
strategy:
fail-fast: false
matrix:
Expand All @@ -150,8 +188,8 @@ jobs:
- 'ubuntu-20.04'
- 'alpine-3.17'
architecture:
- { host: 'ubuntu-22.04', platform: 'linux/amd64' }
- { host: 'ubuntu-22.04-arm', platform: 'linux/arm64' }
- { host: 'ubuntu-22.04', platform: linux/amd64 }
- { host: 'ubuntu-22.04-arm', platform: linux/arm64 }
package_ruby_ver:
- '3.2.6'
- '3.3.6'
Expand All @@ -165,8 +203,8 @@ jobs:

- name: Package fontist
run: |
docker run -v ${{github.workspace}}:/mnt/w -t ghcr.io/tamatebako/tebako-${{ matrix.container }}:latest \
tebako press --root=/mnt/w/fontist --entry-point=fontist --output=/mnt/w/fontist-package --Ruby=${{ matrix.package_ruby_ver }}
docker run --platform ${{ matrix.architecture.platform }} -v ${{github.workspace}}:/mnt/w -t ghcr.io/tamatebako/tebako-${{ matrix.container }}:latest \
tebako press --root=/mnt/w/fontist --entry-point=fontist --output=/mnt/w/fontist-package --Ruby=${{ matrix.package_ruby_ver }}

- name: Run smoke test Ubuntu
if: contains(matrix.container, 'ubuntu')
Expand Down
2 changes: 1 addition & 1 deletion tools/tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ set -o errexit -o pipefail -o noclobber -o nounset

: "${LOCAL_BUILDS:=/tmp/tebako}"
: "${CMAKE_VERSION:=3.24.4-1}"
: "${RUBY_VERSION:=3.1.6}"
: "${RUBY_VERSION:=3.2.6}"
: "${RUBY_INSTALL_VERSION:=0.9.3}"
: "${ARCH:=x64}"

Expand Down