Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add ci.yml #433

Merged
merged 5 commits into from
Feb 4, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
name: CI

on: [push]

jobs:
build-and-test:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1

- name: Cache Docker layers
uses: actions/cache@v2
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-

- name: Cache make init results
uses: actions/cache@v2
with:
path: |
webapp/sql/dump.sql
benchmarker/userdata/img
key: ${{ runner.os }}-make-init-${{ hashFiles('Makefile')}}
restore-keys: |
${{ runner.os }}-make-init-

- name: Initialize the project
run: make init

- name: Check for changes in golang directory
id: check-changes
run: |
if git diff --name-only ${{ github.sha }} | grep 'golang/'; then
echo "Changes detected in golang directory"
echo "::set-output name=go_changes_detected::true"
fi

- name: Update compose.yml if changes are detected
if: steps.check-changes.outputs.go_changes_detected == 'true'
run: |
sed -i 's|build: ruby/|build: golang/|' ./webapp/compose.yml

- name: Start the server
run: |
cd webapp
docker compose up -d

- name: Run the benchmark
run: |
cd benchmarker
docker build -t private-isu-benchmarker .
Loading