Skip to content

Commit

Permalink
Merge branch 'develop' into epic/CV2-4441-articles
Browse files Browse the repository at this point in the history
  • Loading branch information
caiosba committed Jul 20, 2024
2 parents 33e04d7 + 795080b commit 664c292
Show file tree
Hide file tree
Showing 2 changed files with 281 additions and 1 deletion.
281 changes: 281 additions & 0 deletions .github/workflows/ci-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,281 @@
name: Build and Run Tests

on:
schedule:
- cron: '0 5 * * *' #Runs daily at 5 AM UTC
push:
branches:
- master
pull_request:
branches:
- develop

env:
CC_TEST_REPORTER_ID: "${{ secrets.CC_TEST_REPORTER_ID }}"

jobs:
functional-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: eu-west-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: set up enviroments
run: |
export RECORD_RUNTIME=true
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
export LANGUAGE=C.UTF-8
export PATH=/root/.local/bin:$PATH
rm -rf tmp/cache tmp/cache1 tmp/cache2 tmp/cache3 tmp/cache4 tmp/cache5 && mkdir -p tmp/cache tmp/cache1 tmp/cache2 tmp/cache3 tmp/cache4 tmp/cache5
- name: set up comfiguration files
run: |
cp config/config.yml.example config/config.yml
cp config/database.yml.example config/database.yml
cp config/sidekiq.yml.example config/sidekiq.yml
cp config/credentials.json.example config/credentials.json
cp config/sidekiq-test.yml.example config/sidekiq-test.yml
- name: Build Docker Container
run: |
docker-compose build
- name: Run syntax checks
run: |
docker-compose run api bash -c 'touch /tmp/no-syntax-errors && find app lib config -name *.rb -exec bash -c "ruby -c {} >/dev/null || rm /tmp/no-syntax-errors" ";" && ls /tmp/no-syntax-errors'
- name: Run Container
run: docker-compose -f docker-compose.yml -f docker-test.yml up -d

- name: Wait for the server to be ready
run: |
tail -f log/test.log &
until curl --silent -I -f --fail http://localhost:3000 ; do printf .; sleep 1; done
- name: Set up parallel environment
run: docker-compose exec -T api test/setup-parallel-env.sh

- name: Precompile assets
run: docker-compose exec -T api bundle exec rake assets:precompile

- name: Prepare parallel runtime log
run: |
sleep 10
touch tmp/parallel_runtime_test.log
chmod +w tmp/parallel_runtime_test.log
- name: Run Functional Tests
id: run-tests
env:
TEST_RETRY_COUNT: 3
run: |
docker-compose exec -e TEST_RETRY_COUNT=$TEST_RETRY_COUNT -T -e PATTERN='models mailers integration workers lib contract' api test/run-tests.sh
- name: After functional Tests
id: after-functional-tests
env:
GIT_SHA: ${{ github.sha }}
GIT_COMMITED_AT: ${{ github.event.head_commit.timestamp }}
run: |
docker-compose exec -T -e GIT_COMMIT_SHA=${{ github.sha }} \
-e GIT_COMMITTED_AT=${{ github.event.head_commit.timestamp }} \
-e CC_TEST_REPORTER_ID=$CC_TEST_REPORTER_ID \
-e PATH=$PATH \
-e JOB_NAME=functional-tests \
-e AWS_CONFIG_FILE=/app/credentials \
api test/test-coverage.sh

unit-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: eu-west-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: set up enviromnts
run: |
export RECORD_RUNTIME=true
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
export LANGUAGE=C.UTF-8
export PATH=/root/.local/bin:$PATH
rm -rf tmp/cache tmp/cache1 tmp/cache2 tmp/cache3 tmp/cache4 tmp/cache5 && mkdir -p tmp/cache tmp/cache1 tmp/cache2 tmp/cache3 tmp/cache4 tmp/cache5
- name: set up comfiguration files
run: |
cp config/config.yml.example config/config.yml
cp config/database.yml.example config/database.yml
cp config/sidekiq.yml.example config/sidekiq.yml
cp config/credentials.json.example config/credentials.json
cp config/sidekiq-test.yml.example config/sidekiq-test.yml
- name: Build Docker Container
run: |
docker-compose build
- name: Run syntax checks
run: |
docker-compose run api bash -c 'touch /tmp/no-syntax-errors && find app lib config -name *.rb -exec bash -c "ruby -c {} >/dev/null || rm /tmp/no-syntax-errors" ";" && ls /tmp/no-syntax-errors'
- name: Run Container
run: docker-compose -f docker-compose.yml -f docker-test.yml up -d

- name: Wait for the server to be ready
run: |
tail -f log/test.log &
until curl --silent -I -f --fail http://localhost:3000 ; do printf .; sleep 1; done
- name: Set up parallel environment
run: docker-compose exec -T api test/setup-parallel-env.sh

- name: Precompile assets
run: docker-compose exec -T api bundle exec rake assets:precompile

