Skip to content
This repository was archived by the owner on Oct 29, 2025. It is now read-only.

Commit d3ccbd4

Browse files
authored
add test workflow for arm runner
1 parent 56260c6 commit d3ccbd4

2 files changed

Lines changed: 200 additions & 1 deletion

File tree

Lines changed: 199 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,199 @@
1+
# This is a basic workflow to help you get started with Actions
2+
3+
name: Build and push ARM image to DockerHub (testing)
4+
5+
# Controls when the workflow will run
6+
on:
7+
push:
8+
branches:
9+
- 'main'
10+
tags:
11+
- 'v*'
12+
# update on run of Update Calendso nightly submodule update
13+
workflow_run:
14+
workflows: ["Update Calendso"]
15+
branches: [main]
16+
types:
17+
- completed
18+
# Allow running workflow manually from the Actions tab
19+
workflow_dispatch:
20+
# Uncomment below to allow specific version workflow run
21+
# inputs:
22+
# version:
23+
# description: 'Version to build'
24+
# required: true
25+
26+
# Leaving in example for releases. Initially we simply push to 'latest'
27+
# on:
28+
# release:
29+
# types: [ created ]
30+
31+
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
32+
jobs:
33+
# This workflow contains a single job called "build"
34+
build:
35+
# The type of runner that the job will run on
36+
runs-on: ubuntu-24.04-arm
37+
38+
# Steps represent a sequence of tasks that will be executed as part of the job
39+
steps:
40+
# - name: Free Disk Space (Ubuntu)
41+
# uses: jlumbroso/free-disk-space@main
42+
# with:
43+
# # Free about 4.5 GB, elminating our disk space issues
44+
# tool-cache: true
45+
46+
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it, uncomment below
47+
# - name: Checkout code at specified version
48+
# uses: actions/checkout@v2
49+
# with:
50+
# ref: ${{ github.event.inputs.version }}
51+
52+
- name: checkout
53+
uses: actions/checkout@v4
54+
55+
- name: Git submodule update
56+
run: |
57+
git submodule update --init
58+
59+
- name: Log in to the Docker Hub registry
60+
uses: docker/login-action@v3
61+
with:
62+
# Username used to log against the Docker registry
63+
username: ${{ secrets.DOCKER_HUB_USERNAME }}
64+
# Password or personal access token used to log against the Docker registry
65+
password: ${{ secrets.DOCKER_HUB_TOKEN }}
66+
# Log out from the Docker registry at the end of a job
67+
logout: true # optional, default is true
68+
69+
- name: Log in to the Github Container registry
70+
uses: docker/login-action@v3
71+
with:
72+
registry: ghcr.io
73+
username: ${{ github.actor }}
74+
password: ${{ secrets.GITHUB_TOKEN }}
75+
76+
- name: Docker meta
77+
id: meta
78+
uses: docker/metadata-action@v5
79+
with:
80+
images: |
81+
docker.io/calendso/calendso
82+
docker.io/calcom/cal.com
83+
ghcr.io/calcom/cal.com
84+
# Add flavor latest only on full releases, not on pre-releases
85+
flavor: |
86+
latest=${{ !github.event.release.prerelease }}
87+
88+
- name: Copy env
89+
run: |
90+
grep -o '^[^#]*' .env.example > .env
91+
cat .env >> $GITHUB_ENV
92+
echo "DATABASE_HOST=localhost:5432" >> $GITHUB_ENV
93+
eval $(sed -e '/^#/d' -e 's/^/export /' -e 's/$/;/' .env) ;
94+
95+
# Temporarily disable ARM build due to runner performance issues
96+
# - name: Set up QEMU
97+
# uses: docker/setup-qemu-action@v2
98+
99+
- name: Start database
100+
run: |
101+
docker compose up -d database
102+
103+
- name: Set up Docker Buildx
104+
uses: docker/setup-buildx-action@v3
105+
with:
106+
driver-opts: |
107+
network=container:database
108+
buildkitd-flags: |
109+
--allow-insecure-entitlement security.insecure --allow-insecure-entitlement network.host
110+
# config-inline: |
111+
# [worker.oci]
112+
# max-parallelism = 1
113+
114+
- name: Build image
115+
id: docker_build
116+
uses: docker/build-push-action@v6
117+
with:
118+
context: ./
119+
file: ./Dockerfile
120+
load: true # Load the image into the Docker daemon
121+
push: false # Do not push the image at this stage
122+
platforms: arm64
123+
tags: ${{ steps.meta.outputs.tags }}
124+
labels: ${{ steps.meta.outputs.labels }}
125+
build-args: |
126+
NEXT_PUBLIC_WEBAPP_URL=${{ env.NEXT_PUBLIC_WEBAPP_URL }}
127+
NEXT_PUBLIC_API_V2_URL=${{ env.NEXT_PUBLIC_API_V2_URL }}
128+
NEXT_PUBLIC_LICENSE_CONSENT=${{ env.NEXT_PUBLIC_LICENSE_CONSENT }}
129+
NEXT_PUBLIC_TELEMETRY_KEY=${{ env.NEXT_PUBLIC_TELEMETRY_KEY }}
130+
DATABASE_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.DATABASE_HOST }}/${{ env.POSTGRES_DB }}
131+
DATABASE_DIRECT_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.DATABASE_HOST }}/${{ env.POSTGRES_DB }}
132+
133+
- name: Test runtime
134+
run: |
135+
tags="${{ steps.meta.outputs.tags }}"
136+
IFS=',' read -ra ADDR <<< "$tags" # Convert string to array using ',' as delimiter
137+
tag=${ADDR[0]} # Get the first tag
138+
139+
docker run --rm --network stack \
140+
-p 3000:3000 \
141+
-e DATABASE_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@database/${{ env.POSTGRES_DB }} \
142+
-e DATABASE_DIRECT_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@database/${{ env.POSTGRES_DB }} \
143+
-e NEXTAUTH_SECRET=${{ env.NEXTAUTH_SECRET }} \
144+
-e CALENDSO_ENCRYPTION_KEY=${{ env.CALENDSO_ENCRYPTION_KEY }} \
145+
$tag &
146+
147+
server_pid=$!
148+
149+
150+
echo "Waiting for the server to start..."
151+
sleep 120
152+
153+
echo ${{ env.NEXT_PUBLIC_WEBAPP_URL }}/auth/login
154+
155+
for i in {1..60}; do
156+
echo "Checking server health ($i/60)..."
157+
response=$(curl -o /dev/null -s -w "%{http_code}" ${{ env.NEXT_PUBLIC_WEBAPP_URL }}/auth/login)
158+
echo "HTTP Status Code: $response"
159+
if [[ "$response" == "200" ]] || [[ "$response" == "307" ]]; then
160+
echo "Server is healthy"
161+
# Now, shutdown the server
162+
kill $server_pid
163+
exit 0
164+
fi
165+
sleep 1
166+
done
167+
168+
echo "Server health check failed"
169+
kill $server_pid
170+
exit 1
171+
env:
172+
NEXTAUTH_SECRET: 'EI4qqDpcfdvf4A+0aQEEx8JjHxHSy4uWiZw/F32K+pA='
173+
CALENDSO_ENCRYPTION_KEY: '0zfLtY99wjeLnsM7qsa8xsT+Q0oSgnOL'
174+
175+
# - name: Push image
176+
# id: docker_push
177+
# uses: docker/build-push-action@v6
178+
# with:
179+
# context: ./
180+
# file: ./Dockerfile
181+
# push: true
182+
# platforms: linux/amd64
183+
# tags: ${{ steps.meta.outputs.tags }}
184+
# labels: ${{ steps.meta.outputs.labels }}
185+
# build-args: |
186+
# NEXT_PUBLIC_WEBAPP_URL=${{ env.NEXT_PUBLIC_WEBAPP_URL }}
187+
# NEXT_PUBLIC_API_V2_URL=${{ env.NEXT_PUBLIC_API_V2_URL }}
188+
# NEXT_PUBLIC_LICENSE_CONSENT=${{ env.NEXT_PUBLIC_LICENSE_CONSENT }}
189+
# NEXT_PUBLIC_TELEMETRY_KEY=${{ env.NEXT_PUBLIC_TELEMETRY_KEY }}
190+
# DATABASE_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.DATABASE_HOST }}/${{ env.POSTGRES_DB }}
191+
# DATABASE_DIRECT_URL=postgresql://${{ env.POSTGRES_USER }}:${{ env.POSTGRES_PASSWORD }}@${{ env.DATABASE_HOST }}/${{ env.POSTGRES_DB }}
192+
# if: ${{ !github.event.release.prerelease }}
193+
194+
- name: Image digest
195+
run: echo ${{ steps.docker_build.outputs.digest }}
196+
197+
- name: Cleanup
198+
run: |
199+
docker compose down

Dockerfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
FROM node:18 AS builder
1+
FROM --platform=$BUILDPLATFORM node:18 AS builder
22

33
WORKDIR /calcom
44

0 commit comments

Comments
 (0)