Skip to content

Commit

Permalink
[gh actions] Use self-hosted runners (surrealdb#3072)
Browse files Browse the repository at this point in the history
  • Loading branch information
sgirones authored Dec 5, 2023
1 parent db21caa commit 6f48c6f
Show file tree
Hide file tree
Showing 2 changed files with 34 additions and 7 deletions.
37 changes: 32 additions & 5 deletions .github/workflows/reusable_docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,7 @@ jobs:
build-matrix: ${{ steps.set-matrix.outputs.build-matrix }}
push-matrix: ${{ steps.set-matrix.outputs.push-matrix }}
steps:

- name: Check if AWS credentials are set
id: aws-credentials
run: |
Expand Down Expand Up @@ -77,7 +78,7 @@ jobs:
- name: Binary image
dockerfile: Dockerfile.binary
platform: amd64
runner: ubuntu-latest-4-cores
runner: ["self-hosted", "amd64", "builder"]
tag: amd64-${{ steps.tag-prefix.outputs.tag-prefix }}-binary
########################################
# Base images
Expand All @@ -88,12 +89,12 @@ jobs:
dockerfile: Dockerfile
build-target: prod
platform: amd64
runner: ubuntu-latest-4-cores
runner: ["self-hosted", "amd64", "builder"]
tag: amd64-${{ steps.tag-prefix.outputs.tag-prefix }}
# Prod ARM64 image
- <<: *base_image
platform: arm64
runner: ["self-hosted", "arm64", "4-cores"]
runner: ["self-hosted", "arm64", "builder"]
tag: arm64-${{ steps.tag-prefix.outputs.tag-prefix }}
# Dev AMD64 image
- <<: *base_image
Expand All @@ -103,7 +104,7 @@ jobs:
- <<: *base_image
build-target: dev
platform: arm64
runner: ["self-hosted", "arm64", "4-cores"]
runner: ["self-hosted", "arm64", "builder"]
tag: arm64-${{ steps.tag-prefix.outputs.tag-prefix }}-dev
########################################
Expand All @@ -115,7 +116,7 @@ jobs:
dockerfile: Dockerfile.fdb
build-target: prod
platform: amd64
runner: ubuntu-latest-4-cores
runner: ["self-hosted", "amd64", "builder"]
tag: amd64-${{ steps.tag-prefix.outputs.tag-prefix }}-fdb
# Dev AMD64 image
- <<: *fdb_image
Expand Down Expand Up @@ -188,6 +189,18 @@ jobs:
mv _docker/.dockerignore .
rm -rf _docker
- name: Cleanup
if: ${{ always() }}
run: |
set -x
set +e # Don't fail, do what we can
docker system prune -f
docker image prune -a -f
docker image ls
docker ps -a
df -h
- name: Set up Buildx
uses: docker/setup-buildx-action@v3

Expand Down Expand Up @@ -241,6 +254,20 @@ jobs:
run: |
docker tag ${{ steps.build.outputs.imageid }} ${{ steps.login-ecr.outputs.registry }}/surrealdb-ci:${{ matrix.tag }}-${{ github.run_id }}
docker push ${{ steps.login-ecr.outputs.registry }}/surrealdb-ci:${{ matrix.tag }}-${{ github.run_id }}
- name: Cleanup
if: ${{ always() }}
run: |
set -x
set +e # Don't fail, do what we can
docker system prune -f
docker image rm ${{ steps.build.outputs.imageid }}
docker image rm ${{ steps.login-ecr.outputs.registry }}/surrealdb-ci:${{ matrix.tag }}-${{ github.run_id }}
docker system prune -f
docker image ls
docker ps -a
df -h
# Push a multi-arch manifest to the CI registry
push-all-to-ecr-ci:
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/reusable_publish_version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -176,7 +176,7 @@ jobs:
# Linux amd64
- arch: x86_64-unknown-linux-gnu
runner: ubuntu-latest-16-cores
runner: ["self-hosted", "amd64", "builder"]
file: surreal-${{ needs.prepare-vars.outputs.name }}.linux-amd64
build-step: |
# Build
Expand All @@ -196,7 +196,7 @@ jobs:
# Linux arm64
- arch: aarch64-unknown-linux-gnu
runner: ["self-hosted", "arm64", "4-cores"]
runner: ["self-hosted", "arm64", "builder"]
file: surreal-${{ needs.prepare-vars.outputs.name }}.linux-arm64
build-step: |
# Build
Expand Down

0 comments on commit 6f48c6f

Please sign in to comment.