"Choose an existing article" should search all articles, not just rel… #952
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
name: Build and Run Tests | |
on: | |
schedule: | |
- cron: '0 7 * * *' #Runs daily at 7 AM UTC | |
push: | |
branches: | |
- '**' | |
pull_request: | |
branches: | |
- develop | |
env: | |
GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} | |
GITHUB_JOB_NAME: ${{ github.job }} | |
GITHUB_COMMIT_MESSAGE: ${{ github.event.head_commit.message }} | |
AWS_ENDPOINT: ${{ secrets.AWS_ENDPOINT }} | |
AWS_REGION: eu-west-1 | |
jobs: | |
media-similarity-tests: | |
runs-on: | |
labels: check-web | |
if: > | |
github.ref == 'refs/heads/develop' || | |
github.ref == 'refs/heads/master' || | |
contains(github.event.head_commit.message, '[full ci]') || | |
contains(github.event.head_commit.message, '[media similarity tests]') | |
steps: | |
- name: Set permissions for _work directory | |
run: | | |
sudo chown -R $USER:$USER $GITHUB_WORKSPACE | |
sudo chmod 755 $GITHUB_WORKSPACE | |
- 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: Decrypt credentials for Alegre | |
env: | |
DECRYPTION_PASSWORD: ${{ secrets.DECRYPTION_PASSWORD }} | |
run: | | |
openssl enc -aes-256-cbc -d -in test/google_credentials.json.enc -out test/google_credentials.json -k $DECRYPTION_PASSWORD | |
- name: Setup UTF-8 Capable locale | |
run: | | |
export LC_ALL=C.UTF-8 | |
export LANG=C.UTF-8 | |
export LANGUAGE=C.UTF-8 | |
- name: Ngrok | |
env: | |
NGROK_AUTH: ${{ secrets.NGROK_AUTH }} | |
run: | | |
export GITHUB_TAG=0.0.0 | |
curl -s https://ngrok-agent.s3.amazonaws.com/ngrok.asc | sudo tee /etc/apt/trusted.gpg.d/ngrok.asc >/dev/null && echo "deb https://ngrok-agent.s3.amazonaws.com buster main" | sudo tee /etc/apt/sources.list.d/ngrok.list && sudo apt-get update && sudo apt-get install ngrok | |
- name: Setup Pender | |
run: | | |
export PENDER_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/pender.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'develop') | |
echo "Using branch $PENDER_BRANCH for Pender" | |
git clone --branch=$PENDER_BRANCH https://github.com/meedan/pender.git | |
cd pender | |
cp config/config.yml.example config/config.yml | |
cp config/database.yml.example config/database.yml | |
cp config/sidekiq.yml.example config/sidekiq.yml | |
cd - | |
- name: Setup Check API | |
run: | | |
export CHECK_API_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/check-api.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'develop') | |
echo "Using branch $CHECK_API_BRANCH for Check API" | |
git clone --branch=$CHECK_API_BRANCH https://github.com/meedan/check-api.git | |
cd check-api | |
cp config/config.yml.example config/config.yml | |
cp config/database.yml.example config/database.yml | |
cp config/sidekiq.yml.example config/sidekiq.yml | |
cd - | |
- name: Setup Alegre | |
run: | | |
export ALEGRE_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/alegre.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'develop') | |
echo "Using branch $ALEGRE_BRANCH for Alegre" | |
git clone --branch=$ALEGRE_BRANCH https://github.com/meedan/alegre.git | |
cd alegre | |
cp .env_file.test .env_file | |
cp ../test/google_credentials.json google_credentials.json | |
cd - | |
- name: Setup Presto | |
run: | | |
export PRESTO_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/presto.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'master') | |
echo "Using branch $PRESTO_BRANCH for Presto" | |
git clone --branch=$PRESTO_BRANCH https://github.com/meedan/presto.git | |
cd presto | |
cp .env_file.test .env_file | |
cp ../test/google_credentials.json google_credentials.json | |
cd - | |
- name: Setup Configuration Files | |
run: | | |
cp config.js.example config.js | |
cp config.js.example test/config.js | |
cp config-build.js.example config-build.js | |
cp config-server.js.example config-server.js | |
cp test/config.yml.example test/config.yml | |
- name: Before Script | |
env: | |
MAX_WEB_CURL: 3000 | |
WEB_CURL_COUNT: 0 | |
NGROK_AUTH: ${{ secrets.NGROK_AUTH }} | |
run: | | |
GITHUB_JOB_NAME=$GITHUB_JOB_NAME GITHUB_BRANCH=$GITHUB_BRANCH ./build.sh | |
MAX_WEB_CURL=$MAX_WEB_CURL; | |
WEB_CURL_COUNT=$WEB_CURL_COUNT; until curl --silent -I -f --fail http://localhost:3333 || (("$WEB_CURL_COUNT" == "$MAX_WEB_CURL")); do printf .; sleep 1; WEB_CURL_COUNT=$((++WEB_CURL_COUNT)); done; if [ "$WEB_CURL_COUNT" == "$MAX_WEB_CURL" ]; then echo "Terminating job after $WEB_CURL_COUNT curl attempts to check-web"; exit 1; fi | |
docker ps | |
- name: Run linter | |
run: | | |
docker compose exec web npm run linter | |
docker compose exec web npm run test:integration:lint | |
- name: Run media similarity test | |
env: | |
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }} | |
run: | | |
docker ps | |
docker compose exec web service nginx start | |
docker compose -f docker-compose.yml -f docker-test.yml exec chromedriver service nginx start | |
docker compose exec -T \ | |
-e IMGUR_CLIENT_ID=$IMGUR_CLIENT_ID \ | |
-e GITHUB_JOB_NAME=$GITHUB_JOB_NAME \ | |
-e GITHUB_BRANCH=$GITHUB_BRANCH \ | |
-e AWS_ENDPOINT=${{ secrets.AWS_ENDPOINT }} \ | |
-e AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \ | |
-e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \ | |
-e ROLE_TO_ASSUME=${{ secrets.AWS_ROLE_TO_ASSUME }} \ | |
-e AWS_REGION=eu-west-1 \ | |
-e TEST_RETRY_COUNT=3 \ | |
web npm run tests | |
- name: After media similarity tests | |
run: | | |
docker compose exec web bash -c "[ -f test/file.json ] && python -m json.tool test/file.json || echo 'File does not exist'" | |
size=$(du -k build/web/js/index.bundle.js | cut -f1) && size2=$(du -k build/web/js/vendor.bundle.js | cut -f1) && totalsize=$((size+size2)) && echo "Your bundle size is $totalsize kb" | |
kill -9 $(pgrep ngrok) | |
- name: Cleanup Docker Resources | |
if: always() | |
run: | | |
echo "Cleaning up Docker resources..." | |
docker stop $(docker ps -q) | |
docker rm $(docker ps -aq) | |
docker rmi $(docker images -q) | |
docker volume rm $(docker volume ls -q) | |
text-similarity-tests: | |
needs: [media-similarity-tests] | |
runs-on: | |
labels: check-web | |
if: > | |
success() || | |
github.ref == 'refs/heads/develop' || | |
github.ref == 'refs/heads/master' || | |
contains(github.event.head_commit.message, '[text similarity tests]') | |
steps: | |
- name: Set permissions for _work directory | |
run: | | |
sudo chown -R $USER:$USER $GITHUB_WORKSPACE | |
sudo chmod 755 $GITHUB_WORKSPACE | |
- 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: Decrypt credentials for Alegre | |
env: | |
DECRYPTION_PASSWORD: ${{ secrets.DECRYPTION_PASSWORD }} | |
run: | | |
openssl enc -aes-256-cbc -d -in test/google_credentials.json.enc -out test/google_credentials.json -k $DECRYPTION_PASSWORD | |
- name: Setup UTF-8 Capable locale | |
run: | | |
export LC_ALL=C.UTF-8 | |
export LANG=C.UTF-8 | |
export LANGUAGE=C.UTF-8 | |
- name: Setup Pender | |
run: | | |
export PENDER_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/pender.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'develop') | |
echo "Using branch $PENDER_BRANCH for Pender" | |
git clone --branch=$PENDER_BRANCH https://github.com/meedan/pender.git | |
cd pender | |
cp config/config.yml.example config/config.yml | |
cp config/database.yml.example config/database.yml | |
cp config/sidekiq.yml.example config/sidekiq.yml | |
cd - | |
- name: Setup Check API | |
run: | | |
export CHECK_API_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/check-api.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'develop') | |
echo "Using branch $CHECK_API_BRANCH for Check API" | |
git clone --branch=$CHECK_API_BRANCH https://github.com/meedan/check-api.git | |
cd check-api | |
cp config/config.yml.example config/config.yml | |
cp config/database.yml.example config/database.yml | |
cp config/sidekiq.yml.example config/sidekiq.yml | |
cd - | |
- name: Setup Alegre | |
run: | | |
export ALEGRE_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/alegre.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'develop') | |
echo "Using branch $ALEGRE_BRANCH for Alegre" | |
git clone --branch=$ALEGRE_BRANCH https://github.com/meedan/alegre.git | |
cd alegre | |
cp .env_file.test .env_file | |
cp ../test/google_credentials.json google_credentials.json | |
cd - | |
- name: Setup Presto | |
run: | | |
export PRESTO_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/presto.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'master') | |
echo "Using branch $PRESTO_BRANCH for Presto" | |
git clone --branch=$PRESTO_BRANCH https://github.com/meedan/presto.git | |
cd presto | |
cp .env_file.test .env_file | |
cp ../test/google_credentials.json google_credentials.json | |
cd - | |
- name: Setup Configuration Files | |
run: | | |
cp config.js.example config.js | |
cp config.js.example test/config.js | |
cp config-build.js.example config-build.js | |
cp config-server.js.example config-server.js | |
cp test/config.yml.example test/config.yml | |
- name: Before Script | |
env: | |
MAX_WEB_CURL: 3000 | |
WEB_CURL_COUNT: 0 | |
NGROK_AUTH: ${{ secrets.NGROK_AUTH }} | |
run: | | |
GITHUB_JOB_NAME=$GITHUB_JOB_NAME GITHUB_BRANCH=$GITHUB_BRANCH ./build.sh | |
MAX_WEB_CURL=$MAX_WEB_CURL; | |
WEB_CURL_COUNT=$WEB_CURL_COUNT; until curl --silent -I -f --fail http://localhost:3333 || (("$WEB_CURL_COUNT" == "$MAX_WEB_CURL")); do printf .; sleep 1; WEB_CURL_COUNT=$((++WEB_CURL_COUNT)); done; if [ "$WEB_CURL_COUNT" == "$MAX_WEB_CURL" ]; then echo "Terminating job after $WEB_CURL_COUNT curl attempts to check-web"; exit 1; fi | |
docker ps | |
- name: Run linter | |
run: | | |
docker compose exec web npm run linter | |
docker compose exec web npm run test:integration:lint | |
- name: Run text similarity test | |
env: | |
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }} | |
run: | | |
docker ps | |
docker compose exec web service nginx start | |
docker compose -f docker-compose.yml -f docker-test.yml exec chromedriver service nginx start | |
docker compose exec -T \ | |
-e IMGUR_CLIENT_ID=$IMGUR_CLIENT_ID \ | |
-e GITHUB_JOB_NAME=$GITHUB_JOB_NAME \ | |
-e GITHUB_BRANCH=$GITHUB_BRANCH \ | |
-e AWS_ENDPOINT=${{ secrets.AWS_ENDPOINT }} \ | |
-e AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \ | |
-e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \ | |
-e ROLE_TO_ASSUME=${{ secrets.AWS_ROLE_TO_ASSUME }} \ | |
-e AWS_REGION=eu-west-1 \ | |
-e TEST_RETRY_COUNT=3 \ | |
web npm run tests | |
- name: After text similarity tests | |
run: | | |
docker compose exec web bash -c "[ -f test/file.json ] && python -m json.tool test/file.json || echo 'File does not exist'" | |
size=$(du -k build/web/js/index.bundle.js | cut -f1) && size2=$(du -k build/web/js/vendor.bundle.js | cut -f1) && totalsize=$((size+size2)) && echo "Your bundle size is $totalsize kb" | |
- name: Cleanup Docker Resources | |
if: always() | |
run: | | |
echo "Cleaning up Docker resources..." | |
docker stop $(docker ps -q) | |
docker rm $(docker ps -aq) | |
docker rmi $(docker images -q) | |
docker volume rm $(docker volume ls -q) | |
integration-and-unit-tests: | |
runs-on: ubuntu-latest | |
if: > | |
github.ref == 'refs/heads/develop' || | |
github.ref == 'refs/heads/master' || | |
contains(github.event.head_commit.message, '[full ci]') || | |
contains(github.event.head_commit.message, '[smoke tests]') | |
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: Decrypt credentials for Alegre | |
env: | |
DECRYPTION_PASSWORD: ${{ secrets.DECRYPTION_PASSWORD }} | |
run: | | |
openssl enc -aes-256-cbc -d -in test/google_credentials.json.enc -out test/google_credentials.json -k $DECRYPTION_PASSWORD | |
- name: Setup UTF-8 Capable locale | |
run: | | |
export LC_ALL=C.UTF-8 | |
export LANG=C.UTF-8 | |
export LANGUAGE=C.UTF-8 | |
- name: Setup Pender | |
run: | | |
export PENDER_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/pender.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'develop') | |
echo "Using branch $PENDER_BRANCH for Pender" | |
git clone --branch=$PENDER_BRANCH https://github.com/meedan/pender.git | |
cd pender | |
cp config/config.yml.example config/config.yml | |
cp config/database.yml.example config/database.yml | |
cp config/sidekiq.yml.example config/sidekiq.yml | |
cd - | |
- name: Setup Check API | |
run: | | |
export CHECK_API_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/check-api.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'develop') | |
echo "Using branch $CHECK_API_BRANCH for Check API" | |
git clone --branch=$CHECK_API_BRANCH https://github.com/meedan/check-api.git | |
cd check-api | |
cp config/config.yml.example config/config.yml | |
cp config/database.yml.example config/database.yml | |
cp config/sidekiq.yml.example config/sidekiq.yml | |
cd - | |
- name: Setup Alegre | |
run: | | |
export ALEGRE_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/alegre.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'develop') | |
echo "Using branch $ALEGRE_BRANCH for Alegre" | |
git clone --branch=$ALEGRE_BRANCH https://github.com/meedan/alegre.git | |
cd alegre | |
cp .env_file.test .env_file | |
cp ../test/google_credentials.json google_credentials.json | |
cd - | |
- name: Setup Presto | |
run: | | |
export PRESTO_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/presto.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'master') | |
echo "Using branch $PRESTO_BRANCH for Presto" | |
git clone --branch=$PRESTO_BRANCH https://github.com/meedan/presto.git | |
cd presto | |
cp .env_file.test .env_file | |
cp ../test/google_credentials.json google_credentials.json | |
cd - | |
- name: Setup Configuration Files | |
run: | | |
cp config.js.example config.js | |
cp config.js.example test/config.js | |
cp config-build.js.example config-build.js | |
cp config-server.js.example config-server.js | |
cp test/config.yml.example test/config.yml | |
- name: Before Script | |
env: | |
MAX_WEB_CURL: 3000 | |
WEB_CURL_COUNT: 0 | |
run: | | |
GITHUB_JOB_NAME=$GITHUB_JOB_NAME GITHUB_BRANCH=$GITHUB_BRANCH ./build.sh | |
MAX_WEB_CURL=$MAX_WEB_CURL; | |
WEB_CURL_COUNT=$WEB_CURL_COUNT; until curl --silent -I -f --fail http://localhost:3333 || (("$WEB_CURL_COUNT" == "$MAX_WEB_CURL")); do printf .; sleep 1; WEB_CURL_COUNT=$((++WEB_CURL_COUNT)); done; if [ "$WEB_CURL_COUNT" == "$MAX_WEB_CURL" ]; then echo "Terminating job after $WEB_CURL_COUNT curl attempts to check-web"; exit 1; fi | |
docker ps | |
- name: Run linter | |
run: | | |
docker compose exec web npm run linter | |
docker compose exec web npm run test:integration:lint | |
- name: Run Integration test | |
env: | |
IMGUR_CLIENT_ID: ${{ secrets.IMGUR_CLIENT_ID }} | |
run: | | |
docker ps | |
docker compose exec web service nginx start | |
docker compose -f docker-compose.yml -f docker-test.yml exec chromedriver service nginx start | |
docker compose exec -T \ | |
-e IMGUR_CLIENT_ID=$IMGUR_CLIENT_ID \ | |
-e GITHUB_JOB_NAME=$GITHUB_JOB_NAME \ | |
-e GITHUB_BRANCH=$GITHUB_BRANCH \ | |
-e AWS_ENDPOINT=${{ secrets.AWS_ENDPOINT }} \ | |
-e AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }} \ | |
-e AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_SECRET_ACCESS_KEY }} \ | |
-e ROLE_TO_ASSUME=${{ secrets.AWS_ROLE_TO_ASSUME }} \ | |
-e AWS_REGION=eu-west-1 \ | |
-e TEST_RETRY_COUNT=3 \ | |
web npm run tests | |
- name: After integration tests | |
run: | | |
docker compose exec web bash -c "[ -f test/file.json ] && python -m json.tool test/file.json || echo 'File does not exist'" | |
size=$(du -k build/web/js/index.bundle.js | cut -f1) && size2=$(du -k build/web/js/vendor.bundle.js | cut -f1) && totalsize=$((size+size2)) && echo "Your bundle size is $totalsize kb" | |
unit-tests: | |
runs-on: ubuntu-latest | |
if: > | |
github.ref != 'refs/heads/develop' && | |
github.ref != 'refs/heads/master' && | |
!contains(github.event.head_commit.message, '[full ci]') && | |
!contains(github.event.head_commit.message, '[smoke tests]') && | |
!contains(github.event.head_commit.message, '[media similarity tests]') && | |
!contains(github.event.head_commit.message, '[text similarity tests]') | |
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: Decrypt credentials for Alegre | |
env: | |
DECRYPTION_PASSWORD: ${{ secrets.DECRYPTION_PASSWORD }} | |
run: | | |
openssl enc -aes-256-cbc -d -in test/google_credentials.json.enc -out test/google_credentials.json -k $DECRYPTION_PASSWORD | |
- name: Setup UTF-8 Capable locale | |
run: | | |
export LC_ALL=C.UTF-8 | |
export LANG=C.UTF-8 | |
export LANGUAGE=C.UTF-8 | |
- name: Setup Pender | |
env: | |
GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} | |
run: | | |
export PENDER_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/pender.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'develop') | |
echo "Using branch $PENDER_BRANCH for Pender" | |
git clone --branch=$PENDER_BRANCH https://github.com/meedan/pender.git | |
cd pender | |
cp config/config.yml.example config/config.yml | |
cp config/database.yml.example config/database.yml | |
cp config/sidekiq.yml.example config/sidekiq.yml | |
cd - | |
- name: Setup Check API | |
run: | | |
export CHECK_API_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/check-api.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'develop') | |
echo "Using branch $CHECK_API_BRANCH for Check API" | |
git clone --branch=$CHECK_API_BRANCH https://github.com/meedan/check-api.git | |
cd check-api | |
cp config/config.yml.example config/config.yml | |
cp config/database.yml.example config/database.yml | |
cp config/sidekiq.yml.example config/sidekiq.yml | |
cd - | |
- name: Setup Alegre | |
run: | | |
export ALEGRE_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/alegre.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'develop') | |
echo "Using branch $ALEGRE_BRANCH for Alegre" | |
git clone --branch=$ALEGRE_BRANCH https://github.com/meedan/alegre.git | |
cd alegre | |
cp .env_file.test .env_file | |
cp ../test/google_credentials.json google_credentials.json | |
cd - | |
- name: Setup Presto | |
run: | | |
export PRESTO_BRANCH=$((git ls-remote --exit-code --heads https://github.com/meedan/presto.git $GITHUB_BRANCH >/dev/null && echo $GITHUB_BRANCH) || echo 'master') | |
echo "Using branch $PRESTO_BRANCH for Presto" | |
git clone --branch=$PRESTO_BRANCH https://github.com/meedan/presto.git | |
cd presto | |
cp .env_file.test .env_file | |
cp ../test/google_credentials.json google_credentials.json | |
cd - | |
- name: Setup Configuration Files | |
run: | | |
cp config.js.example config.js | |
cp config.js.example test/config.js | |
cp config-build.js.example config-build.js | |
cp config-server.js.example config-server.js | |
cp test/config.yml.example test/config.yml | |
- name: Before Script | |
env: | |
MAX_WEB_CURL: 3000 | |
WEB_CURL_COUNT: 0 | |
run: | | |
gitHUB_JOB_NAME=$GITHUB_JOB_NAME GITHUB_BRANCH=$GITHUB_BRANCH ./build.sh | |
MAX_WEB_CURL=$MAX_WEB_CURL; | |
WEB_CURL_COUNT=$WEB_CURL_COUNT; until curl --silent -I -f --fail http://localhost:3333 || (("$WEB_CURL_COUNT" == "$MAX_WEB_CURL")); do printf .; sleep 1; WEB_CURL_COUNT=$((++WEB_CURL_COUNT)); done; if [ "$WEB_CURL_COUNT" == "$MAX_WEB_CURL" ]; then echo "Terminating job after $WEB_CURL_COUNT curl attempts to check-web"; exit 1; fi | |
docker ps | |
- name: Run linter | |
run: | | |
docker compose exec web npm run linter | |
docker compose exec web npm run test:integration:lint | |
- name: Run Unit Tests | |
run: | | |
docker compose exec -T -e GITHUB_JOB_NAME=$GITHUB_JOB_NAME web npm run tests |