workflow matrix
This commit is contained in:
94
.github/workflows/docker-image.yml
vendored
94
.github/workflows/docker-image.yml
vendored
@@ -10,8 +10,17 @@ env:
|
||||
IMAGE_NAME: ${{ github.repository }}
|
||||
|
||||
jobs:
|
||||
build-amd64:
|
||||
runs-on: ubuntu-latest
|
||||
docker_build:
|
||||
runs-on: ${{ matrix.os }}
|
||||
strategy:
|
||||
matrix:
|
||||
include:
|
||||
- os: ubuntu-latest
|
||||
arch: amd64
|
||||
run_tests: true
|
||||
- os: ubuntu-24.04-arm
|
||||
arch: arm64
|
||||
run_tests: false
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
@@ -20,10 +29,12 @@ jobs:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build and run firegex
|
||||
- name: Build and run firegex (amd64 only)
|
||||
if: matrix.run_tests
|
||||
run: python3 start.py start -P testpassword
|
||||
|
||||
- name: Run tests
|
||||
- name: Run tests (amd64 only)
|
||||
if: matrix.run_tests
|
||||
run: sudo apt-get install -y iperf3 && cd tests && ./run_tests.sh
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
@@ -53,76 +64,21 @@ jobs:
|
||||
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" fgex-lib/setup.py;
|
||||
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" fgex-lib/firegex/__init__.py;
|
||||
|
||||
- name: Build and push AMD64 Docker image
|
||||
- name: Build and push Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
platforms: linux/amd64
|
||||
platforms: linux/${{ matrix.arch }}
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}-amd64
|
||||
tags: ${{ steps.meta.outputs.tags }}-${{ matrix.arch }}
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha,scope=amd64
|
||||
cache-to: type=gha,mode=max,scope=amd64
|
||||
cache-from: type=gha,scope=${{ matrix.arch }}
|
||||
cache-to: type=gha,mode=max,scope=${{ matrix.arch }}
|
||||
|
||||
build-arm64:
|
||||
runs-on: ubuntu-latest-arm64
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
|
||||
steps:
|
||||
- name: Checkout repository
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Build and run firegex
|
||||
run: python3 start.py start -P testpassword
|
||||
|
||||
- name: Run tests
|
||||
run: sudo apt-get install -y iperf3 && cd tests && ./run_tests.sh
|
||||
|
||||
- name: Set up Docker Buildx
|
||||
id: buildx
|
||||
uses: docker/setup-buildx-action@master
|
||||
|
||||
- name: Log in to the Container registry
|
||||
uses: docker/login-action@v3
|
||||
with:
|
||||
registry: ${{ env.REGISTRY }}
|
||||
username: ${{ github.actor }}
|
||||
password: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
- name: Extract metadata (tags, labels) for Docker
|
||||
id: meta
|
||||
uses: docker/metadata-action@v5
|
||||
with:
|
||||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
|
||||
|
||||
- name: Extract tag name
|
||||
id: tag
|
||||
run: echo TAG_NAME=$(echo $GITHUB_REF | cut -d / -f 3) >> $GITHUB_OUTPUT
|
||||
|
||||
- name: Update version in setup.py
|
||||
run: >-
|
||||
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" backend/utils/__init__.py;
|
||||
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" fgex-lib/setup.py;
|
||||
sed -i "s/{{VERSION_PLACEHOLDER}}/${{ steps.tag.outputs.TAG_NAME }}/g" fgex-lib/firegex/__init__.py;
|
||||
|
||||
- name: Build and push ARM64 Docker image
|
||||
uses: docker/build-push-action@v5
|
||||
with:
|
||||
context: .
|
||||
builder: ${{ steps.buildx.outputs.name }}
|
||||
platforms: linux/arm64
|
||||
push: true
|
||||
tags: ${{ steps.meta.outputs.tags }}-arm64
|
||||
labels: ${{ steps.meta.outputs.labels }}
|
||||
cache-from: type=gha,scope=arm64
|
||||
cache-to: type=gha,mode=max,scope=arm64
|
||||
|
||||
create-manifest:
|
||||
docker_manifest:
|
||||
needs: docker_build
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-amd64, build-arm64]
|
||||
permissions:
|
||||
contents: read
|
||||
packages: write
|
||||
@@ -144,14 +100,14 @@ jobs:
|
||||
- name: Create and push multi-platform manifest
|
||||
run: |
|
||||
# Create manifest list
|
||||
docker buildx imagetools create \
|
||||
--tag ${{ steps.meta.outputs.tags }} \
|
||||
docker manifest create ${{ steps.meta.outputs.tags }} \
|
||||
${{ steps.meta.outputs.tags }}-amd64 \
|
||||
${{ steps.meta.outputs.tags }}-arm64
|
||||
docker manifest push ${{ steps.meta.outputs.tags }}
|
||||
|
||||
create-rootfs-assets:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [create-manifest]
|
||||
needs: [docker_manifest]
|
||||
permissions:
|
||||
contents: write
|
||||
packages: read
|
||||
|
||||
Reference in New Issue
Block a user