From 3e955f75044cc9c5bcc1034431372c69a05af3e6 Mon Sep 17 00:00:00 2001 From: mattkhan <mattkhan@users.noreply.github.com> Date: Mon, 5 Aug 2024 21:26:38 -0700 Subject: [PATCH] Add GitHub action --- .github/workflows/minitest.yml | 47 ++++++++++++++++++++++++++++++++++ 1 file changed, 47 insertions(+) create mode 100644 .github/workflows/minitest.yml diff --git a/.github/workflows/minitest.yml b/.github/workflows/minitest.yml new file mode 100644 index 0000000..4831838 --- /dev/null +++ b/.github/workflows/minitest.yml @@ -0,0 +1,47 @@ +name: Rails Minitest + +on: + push: + branches: + - main + +jobs: + test: + runs-on: ubuntu-latest + + defaults: + run: + working-directory: example + + services: + postgres: + image: postgres + env: + POSTGRES_USER: postgres + POSTGRES_PASSWORD: postgres + ports: + - 5432:5432 + options: + --health-cmd="pg_isready" --health-interval=10s --health-timeout=5s + --health-retries=3 + + steps: + - uses: actions/checkout@v4 + + - name: Set up Ruby + uses: ruby/setup-ruby@v1 + with: + ruby-version: "3.3.2" + bundler-cache: true + working-directory: example + + - name: Install dependencies + run: bundle install + + - name: Set up database + run: | + bin/rails db:create + bin/rails db:schema:load + + - name: Run tests + run: bin/rails test -b