-
Notifications
You must be signed in to change notification settings - Fork 61
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
move unit tests to separate workflow
- Loading branch information
1 parent
38fd2f0
commit a2c8dc3
Showing
1 changed file
with
80 additions
and
0 deletions.
There are no files selected for viewing
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,80 @@ | ||
name: Code Health Report | ||
on: | ||
pull_request: | ||
branches: | ||
- '*' | ||
types: | ||
- opened | ||
- synchronize | ||
- reopened | ||
jobs: | ||
unit_tests: | ||
name: Test | ||
env: | ||
BUNDLE_ENTERPRISE__CONTRIBSYS__COM: ${{ secrets.BUNDLE_ENTERPRISE__CONTRIBSYS__COM }} | ||
CI: true | ||
RAILS_ENV: test | ||
TERM: xterm-256color | ||
DOCKER_BUILDKIT: 1 | ||
COMPOSE_DOCKER_CLI_BUILD: 1 | ||
runs-on: ubuntu-16-cores-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
|
||
- uses: docker/login-action@v3 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USER }} | ||
password: ${{ secrets.DOCKERHUB_PASSWORD }} | ||
|
||
- name: Configure AWS credentials | ||
uses: aws-actions/configure-aws-credentials@v4.0.2 | ||
with: | ||
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
aws-region: us-gov-west-1 | ||
|
||
- name: Login to Amazon ECR | ||
id: ecr-login | ||
uses: aws-actions/amazon-ecr-login@v2.0.1 | ||
with: | ||
mask-password: true | ||
|
||
- name: Setup Environment | ||
run: | | ||
echo "VETS_API_USER_ID=$(id -u)" >> $GITHUB_ENV | ||
- name: Set up Docker Buildx | ||
uses: docker/setup-buildx-action@v3 | ||
|
||
- name: Build Docker Image | ||
uses: docker/build-push-action@v6 | ||
env: | ||
DOCKER_BUILD_SUMMARY: false | ||
with: | ||
build-args: | | ||
BUNDLE_ENTERPRISE__CONTRIBSYS__COM=${{ env.BUNDLE_ENTERPRISE__CONTRIBSYS__COM }} | ||
USER_ID=${{ env.VETS_API_USER_ID }} | ||
context: . | ||
push: false | ||
load: true | ||
tags: vets-api | ||
cache-from: type=gha | ||
cache-to: type=gha,mode=max | ||
|
||
- name: Setup Database | ||
run: | | ||
docker compose -f docker-compose.test.yml run web bash \ | ||
-c "CI=true RAILS_ENV=test DISABLE_BOOTSNAP=true bundle exec parallel_test -n 13 -e 'bin/rails db:reset'" | ||
- name: Run Unit Tests | ||
run: | | ||
docker compose -f docker-compose.test.yml run web bash \ | ||
-c "CI=true DISABLE_BOOTSNAP=true bundle exec parallel_rspec spec/models spec/lib spec/serializers spec/services spec/uploaders spec/sidekiq -n 13 -o '--tag ~type:request --tag ~type:controller --color --tty'" | ||
- name: Simplecov Report | ||
if: success() || failure() | ||
uses: shettytejas/simplecov-reporter@v1 | ||
with: | ||
title: Coverage Report for Unit Tests | ||
result-path: coverage/unit_test_results.json | ||
token: ${{ secrets.GITHUB_TOKEN }} |