From f994e559aaa1240dd63753f111dd9ab28cb2d846 Mon Sep 17 00:00:00 2001 From: catatsuy Date: Sun, 4 Feb 2024 17:48:32 +0900 Subject: [PATCH 1/5] add ci.yml --- .github/workflows/ci.yml | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 000000000..41ff2f120 --- /dev/null +++ b/.github/workflows/ci.yml @@ -0,0 +1,29 @@ +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: Initialize the project + run: make init + + - name: Start the server + run: | + cd webapp + docker compose up -d From f23c6d763f78643fed1a630f683fb97f60b4830b Mon Sep 17 00:00:00 2001 From: catatsuy Date: Sun, 4 Feb 2024 17:59:15 +0900 Subject: [PATCH 2/5] bench --- .github/workflows/ci.yml | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 41ff2f120..176302e4d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -20,6 +20,16 @@ jobs: 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 @@ -27,3 +37,9 @@ jobs: run: | cd webapp docker compose up -d + + - name: Run the benchmark + run: | + cd benchmarker + docker build -t private-isu-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 From 55195bdc7b07424c863623f9decc5546eb6f0865 Mon Sep 17 00:00:00 2001 From: catatsuy Date: Sun, 4 Feb 2024 18:06:54 +0900 Subject: [PATCH 3/5] use go --- .github/workflows/ci.yml | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 176302e4d..fd397cb6a 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -33,6 +33,19 @@ jobs: - 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 From 74f0c37fdf8e2cf96e443db54a1ffef135d00831 Mon Sep 17 00:00:00 2001 From: catatsuy Date: Sun, 4 Feb 2024 18:14:20 +0900 Subject: [PATCH 4/5] tmp --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fd397cb6a..0988156f0 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,4 +55,4 @@ jobs: run: | cd benchmarker docker build -t private-isu-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 + # 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 From c50f8e5c2ef8b5cb539ceed689f4eaa4d16e9ec2 Mon Sep 17 00:00:00 2001 From: catatsuy Date: Sun, 4 Feb 2024 18:23:20 +0900 Subject: [PATCH 5/5] tmp --- .github/workflows/ci.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 0988156f0..3a2e20da3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -55,4 +55,3 @@ jobs: run: | cd benchmarker docker build -t private-isu-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