Update Ruby version to 3.4, add bigdecimal gem in Gemfile and lockfile. #108
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: CI | |
on: | |
pull_request: | |
paths: | |
- "webapp/go/**" | |
- "webapp/ruby/**" | |
- "bench/**" | |
- "cmd/**" | |
- "initial-data/**" | |
- ".github/workflows/ci.yml" | |
- "Makefile" | |
- "go.mod" | |
- "go.sum" | |
- "compose.yml" | |
- "webapp/compose.yml" | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
jobs: | |
build-and-test: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Initialize the project | |
run: make init | |
- name: Check for changes in ruby directory | |
id: check-changes | |
run: | | |
git fetch origin | |
if git diff --name-only origin/master...${{ github.sha }} | grep 'ruby/'; then | |
echo "Changes detected in ruby directory" | |
echo "ruby_changes_detected=true" >> $GITHUB_OUTPUT | |
fi | |
- name: Download purl | |
run: | | |
curl -sL https://github.com/catatsuy/purl/releases/latest/download/purl-linux-amd64.tar.gz | tar xz -C /tmp | |
- name: Move files to /usr/local/bin for purl | |
run: | | |
sudo mv /tmp/purl /usr/local/bin/ | |
- name: Update compose.yml if changes are detected | |
if: steps.check-changes.outputs.ruby_changes_detected == 'true' | |
run: | | |
purl -overwrite -replace '@dockerfile: go/@dockerfile: ruby/@' ./webapp/compose.yml | |
- name: Start the server | |
run: | | |
cd webapp | |
docker compose up --build -d | |
- name: Build the benchmark | |
run: | | |
docker build -t isucari-benchmarker -f bench/Dockerfile . | |
- name: Wait for data initialization to complete | |
run: | | |
cd webapp | |
until docker compose exec -T mysql mysql -uroot -proot -e "SELECT 1 FROM users LIMIT 1;" isucari; do | |
echo "Waiting for database initialization..." | |
sleep 10 | |
done | |
until docker compose exec -T mysql mysql -uroot -proot -e "SELECT 1 FROM items LIMIT 1;" isucari; do | |
echo "Waiting for database initialization..." | |
sleep 10 | |
done | |
until docker compose exec -T mysql mysql -uroot -proot -e "SELECT 1 FROM transaction_evidences LIMIT 1;" isucari; do | |
echo "Waiting for database initialization..." | |
sleep 10 | |
done | |
until docker compose exec -T mysql mysql -uroot -proot -e "SELECT 1 FROM shippings LIMIT 1;" isucari; do | |
echo "Waiting for database initialization..." | |
sleep 10 | |
done | |
until docker compose exec -T mysql mysql -uroot -proot -e "SELECT 1 FROM categories LIMIT 1;" isucari; do | |
echo "Waiting for database initialization..." | |
sleep 10 | |
done | |
sleep 10 | |
- name: Run the benchmark | |
continue-on-error: true | |
run: | | |
docker container run --add-host host.docker.internal:host-gateway -p 5678:5678 -p 7890:7890 -i isucari-benchmarker /bin/benchmarker -target-url http://host.docker.internal -data-dir /initial-data -static-dir /static -payment-url http://host.docker.internal:5678 -payment-port 5678 -shipment-url http://host.docker.internal:7890 -shipment-port 7890 | tee benchmark_output.json || echo "BENCHMARK_FAILED=true" >> $GITHUB_ENV | |
- name: Show logs | |
run: | | |
cd webapp | |
docker compose logs | |
- name: Check benchmark result | |
run: | | |
if [ ! -f benchmark_output.json ]; then | |
echo "benchmark_output.json not found" | |
exit 1 | |
fi | |
if ! jq -e '.pass == true' benchmark_output.json > /dev/null; then | |
echo "BENCHMARK_FAILED=true" >> $GITHUB_ENV | |
exit 1 | |
fi | |
- name: Fail if benchmark failed | |
if: env.BENCHMARK_FAILED == 'true' | |
run: | | |
echo "Benchmark failed" | |
exit 1 |