Skip to content

Commit

Permalink
Rewrite Release WF to use ARM runner
Browse files Browse the repository at this point in the history
  • Loading branch information
amansinghoriginal committed Feb 28, 2025
1 parent c1fa804 commit cc07aee
Showing 1 changed file with 70 additions and 43 deletions.
113 changes: 70 additions & 43 deletions .github/workflows/draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,9 +51,10 @@ jobs:
permissions:
packages: write
contents: read
runs-on: ubuntu-latest
strategy:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: [ubuntu-latest, ubuntu-24.04-arm]
component: [
{
label: 'Query Host',
Expand All @@ -78,9 +79,6 @@ jobs:
submodules: true
token: ${{ secrets.DRASI_CORE_PAT }}

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
with:
Expand All @@ -92,30 +90,41 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Determine platform
id: platform
run: |
if [[ "${{ matrix.runner }}" == "ubuntu-latest" ]]; then
echo "platform=linux/amd64" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.runner }}" == "ubuntu-24.04-arm" ]]; then
echo "platform=linux/arm64" >> $GITHUB_OUTPUT
fi
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: buildx-${{ matrix.component.name }}
key: buildx-${{ matrix.component.name }}-${{ matrix.runner }}
restore-keys: |
buildx-${{ matrix.component.name }}
buildx-${{ matrix.component.name }}-${{ matrix.runner }}
- name: Build and Push to GHCR
run: |
cd ${{ matrix.component.path }}
DOCKER_TAG_VERSION=${{ inputs.tag }} \
IMAGE_PREFIX=${{ inputs.image_prefix }} \
DOCKERX_OPTS="--push --platform linux/amd64,linux/arm64 --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" \
make
DOCKERX_OPTS="--push --platform ${{ steps.platform.outputs.platform }} --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" \
make
build-control-plane:
runs-on: ubuntu-latest
needs: validate
permissions:
packages: write
contents: read
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: [ubuntu-latest, ubuntu-24.04-arm]
component: [
{
label: 'Management API',
Expand All @@ -132,9 +141,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
with:
Expand All @@ -146,32 +152,41 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}


- name: Determine platform
id: platform
run: |
if [[ "${{ matrix.runner }}" == "ubuntu-latest" ]]; then
echo "platform=linux/amd64" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.runner }}" == "ubuntu-24.04-arm" ]]; then
echo "platform=linux/arm64" >> $GITHUB_OUTPUT
fi
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: buildx-${{ matrix.component.name }}
key: buildx-${{ matrix.component.name }}-${{ matrix.runner }}
restore-keys: |
buildx-${{ matrix.component.name }}
buildx-${{ matrix.component.name }}-${{ matrix.runner }}
- name: Build and Push to GHCR
run: |
cd ${{ matrix.component.path }}
DOCKER_TAG_VERSION=${{ inputs.tag }} \
IMAGE_PREFIX=${{ inputs.image_prefix }} \
DOCKERX_OPTS="--push --platform linux/amd64,linux/arm64 --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" \
DOCKERX_OPTS="--push --platform ${{ steps.platform.outputs.platform }} --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" \
make
build-sources:
runs-on: ubuntu-latest
needs: validate
permissions:
packages: write
contents: read
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: [ubuntu-latest, ubuntu-24.04-arm]
component: [
{
label: 'Change Router',
Expand All @@ -198,7 +213,6 @@ jobs:
path: 'sources/relational/sql-proxy',
name: 'source-sql-proxy'
},

{
label: 'CosmosDB Reactivator',
path: './sources/cosmosdb/cosmosdb-ffcf-reactivator',
Expand Down Expand Up @@ -240,14 +254,10 @@ jobs:
name: 'source-kubernetes-proxy'
}
]

steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
with:
Expand All @@ -260,30 +270,40 @@ jobs:
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}

