Skip to content

Run CI for Go

Run CI for Go #34

Workflow file for this run

name: CI
on:
push:
paths:
- 'webapp/golang/**'
- 'webapp/ruby/**'
- 'webapp/php/**'
- 'benchmarker/**'
- 'Makefile'
pull_request:
paths:
- 'webapp/golang/**'
- 'webapp/ruby/**'
- 'webapp/php/**'
- 'benchmarker/**'
- 'Makefile'
jobs:
build-and-test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ github.sha }}
restore-keys: |
${{ runner.os }}-buildx-
- name: Cache make init results
uses: actions/cache@v4
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
if: contains(github.event.pull_request.changed_files, 'webapp/golang/'))

Check failure on line 51 in .github/workflows/ci.yml

View workflow run for this annotation

GitHub Actions / CI

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yml (Line: 51, Col: 11): Unexpected symbol: ')'. Located at position 68 within expression: contains(github.event.pull_request.changed_files, 'webapp/golang/'))
run: |
sed -i 's|build: ruby/|build: golang/|' ./webapp/docker-compose.yml
- name: Start the server
run: |
cd webapp
docker compose up -d
- name: Build the benchmark
run: |
cd benchmarker
docker build -t private-isu-benchmarker .
- name: Wait for data initialization to complete
run: |
cd webapp
until docker compose exec -T mysql mysql -uroot -proot -e "SELECT 1 FROM posts LIMIT 1;" isuconp; do
echo "Waiting for database initialization..."
sleep 10
done
until docker compose exec -T mysql mysql -uroot -proot -e "SELECT 1 FROM users LIMIT 1;" isuconp; do
echo "Waiting for database initialization..."
sleep 10
done
until docker compose exec -T mysql mysql -uroot -proot -e "SELECT 1 FROM comments LIMIT 1;" isuconp; do
echo "Waiting for database initialization..."
sleep 10
done
sleep 10
- name: Run the benchmark
continue-on-error: true
run: |
cd benchmarker
docker run --network host --add-host host.docker.internal:host-gateway -i private-isu-benchmarker /opt/go/bin/benchmarker -t http://host.docker.internal -u /opt/go/userdata
- name: Show logs
run: |
cd webapp
docker compose logs