Skip to content

Commit

Permalink
Use docker compose for github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
Earlopain committed Oct 7, 2023
1 parent b2430b6 commit 3d32dcb
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/prepare-docker-image/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,5 +15,5 @@ runs:
tags: reverser:test

- name: Set docker run command
run: echo "DOCKER_RUN=docker run --rm --network host -e POSTGRES_HOST=localhost -e EXPOSED_VNC_PORT=123 -e RAILS_ENV=test -e CI=true -v $PWD:/app reverser:test" >> "$GITHUB_ENV"
run: echo "DOCKER_RUN=docker compose run --rm -e RAILS_ENV=test -e CI=true" >> "$GITHUB_ENV"
shell: bash
22 changes: 3 additions & 19 deletions .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,31 +30,15 @@ jobs:
runs-on: ubuntu-latest
needs: docker-build

services:
postgres:
image: postgres:15-alpine
env:
POSTGRES_USER: reverser
POSTGRES_DB: reverser_test
POSTGRES_HOST_AUTH_METHOD: trust
ports:
- 5432:5432
options: >-
--mount type=tmpfs,destination=/var/lib/postgresql/data
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- uses: actions/checkout@v4
- uses: ./.github/prepare-docker-image

- name: Create DB
run: $DOCKER_RUN bin/rails db:schema:load
run: $DOCKER_RUN reverser bin/rails db:schema:load

- name: Run Tests
run: $DOCKER_RUN bundle exec rails test
run: $DOCKER_RUN tests

rubocop:
runs-on: ubuntu-latest
Expand All @@ -65,7 +49,7 @@ jobs:
- uses: ./.github/prepare-docker-image

- name: Run Rubocop
run: $DOCKER_RUN bundle exec rubocop --format github
run: $DOCKER_RUN rubocop --format github

yamllint:
runs-on: ubuntu-latest
Expand Down

0 comments on commit 3d32dcb

Please sign in to comment.