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

Run CI for Go #441

Merged
merged 1 commit into from
Feb 10, 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
19 changes: 15 additions & 4 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,23 @@
name: CI

on: [push]
on:
pull_request:
paths:
- 'webapp/golang/**'
- 'webapp/ruby/**'
- 'webapp/php/**'
- 'benchmarker/**'
- '.github/workflows/ci.yml'
- 'Makefile'

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

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
Expand Down Expand Up @@ -36,15 +46,16 @@ jobs:
- name: Check for changes in golang directory
id: check-changes
run: |
if git diff --name-only ${{ github.sha }} | grep 'golang/'; then
git fetch origin
if git diff --name-only origin/master...${{ github.sha }} | grep 'golang/'; then
echo "Changes detected in golang directory"
echo "::set-output name=go_changes_detected::true"
echo "go_changes_detected=true" >> $GITHUB_OUTPUT
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
sed -i 's|build: ruby/|build: golang/|' ./webapp/docker-compose.yml

- name: Start the server
run: |
Expand Down