From 69b7299ab1f16bc5db0b4abfa57cca56a376cbb0 Mon Sep 17 00:00:00 2001 From: kmalick Date: Thu, 31 Oct 2024 18:11:24 -0400 Subject: [PATCH] Adding workflow --- .github/workflows/docker-build.yml | 24 ++++++++++++++++++ .github/workflows/ruby-ci.yml | 40 ++++++++++++++++++++++++++++++ 2 files changed, 64 insertions(+) create mode 100644 .github/workflows/docker-build.yml create mode 100644 .github/workflows/ruby-ci.yml diff --git a/.github/workflows/docker-build.yml b/.github/workflows/docker-build.yml new file mode 100644 index 000000000..0d5e6bbf4 --- /dev/null +++ b/.github/workflows/docker-build.yml @@ -0,0 +1,24 @@ +name: Docker Build + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + build: + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v2 + + - name: Build Docker image + uses: docker/build-push-action@v4 + with: + context: . + push: false + tags: expertiza-backend:latest \ No newline at end of file diff --git a/.github/workflows/ruby-ci.yml b/.github/workflows/ruby-ci.yml new file mode 100644 index 000000000..26206bef5 --- /dev/null +++ b/.github/workflows/ruby-ci.yml @@ -0,0 +1,40 @@ +name: Ruby CI + +on: + push: + branches: [ main ] + pull_request: + branches: [ main ] + +jobs: + test: + runs-on: ubuntu-latest + services: + mysql: + image: mysql:8.0 + env: + MYSQL_ROOT_PASSWORD: expertiza + MYSQL_DATABASE: expertiza_test + ports: + - 3306:3306 + options: --health-cmd="mysqladmin ping" --health-interval=10s --health-timeout=5s --health-retries=3 + + steps: + - uses: actions/checkout@v3 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: 3.2.1 + bundler-cache: true + + - name: Install dependencies + run: bundle install + + - name: Set up database + run: | + bundle exec rails db:create + bundle exec rails db:schema:load + + - name: Run tests + run: bundle exec rspec \ No newline at end of file