typo #1
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: cli | |
on: | |
push: | |
branches: [ "main" ] | |
paths: | |
- 'cli/**/*.py' | |
- 'cli/**/*.sh' | |
- 'cli/**/Dockerfile' | |
- 'cli/**/requirements.txt' | |
- '**/cli.yml' | |
pull_request: | |
branches: [ "main" ] | |
paths: | |
- 'cli/**/*.py' | |
- 'cli/**/*.sh' | |
- 'cli/**/Dockerfile' | |
- 'cli/**/requirements.txt' | |
- '**/cli.yml' | |
jobs: | |
containers: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
component: [ cli ] | |
platform: [ linux/amd64, linux/arm64 ] | |
# Cancel in-progress jobs if matching component and platform when new PR arrives. | |
concurrency: | |
group: containers-${{ matrix.component }}-${{ matrix.platform }} | |
cancel-in-progress: true | |
steps: | |
- name: Create a variable with platform '${{ matrix.platform }}' value | |
run: echo "PLATFORM=${{ matrix.platform }}" >> $GITHUB_ENV | |
- name: Swap / for - in '${{ matrix.platform }}' and create local_platform variable | |
id: local_platform | |
run: | | |
LOCAL_PLATFORM="${PLATFORM//\//-}" | |
echo "LOCAL_PLATFORM=${LOCAL_PLATFORM}" >> $GITHUB_ENV | |
echo "local_platform=${LOCAL_PLATFORM}" >> $GITHUB_STATE | |
- name: checkout repo | |
uses: actions/checkout@v4 | |
- name: setup docker buildx | |
uses: docker/setup-buildx-action@v3 | |
# with: | |
# buildkitd-flags: --debug | |
- name: Login to GitHub Container Registry | |
uses: docker/login-action@v3 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GHCR_TOKEN }} | |
- name: Cache Docker layers | |
id: cache-docker-layers | |
uses: actions/cache@v4 | |
with: | |
path: /tmp/.buildx-cache--${{ steps.local_platform.outputs.local_platform }}-${{ matrix.component }} | |
key: ${{ runner.os }}-buildx | |
restore-keys: | | |
${{ runner.os }}-buildx | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
# - name: Build and push (ghcr.io/${{ github.repository_owner }}/hamframe-${{ matrix.component }}:test) | |
# uses: docker/build-push-action@v6 | |
# with: | |
# context: ./${{ matrix.component }} | |
# load: true | |
# tags: ghcr.io/${{ github.repository_owner }}/hamframe-${{ matrix.component }}:test | |
# platforms: ${{ matrix.platform }} | |
# cache-from: type=local,src=/tmp/.buildx-cache--${{ steps.local_platform.outputs.local_platform }}-${{ matrix.component }} | |
# cache-to: type=local,mode=max,dest=/tmp/.buildx-cache--${{ steps.local_platform.outputs.local_platform }}-${{ matrix.component }} | |
# # FIXME: this needs to be more than a do we exit with code 0 test.. | |
# # https://github.com/ckuhtz/hamframe/issues/2 | |
# - name: Run tests in container (ghcr.io/${{ github.repository_owner }}/hamframe-${{ matrix.component }}:test) | |
# run: docker run --rm --platform ${{ matrix.platform }} ghcr.io/${{ github.repository_owner }}/hamframe-${{ matrix.component }}:test | |
- name: Build and push (ghcr.io/${{ github.repository_owner }}/hamframe-${{ matrix.component }}:latest) | |
# if: success() | |
uses: docker/build-push-action@v6 | |
with: | |
context: ./${{ matrix.component }} | |
push: true | |
tags: ghcr.io/${{ github.repository_owner }}/hamframe-${{ matrix.component }}:latest | |
platforms: ${{ matrix.platform }} | |
cache-from: type=local,src=/tmp/.buildx-cache--${{ steps.local_platform.outputs.local_platform }}-${{ matrix.component }} | |
cache-to: type=local,mode=max,dest=/tmp/.buildx-cache--${{ steps.local_platform.outputs.local_platform }}-${{ matrix.component }} | |