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

Bump yip to 1.9.2 #35

Open
wants to merge 11 commits into
base: v2.1.x
Choose a base branch
from
Open
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
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
58 changes: 58 additions & 0 deletions .github/actions/fetchimages/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
name: Pull images
descriptions: Fetches and loads images from the cache

inputs:
version:
description: key of the cache and tag of the images
required: true
type: string
flavor:
description: flavor of the OS image
required: false
type: string
toolkit:
description: fetch toolkit image
required: false
default: 'true'
type: 'boolean'
os:
description: fetch OS image
required: false
default: 'true'
type: 'boolean'

runs:
using: composite
steps:
- if: ${{ inputs.toolkit == 'true' }}
name: Fetch toolkit image
id: cache-toolkit
uses: actions/cache/restore@v4
env:
cache-name: toolkit-build-x86_64-${{ github.event_name }}
with:
path: /tmp/toolkit.tar
key: ${{ env.cache-name }}-${{ inputs.version }}
fail-on-cache-miss: true
- if: ${{ inputs.toolkit == 'true' }}
name: Load toolkit image
id: load-toolkit
shell: bash
run: |
docker load -i /tmp/toolkit.tar
- if: ${{ inputs.os == 'true' }}
name: Fetch OS image
id: cache-os
uses: actions/cache/restore@v4
env:
cache-name: os-build-x86_64-${{ inputs.flavor }}-${{ github.event_name }}
with:
path: /tmp/os.tar
key: ${{ env.cache-name }}-${{ inputs.version }}
fail-on-cache-miss: true
- if: ${{ inputs.os == 'true' }}
name: Load OS image
id: load-os
shell: bash
run: |
docker load -i /tmp/os.tar
20 changes: 20 additions & 0 deletions .github/actions/version/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Version hash
descriptions: Computes the version hash from the current context

outputs:
version:
description: computed hash from current context
value: ${{ steps.version.outputs.version }}

runs:
using: composite
steps:
- name: Define version
id: version
shell: bash
env:
hash: ${{ hashFiles('Dockerfile', '**/go.sum', '**/pkg/**', '**/examples/**', '**/cmd/**', '**/vendor/**', '**/Makefile', '**/main.go') }}
run: |
version="${{ env.hash }}"
version=${version::16}
echo "version=${version}" >> $GITHUB_OUTPUT
67 changes: 40 additions & 27 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -1,26 +1,18 @@
name: Build
on:
pull_request:
push:
tags:
- v**
pull_request_target:
types:
- opened
- synchronize
- reopened
paths:
- tests/**
- make/**
- Makefile
- .github/**
- pkg/**
- cmd/**
- go.mod
- go.sum
- examples/**
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}
cancel-in-progress: true

jobs:
detect:
permissions:
contents: read
runs-on: ubuntu-latest
outputs:
flavor: ${{ steps.set-matrix.outputs.flavor }}
Expand All @@ -42,29 +34,49 @@ jobs:
fi

build-toolkit:
permissions:
contents: read
needs:
- detect
permissions:
packages: write
runs-on: ubuntu-latest
env:
PLATFORM: ${{ needs.detect.outputs.platform }}
TOOLKIT_REPO: ghcr.io/${{github.repository}}/elemental-cli
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@v4
with:
ref: "${{ github.event.pull_request.head.sha }}"
- run: |
git fetch --prune --unshallow
- name: Log in to ghcr.io
uses: docker/login-action@v3
- name: Define version
id: version
uses: ./.github/actions/version
- name: Check cache for Toolkit image
id: cache-toolkit
uses: actions/cache/restore@v4
env:
cache-name: toolkit-build-x86_64-${{ github.event_name }}
lookup-only: true
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build toolkit
path: /tmp/toolkit.tar
key: ${{ env.cache-name }}-${{ steps.version.outputs.version }}
- if: ${{ steps.cache-toolkit.outputs.cache-hit != 'true' }}
name: Build toolkit
env:
VERSION: ${{ steps.version.outputs.version }}
run: |
make DOCKER_ARGS=--push build
make build-save
mv build/elemental-toolkit*.tar /tmp/toolkit.tar
- if: ${{ steps.cache-toolkit.outputs.cache-hit != 'true' }}
name: Save toolkit image in cache
id: save-toolkit
uses: actions/cache/save@v4
env:
cache-name: toolkit-build-x86_64-${{ github.event_name }}
with:
path: /tmp/toolkit.tar
key: ${{ env.cache-name }}-${{ steps.version.outputs.version }}

build-matrix:
needs:
Expand All @@ -77,3 +89,4 @@ jobs:
uses: ./.github/workflows/build_and_test_x86.yaml
with:
flavor: ${{ matrix.flavor }}
version: ${{ needs.build-toolkit.outputs.version }}
6 changes: 4 additions & 2 deletions .github/workflows/build_and_test_arm.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,13 @@ on:
type: string

concurrency:
group: ci-${{ inputs.flavor }}-aarch64-${{ github.head_ref || github.ref }}-${{ github.repository }}
group: ${{ github.workflow }}-${{ github.head_ref || github.ref_name }}-${{ inputs.flavor }}-aarch64
cancel-in-progress: true

jobs:
permissions:
contents: read

jobs:
build-iso:
needs: detect
runs-on: [self-hosted, arm64]
Expand Down
Loading
Loading