- name: Determine platform
id: platform
run: |
if [[ "${{ matrix.runner }}" == "ubuntu-latest" ]]; then
echo "platform=linux/amd64" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.runner }}" == "ubuntu-24.04-arm" ]]; then
echo "platform=linux/arm64" >> $GITHUB_OUTPUT
fi
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: buildx-${{ matrix.component.name }}
key: buildx-${{ matrix.component.name }}-${{ matrix.runner }}
restore-keys: |
buildx-${{ matrix.component.name }}
buildx-${{ matrix.component.name }}-${{ matrix.runner }}
- name: Build and Push to GHCR
run: |
cd ${{ matrix.component.path }}
DOCKER_TAG_VERSION=${{ inputs.tag }} \
IMAGE_PREFIX=${{ inputs.image_prefix }} \
DOCKERX_OPTS="--push --platform linux/amd64,linux/arm64 --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" \
DOCKERX_OPTS="--push --platform ${{ steps.platform.outputs.platform }} --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" \
make
build-reactions:
needs: validate
permissions:
packages: write
contents: read
runs-on: ubuntu-latest
runs-on: ${{ matrix.runner }}
strategy:
matrix:
runner: [ubuntu-latest, ubuntu-24.04-arm]
component: [
{
label: 'SignalR',
Expand Down Expand Up @@ -344,9 +364,6 @@ jobs:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Set up QEMU
uses: docker/setup-qemu-action@49b3bc8e6bdd4a60e6116a5414239cba5943d3cf # v3.2.0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@988b5a0280414f521da01fcc63a27aeeb4b104db # v3.6.1
with:
Expand All @@ -358,21 +375,31 @@ jobs:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.GITHUB_TOKEN }}


- name: Determine platform
id: platform
run: |
if [[ "${{ matrix.runner }}" == "ubuntu-latest" ]]; then
echo "platform=linux/amd64" >> $GITHUB_OUTPUT
elif [[ "${{ matrix.runner }}" == "ubuntu-24.04-arm" ]]; then
echo "platform=linux/arm64" >> $GITHUB_OUTPUT
fi
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: buildx-${{ matrix.component.name }}
key: buildx-${{ matrix.component.name }}-${{ matrix.runner }}
restore-keys: |
buildx-${{ matrix.component.name }}
buildx-${{ matrix.component.name }}-${{ matrix.runner }}
- name: Build and Push to GHCR
if: contains(matrix.component.platforms, steps.platform.outputs.platform)
run: |
cd ${{ matrix.component.path }}
DOCKER_TAG_VERSION=${{ inputs.tag }} \
IMAGE_PREFIX=${{ inputs.image_prefix }} \
DOCKERX_OPTS="--push --platform ${{ matrix.component.platforms }} --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" \
DOCKERX_OPTS="--push --platform ${{ steps.platform.outputs.platform }} --cache-to type=local,dest=/tmp/.buildx-cache,mode=max --cache-from type=local,src=/tmp/.buildx-cache" \
make
build-cli:
Expand Down Expand Up @@ -436,7 +463,7 @@ jobs:
run: |
mkdir -p ${{ env.RELEASE_PATH}}/cli/${{ matrix.os }}-${{ matrix.arch }}/
cp -r ${{ matrix.os }}-${{ matrix.arch }}/drasi ${{ env.RELEASE_PATH}}/drasi-${{ matrix.os }}-${{ matrix.arch }}
- name: Copy cli binaries to release (non-windows)
- name: Copy cli binaries to release (windows)
if: matrix.os == 'windows'
run: |
mkdir -p ${{ env.RELEASE_PATH}}/cli/${{ matrix.os }}-${{ matrix.arch }}/
Expand Down Expand Up @@ -473,7 +500,7 @@ jobs:
with:
name: drasi_vscode_extension
path: ${{ env.RELEASE_PATH}}

release:
permissions:
contents: write
Expand All @@ -483,17 +510,17 @@ jobs:
name: Draft Release
needs:
- validate
- build-sources
- build-query-container
- build-reactions
- build-control-plane
- package-cli
- build-sources
- build-reactions
- package-cli
- vscode-extension
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 # v4.1.7

- name: Download CLI release
uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
Expand All @@ -510,4 +537,4 @@ jobs:

- name: Draft Release
run: |
gh release create ${{ inputs.tag }} ${{ env.RELEASE_PATH }}/* --draft --title ${{ inputs.tag }} --target ${{ github.ref_name }} --generate-notes
gh release create ${{ inputs.tag }} ${{ env.RELEASE_PATH }}/* --draft --title ${{ inputs.tag }} --target ${{ github.ref_name }} --generate-notes

0 comments on commit cc07aee

Please sign in to comment.