diff --git a/.github/workflows/continuous_integration.yaml b/.github/workflows/continuous_integration.yaml index 1fa0109a..b2976ffd 100644 --- a/.github/workflows/continuous_integration.yaml +++ b/.github/workflows/continuous_integration.yaml @@ -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" diff --git a/Dockerfile b/Dockerfile index 9ccd40bc..7d1889a1 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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