- name: Prepare parallel runtime log
run: |
sleep 10
touch tmp/parallel_runtime_test.log
chmod +w tmp/parallel_runtime_test.log
- name: Run Unit Tests
id: run-tests
env:
TEST_RETRY_COUNT: 3
run: |
docker-compose exec -e TEST_RETRY_COUNT=$TEST_RETRY_COUNT -T -e PATTERN='controllers contract' api test/run-tests.sh
- name: After unit Tests
id: unit-tests
env:
GIT_SHA: ${{ github.sha }}
GIT_COMMITED_AT: ${{ github.event.head_commit.timestamp }}
run: |
docker-compose exec -T -e GIT_COMMIT_SHA=${{ github.sha }} \
-e GIT_COMMITTED_AT=${{ github.event.head_commit.timestamp }} \
-e CC_TEST_REPORTER_ID=$CC_TEST_REPORTER_ID \
-e PATH=$PATH \
-e JOB_NAME=unit-tests \
-e AWS_CONFIG_FILE=/app/credentials \
api test/test-coverage.sh
contract-tests:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
role-to-assume: ${{ secrets.AWS_ROLE_TO_ASSUME }}
aws-region: eu-west-1

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v2

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: set up enviromnts
run: |
export RECORD_RUNTIME=true
export LC_ALL=C.UTF-8
export LANG=C.UTF-8
export LANGUAGE=C.UTF-8
export PATH=/root/.local/bin:$PATH
rm -rf tmp/cache tmp/cache1 tmp/cache2 tmp/cache3 tmp/cache4 tmp/cache5 && mkdir -p tmp/cache tmp/cache1 tmp/cache2 tmp/cache3 tmp/cache4 tmp/cache5
- name: set up comfiguration files
run: |
cp config/config.yml.example config/config.yml
cp config/database.yml.example config/database.yml
cp config/sidekiq.yml.example config/sidekiq.yml
cp config/credentials.json.example config/credentials.json
cp config/sidekiq-test.yml.example config/sidekiq-test.yml
- name: Build Docker Container
run: |
docker-compose build
- name: Run syntax checks
run: |
docker-compose run api bash -c 'touch /tmp/no-syntax-errors && find app lib config -name *.rb -exec bash -c "ruby -c {} >/dev/null || rm /tmp/no-syntax-errors" ";" && ls /tmp/no-syntax-errors'
- name: Run Container
run: docker-compose -f docker-compose.yml -f docker-test.yml up -d

- name: Wait for the server to be ready
run: |
tail -f log/test.log &
until curl --silent -I -f --fail http://localhost:3000 ; do printf .; sleep 1; done
- name: Set up parallel environment
run: docker-compose exec -T api test/setup-parallel-env.sh

- name: Precompile assets
run: docker-compose exec -T api bundle exec rake assets:precompile

- name: Prepare parallel runtime log
run: |
sleep 10
touch tmp/parallel_runtime_test.log
chmod +w tmp/parallel_runtime_test.log
- name: Run Contract Tests
id: run-tests
env:
TEST_RETRY_COUNT: 3
run: |
docker-compose exec -e TEST_RETRY_COUNT=$TEST_RETRY_COUNT -T -e PATTERN='controllers models mailers integration workers lib' api test/run-tests.sh
- name: After contract Tests
id: after-tests
env:
GIT_SHA: ${{ github.sha }}
GIT_COMMITED_AT: ${{ github.event.head_commit.timestamp }}
run: |
docker-compose exec -T -e GIT_COMMIT_SHA=${{ github.sha }} \
-e GIT_COMMITTED_AT=${{ github.event.head_commit.timestamp }} \
-e CC_TEST_REPORTER_ID=$CC_TEST_REPORTER_ID \
-e PATH=$PATH \
-e JOB_NAME=contract-tests \
-e AWS_CONFIG_FILE=/app/credentials \
api test/test-coverage.sh
1 change: 0 additions & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -61,4 +61,3 @@ env:
- secure: lB1eqOWmQVA6seElLmHg9tRzJN8jjDQ4UT6pcROGubk2Ru94gIsJnkFAeCqbp3AyfFWJAHIdCQH1q34krOMfEc+bEQnC5hSjY8PeYbdRnpTx32EDd2bl3ErnUuYq7OyXbHUpono7rzLiUWCjnsGOlz40R7LvN+wIIdP8cUD3F2OezalVSyNwIQPKmwTwIcTQrMcUdeOvlTTZ0BtbNZbHWKd6UZ7RTUOfnPy1un2dS3DAtQIbLM9Q4f4FpsZOqNntFuC8XfC+7wc1u4BA3mjat6iX9J46q2XThlhYqbIG/X79CqIB1lfpnh6Uh9yn4drrmldfnJbhl9w7T8yAF7kt2QzmydH8pnj1X5VcvtaTdMyox2ivCysfpQWkO62i0PbCxqX2+UMy9LHj3Wmis3ydx1flaRxjstykgySOFO9gvx4JOBfS9FjeRyd04YKDn/z9dbVZ9eJ3HYusf8QyPv1ZcaURpVqUszxEjg1bH36gtBC5fMoKF9Mk/SXJY1P6yQ5tRMy0C5A343HQ8xI6rUFomxe2Pk089wP92anphtF0KlF8ZjSEDAPbEXN6qsh+GCszVZQ3YRlQoLGj2fpJI236y28GgbcMmEhlKT2P/AtC78sMQyjGIY2rOH0pVBtYQz1qch2h/6z9tDvSOwI/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