ci: change oracle-aarch64-4cpu-16gb to longhorn-infra-arm64-runners #34
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: build | |
on: | |
push: | |
branches: | |
- master | |
- v* | |
tags: | |
- v* | |
pull_request: | |
jobs: | |
build-amd64-binaries: | |
name: Build AMD64 binaries | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
# Build binaries | |
- name: Run make ci | |
run: make ci | |
- uses: codecov/codecov-action@v4 | |
with: | |
files: ./coverage.out | |
flags: unittests | |
token: ${{ secrets.CODECOV_TOKEN }} | |
- name: Upload binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries_amd64_artifact | |
path: ./bin/* | |
build-arm64-binaries: | |
name: Build ARM64 binaries | |
runs-on: longhorn-infra-arm64-runners | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install make curl git | |
run: | | |
sudo apt update | |
sudo apt-get -y install make curl git | |
# Build binaries | |
- name: Run make ci | |
run: sudo make ci | |
- name: Upload binaries | |
uses: actions/upload-artifact@v4 | |
with: | |
name: binaries_arm64_artifact | |
path: ./bin/* | |
build-push-amd64-images: | |
name: Build and push AMD64 images | |
runs-on: ubuntu-latest | |
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }} | |
needs: build-amd64-binaries | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Declare branch | |
run: | | |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_ENV" | |
- name: Download binaries | |
uses: actions/download-artifact@v4 | |
with: | |
name: binaries_amd64_artifact | |
path: ./bin/ | |
- name: Add executable permission | |
run: | | |
chmod +x ./bin/* | |
- name: Copy bin folder to package | |
run: | | |
cp -r ./bin ./package/ | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# longhornio/longhorn-instance-manager image | |
- name: docker-publish-longhorn-instance-manager | |
if: ${{ startsWith(github.ref, 'refs/heads/') }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64 | |
tags: longhornio/longhorn-instance-manager:${{ env.branch }}-head-amd64 | |
file: package/Dockerfile | |
build-args: | | |
ARCH=amd64 | |
- name: docker-publish-longhorn-instance-manager-with-tag | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
platforms: linux/amd64 | |
tags: longhornio/longhorn-instance-manager:${{ github.ref_name }}-amd64 | |
file: package/Dockerfile | |
build-args: | | |
ARCH=amd64 | |
build-push-arm64-images: | |
name: Build and push ARM64 images | |
runs-on: longhorn-infra-arm64-runners | |
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }} | |
needs: build-arm64-binaries | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Install make | |
run: | | |
sudo apt update | |
sudo apt-get -y install make curl | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Declare branch and sha_short | |
run: | | |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_ENV" | |
- name: Download binaries | |
uses: actions/download-artifact@v4 | |
with: | |
name: binaries_arm64_artifact | |
path: ./bin/ | |
- name: Add executable permission | |
run: | | |
chmod +x ./bin/* | |
- name: Copy bin folder to package | |
run: | | |
cp -r ./bin ./package/ | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# longhornio/longhorn-instance-manager image | |
- name: docker-publish-longhorn-instance-manager | |
if: ${{ startsWith(github.ref, 'refs/heads/') }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
platforms: linux/arm64 | |
tags: longhornio/longhorn-instance-manager:${{ env.branch }}-head-arm64 | |
file: package/Dockerfile | |
build-args: | | |
ARCH=arm64 | |
- name: docker-publish-longhorn-instance-manager-with-tag | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
uses: docker/build-push-action@v5 | |
with: | |
context: . | |
push: true | |
platforms: linux/arm64 | |
tags: longhornio/longhorn-instance-manager:${{ github.ref_name }}-arm64 | |
file: package/Dockerfile | |
build-args: | | |
ARCH=arm64 | |
manifest-image: | |
name: Manifest images | |
runs-on: ubuntu-latest | |
needs: [build-push-amd64-images, build-push-arm64-images] | |
if: ${{ startsWith(github.ref, 'refs/heads/') || startsWith(github.ref, 'refs/tags/') }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Declare branch and sha_short | |
run: | | |
echo "branch=${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}}" >> "$GITHUB_ENV" | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3 | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3 | |
with: | |
username: ${{ secrets.DOCKER_USERNAME }} | |
password: ${{ secrets.DOCKER_PASSWORD }} | |
# longhornio/longhorn-instance-manager image | |
- name: docker-pull-longhorn-instance-manager | |
if: ${{ startsWith(github.ref, 'refs/heads/') }} | |
run: | | |
docker pull --platform linux/amd64 longhornio/longhorn-instance-manager:${{ env.branch }}-head-amd64 | |
docker pull --platform linux/arm64 longhornio/longhorn-instance-manager:${{ env.branch }}-head-arm64 | |
docker buildx imagetools create -t longhornio/longhorn-instance-manager:${{ env.branch }}-head \ | |
longhornio/longhorn-instance-manager:${{ env.branch }}-head-amd64 \ | |
longhornio/longhorn-instance-manager:${{ env.branch }}-head-arm64 | |
- name: docker-pull-longhorn-instance-manager-with-tag | |
if: ${{ startsWith(github.ref, 'refs/tags/') }} | |
run: | | |
docker pull --platform linux/amd64 longhornio/longhorn-instance-manager:${{ github.ref_name }}-amd64 | |
docker pull --platform linux/arm64 longhornio/longhorn-instance-manager:${{ github.ref_name }}-arm64 | |
docker buildx imagetools create -t longhornio/longhorn-instance-manager:${{ github.ref_name }} \ | |
longhornio/longhorn-instance-manager:${{ github.ref_name }}-amd64 \ | |
longhornio/longhorn-instance-manager:${{ github.ref_name }}-arm64 |