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

Update workflows #1945

Closed
wants to merge 1 commit into from
Closed
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
68 changes: 44 additions & 24 deletions .github/workflows/build_and_test_x86.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,29 +12,42 @@ concurrency:
cancel-in-progress: true

jobs:
# detect step checks what machines the later steps should run on
detect:
build-os:
permissions:
packages: write
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.detect.outputs.tests }}
env:
FLAVOR: ${{ inputs.flavor }}
ARCH: x86_64
TOOLKIT_REPO: ghcr.io/${{ github.repository }}/elemental-cli
REPO: ghcr.io/${{ github.repository }}/elemental-${{ inputs.flavor }}
steps:
- id: detect
env:
FLAVOR: ${{ inputs.flavor }}
- uses: actions/checkout@v4
- run: |
git fetch --prune --unshallow
- name: Log in to registry
run: echo "${{ secrets.GITHUB_TOKEN }}" | docker login ghcr.io -u $ --password-stdin
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build toolkit
run: |
if [ "${FLAVOR}" == green ]; then
echo "tests=['test-upgrade', 'test-recovery', 'test-fallback', 'test-fsck', 'test-grubfallback']" >> $GITHUB_OUTPUT
else
echo "tests=['test-active']" >> $GITHUB_OUTPUT
fi

make pull-toolkit
make ARCH=${{ env.ARCH }} DOCKER_ARGS=--load build-os
make ARCH=${{ env.ARCH }} DOCKER_ARGS=--push build-os

build-iso:
needs: detect
needs:
- build-os
runs-on: ubuntu-latest
env:
FLAVOR: ${{ inputs.flavor }}
ARCH: x86_64
TOOLKIT_REPO: ghcr.io/${{github.repository}}/elemental-cli
REPO: ghcr.io/${{ github.repository }}/elemental-${{ inputs.flavor }}
steps:
- uses: actions/checkout@v4
- run: |
Expand All @@ -49,10 +62,6 @@ jobs:
with:
path: /tmp/*.iso
key: ${{ env.cache-name }}-${{ hashFiles('Dockerfile', '**/go.sum', '**/pkg/**', '**/examples/**', '**/cmd/**', '**/vendor/**', '**/Makefile', '**/main.go') }}
- if: ${{ steps.cache-iso.outputs.cache-hit != 'true' }}
name: Build toolkit
run: |
make build
- if: ${{ steps.cache-iso.outputs.cache-hit != 'true' }}
name: Build ISO
run: |
Expand All @@ -70,7 +79,8 @@ jobs:
enableCrossOsArchive: true

build-disk:
needs: detect
needs:
- build-os
runs-on: ubuntu-latest
env:
FLAVOR: ${{ inputs.flavor }}
Expand All @@ -95,15 +105,10 @@ jobs:
sudo rm -rf /usr/local/lib/android # will release about 10 GB if you don't need Android
sudo rm -rf /usr/share/dotnet # will release about 20GB if you don't need .NET
sudo df -h
- if: ${{ steps.cache-check.outputs.cache-hit != 'true' }}
name: Build toolkit
run: |
make build
- if: ${{ steps.cache-check.outputs.cache-hit != 'true' }}
name: Install to disk
run: |
sudo apt-get update && sudo apt-get install -y --no-install-recommends qemu-utils coreutils
make ARCH=${{ env.ARCH }} build-os
sudo -E make ARCH=${{ env.ARCH }} build-disk
sudo mv build/elemental-${{ env.FLAVOR }}.${{ env.ARCH}}.qcow2 /tmp/
- if: ${{ steps.cache-check.outputs.cache-hit != 'true' }}
Expand All @@ -117,6 +122,21 @@ jobs:
key: ${{ env.cache-name }}-${{ hashFiles('Dockerfile', '**/go.sum', '**/pkg/**', '**/examples/**', '**/cmd/**', '**/vendor/**', '**/Makefile', '**/main.go') }}
enableCrossOsArchive: true

detect:
runs-on: ubuntu-latest
outputs:
tests: ${{ steps.detect.outputs.tests }}
steps:
- id: detect
env:
FLAVOR: ${{ inputs.flavor }}
run: |
if [ "${FLAVOR}" == green ]; then
echo "tests=['test-upgrade', 'test-recovery', 'test-fallback', 'test-fsck', 'test-grubfallback']" >> $GITHUB_OUTPUT
else
echo "tests=['test-active']" >> $GITHUB_OUTPUT
fi

tests-matrix:
needs:
- build-disk
Expand Down
2 changes: 2 additions & 0 deletions .github/workflows/cli.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@ on:
- .github/**
- Makefile
- tests/**
- go.mod
- go.sum
push:
branches:
- main
Expand Down
26 changes: 25 additions & 1 deletion .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,32 @@ jobs:
echo "flavor=['green']" >> $GITHUB_OUTPUT
fi

build-toolkit:
permissions:
packages: write
runs-on: ubuntu-latest
env:
ARCH: x86_64
TOOLKIT_REPO: ghcr.io/${{github.repository}}/elemental-cli
steps:
- uses: actions/checkout@v4
- run: |
git fetch --prune --unshallow
- name: Log in to ghcr.io
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build toolkit
run: |
make DOCKER_ARGS=--load build
make DOCKER_ARGS=--push build

build-matrix:
needs: detect
needs:
- detect
- build-toolkit
strategy:
matrix:
flavor: ${{fromJson(needs.detect.outputs.flavor)}}
Expand Down
53 changes: 0 additions & 53 deletions .github/workflows/release.yaml

This file was deleted.

3 changes: 2 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,8 @@ RUN ARCH=$(uname -m); \
xorriso \
cosign \
gptfdisk \
lvm2
lvm2 && \
zypper cc -a

# Copy the built CLI
COPY --from=elemental-bin /usr/bin/elemental /usr/bin/elemental
Expand Down
4 changes: 4 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,10 @@ build:
push-toolkit:
$(DOCKER) push $(TOOLKIT_REPO):$(VERSION)

.PHONY: pull-toolkit
pull-toolkit:
$(DOCKER) pull $(TOOLKIT_REPO):$(VERSION)

.PHONY: build-cli
build-cli:
go build -ldflags '$(LDFLAGS)' -o build/elemental
Expand Down
Loading