Metrics #192
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: Server CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
jobs: | |
build_test_server: | |
runs-on: ubuntu-latest | |
services: | |
postgres: | |
image: postgres:14 | |
env: | |
POSTGRES_USER: postgres | |
POSTGRES_PASSWORD: password | |
POSTGRES_DB: ivy_learn | |
ports: | |
- 5432:5432 | |
env: | |
IVY_LEARN_DB_HOST: localhost | |
IVY_LEARN_DB_DATABASE: ivy_learn | |
IVY_LEARN_DB_USER: postgres | |
IVY_LEARN_DB_PORT: 5432 | |
IVY_LEARN_DB_PASSWORD: password | |
IVY_LEARN_GITHUB_PAT: ${{ secrets.IVY_LEARN_GITHUB_PAT }} | |
IVY_GOOGLE_OAUTH_CLIENT_ID: ${{ secrets.IVY_GOOGLE_OAUTH_CLIENT_ID }} | |
IVY_GOOGLE_OAUTH_CLIENT_SECRET: ${{ secrets.IVY_GOOGLE_OAUTH_CLIENT_SECRET }} | |
steps: | |
- name: Checkout GIT | |
uses: actions/checkout@v4 | |
- name: Setup Java SDK | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'adopt' | |
java-version: '18' | |
- name: Gradle cache | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Build Server | |
run: ./gradlew stage | |
- name: Start Server | |
run: | | |
chmod +x ./server/build/install/server/bin/server | |
./server/build/install/server/bin/server & | |
sleep 5 | |
- name: Wait for the server to get ready | |
run: | | |
timeout=30 | |
elapsed=0 | |
while ! nc -z localhost 8081; do | |
if [ $elapsed -ge $timeout ]; then | |
echo "Server failed to start within $timeout seconds." | |
exit 1 | |
fi | |
sleep 1 | |
elapsed=$((elapsed + 1)) | |
done | |
- name: Run unit tests | |
run: ./gradlew server:test |