✨ Introduce new artifact naming convention #1693
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: 'Test arm build' | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: arm-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}-${{ github.repository }} | |
cancel-in-progress: true | |
jobs: | |
get-matrix: | |
runs-on: ubuntu-latest | |
outputs: | |
matrix: ${{ steps.set-matrix.outputs.matrix }} | |
steps: | |
- uses: actions/checkout@v3 | |
- run: | | |
git fetch --prune --unshallow | |
- id: set-matrix | |
run: | | |
content=`curl https://raw.githubusercontent.com/kairos-io/kairos/master/.github/flavors-arm.json` | |
# the following lines are only required for multi line json | |
content="${content//'%'/'%25'}" | |
content="${content//$'\n'/'%0A'}" | |
content="${content//$'\r'/'%0D'}" | |
# end of optional handling for multi line json | |
echo "::set-output name=matrix::{\"include\": $content }" | |
docker: | |
needs: | |
- get-matrix | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write # OIDC support | |
strategy: | |
fail-fast: false | |
matrix: ${{fromJson(needs.get-matrix.outputs.matrix)}} | |
steps: | |
- name: Release space from worker | |
run: | | |
echo "Listing top largest packages" | |
pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr) | |
head -n 30 <<< "${pkgs}" | |
echo | |
df -h | |
echo | |
sudo apt-get remove -y '^llvm-.*|^libllvm.*' || true | |
sudo apt-get remove --auto-remove android-sdk-platform-tools || true | |
sudo apt-get purge --auto-remove android-sdk-platform-tools || true | |
sudo rm -rf /usr/local/lib/android | |
sudo apt-get remove -y '^dotnet-.*|^aspnetcore-.*' || true | |
sudo rm -rf /usr/share/dotnet | |
sudo apt-get remove -y '^mono-.*' || true | |
sudo apt-get remove -y '^ghc-.*' || true | |
sudo apt-get remove -y '.*jdk.*|.*jre.*' || true | |
sudo apt-get remove -y 'php.*' || true | |
sudo apt-get remove -y hhvm powershell firefox monodoc-manual msbuild || true | |
sudo apt-get remove -y '^google-.*' || true | |
sudo apt-get remove -y azure-cli || true | |
sudo apt-get remove -y '^mongo.*-.*|^postgresql-.*|^mysql-.*|^mssql-.*' || true | |
sudo apt-get remove -y '^gfortran-.*' || true | |
sudo apt-get autoremove -y | |
sudo apt-get clean | |
echo | |
echo "Listing top largest packages" | |
pkgs=$(dpkg-query -Wf '${Installed-Size}\t${Package}\t${Status}\n' | awk '$NF == "installed"{print $1 "\t" $2}' | sort -nr) | |
head -n 30 <<< "${pkgs}" | |
echo | |
sudo rm -rfv build || true | |
sudo rm -rf /usr/local/lib/android || true # will release about 10 GB if you don't need Android | |
sudo rm -rf /usr/share/dotnet || true # will release about 20GB if you don't need .NET | |
df -h | |
- uses: actions/checkout@v3 | |
- run: | | |
git fetch --prune --unshallow | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@master | |
with: | |
platforms: all | |
- name: Install Cosign | |
uses: sigstore/cosign-installer@main | |
- name: Login to Quay Registry | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
run: echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USERNAME }} --password-stdin quay.io | |
- name: Set up Docker Buildx | |
id: buildx | |
uses: docker/setup-buildx-action@master | |
- name: Build 🔧 | |
env: | |
FLAVOR: ${{ matrix.flavor }} | |
MODEL: ${{ matrix.model }} | |
IMAGE: "quay.io/kairos/kairos-${{ matrix.flavor }}" | |
TAG: "latest" | |
run: | | |
./earthly.sh +all-arm --IMAGE_NAME=kairos-$FLAVOR-$TAG.img --IMAGE="$IMAGE:$TAG" --MODEL=$MODEL --FLAVOR=$FLAVOR | |
- name: Push to quay | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
env: | |
COSIGN_YES: true | |
IMAGE: "quay.io/kairos/kairos-${{ matrix.flavor }}" | |
TAG: "latest" | |
run: | | |
docker push "$IMAGE:$TAG" # Otherwise .RepoDigests will be empty for some reason | |
cosign sign $(docker image inspect --format='{{index .RepoDigests 0}}' "$IMAGE:$TAG") | |
- name: Upload results | |
uses: actions/upload-artifact@v3 | |
with: | |
name: ${{ matrix.flavor }}-image | |
path: build | |
if-no-files-found: error | |
image_and_iso: | |
needs: | |
- get-matrix | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
flavor: | |
- "opensuse-leap-arm-generic" | |
steps: | |
- uses: actions/checkout@v3 | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
- name: Install earthly | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
uses: Luet-lab/luet-install-action@v1 | |
with: | |
repository: quay.io/kairos/packages | |
packages: utils/earthly | |
- name: Set up QEMU | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
uses: docker/setup-qemu-action@master | |
with: | |
platforms: all | |
- name: Login to Quay Registry | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
run: echo ${{ secrets.QUAY_PASSWORD }} | docker login -u ${{ secrets.QUAY_USERNAME }} --password-stdin quay.io | |
- name: Set up Docker Buildx | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
id: buildx | |
uses: docker/setup-buildx-action@master | |
- name: Build 🔧 | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
env: | |
IMAGE: "quay.io/kairos/kairos-${{ matrix.flavor }}" | |
TAG: "master" | |
run: | | |
earthly -P +all-arm-generic --IMAGE="$IMAGE:$TAG" --FLAVOR=${{ matrix.flavor }} --CORE_VERSION=master | |
- name: Push to quay | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
env: | |
IMAGE: "quay.io/kairos/kairos-${{ matrix.flavor }}" | |
TAG: "master" | |
run: | | |
docker push "$IMAGE:$TAG" | |
- uses: actions/upload-artifact@v3 | |
if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
with: | |
name: kairos-${{ matrix.flavor }}-arm64.iso.zip | |
path: | | |
build/*.iso | |
build/*.sha256 |