-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Update checkout action to version v3 - Use new docker layer caching version - Simplify commands to handle docker compose shell commands - Update codecov action
- Loading branch information
Showing
2 changed files
with
48 additions
and
33 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
name: Unit tests | ||
on: push | ||
jobs: | ||
unit-test-job: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout code | ||
uses: actions/checkout@v3 | ||
with: | ||
submodules: recursive | ||
|
||
- name: Pull docker image | ||
run: docker compose pull | ||
working-directory: docker/development | ||
|
||
# In this step, this action saves a list of existing images, | ||
# the cache is created without them in the post run. | ||
# It also restores the cache if it exists. | ||
# https://github.com/jpribyl/action-docker-layer-caching | ||
- uses: jpribyl/[email protected] | ||
continue-on-error: true | ||
|
||
- name: Build docker image | ||
run: docker compose build | ||
working-directory: docker/development | ||
|
||
- name: Create database | ||
working-directory: docker/development | ||
run: | | ||
docker compose exec mampf RAILS_ENV=test rails db:create | ||
docker compose exec mampf RAILS_ENV=test rails db:migrate | ||
docker compose exec mampf RAILS_ENV=test rails db:test:prepare | ||
- name: Reindex sunspot | ||
working-directory: docker/development | ||
run: | | ||
docker compose run mampf RAILS_ENV=test rake sunspot:reindex | ||
- name: Run unit tests | ||
working-directory: docker/development | ||
run: docker compose exec mampf RAILS_ENV=test rails spec | ||
|
||
- name: Send test coverage report to Codecov | ||
uses: codecov/codecov-action@v3 | ||
with: | ||
directory: ./coverage | ||
fail_ci_if_error: true | ||
verbose: true |