Skip to content

Commit

Permalink
Added test stage, updated ci workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
phillmv committed Dec 10, 2023
1 parent a44e218 commit 99b0f36
Show file tree
Hide file tree
Showing 2 changed files with 41 additions and 15 deletions.
49 changes: 34 additions & 15 deletions .github/workflows/continuous_integration.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,40 @@ on:
types: [opened, synchronize, reopened]

jobs:
run_rails_test:
build_and_test:
runs-on: ubuntu-latest
name: "rails test"
steps:
- uses: actions/checkout@v3
- uses: ruby/setup-ruby@v1
- name: Checkout repository
uses: actions/checkout@v4
- name: build image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
bundler-cache: true
- uses: actions/setup-python@v4 # for building node-sass?
- run: |
git config --global user.name "github-actions"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: "bundle"
run: "bundle install && yarn install"
- name: "rake db:setup"
run: "bundle exec rails db:setup"
- name: "test"
run: "bundle exec rails test"
context: .
push: false
load: true
target: test
cache-from: type=gha
cache-to: type=gha,mode=max
tags: arquivo-test:latest
- name: run the test
run: docker run arquivo-test:latest


# run_rails_test:
# runs-on: ubuntu-latest
# name: "rails test"
# steps:
# - uses: actions/checkout@v3
# - uses: ruby/setup-ruby@v1
# with:
# bundler-cache: true
# - uses: actions/setup-python@v4 # for building node-sass?
# - run: |
# git config --global user.name "github-actions"
# git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
# - name: "bundle"
# run: "bundle install && yarn install"
# - name: "rake db:setup"
# run: "bundle exec rails db:setup"
# - name: "test"
# run: "bundle exec rails test"
7 changes: 7 additions & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -152,6 +152,13 @@ CMD ["./bin/rails", "server"]

# } END development stage

# { BEGIN test stage
FROM development as test

CMD ["./bin/rails", "test"]

# } END test stage

# ---------------

# Final stage for app image
Expand Down

0 comments on commit 99b0f36

Please sign in to comment.