diff --git a/.github/workflows/ci-test.yaml b/.github/workflows/ci-test.yaml new file mode 100644 index 0000000..09f6109 --- /dev/null +++ b/.github/workflows/ci-test.yaml @@ -0,0 +1,75 @@ +name: Build and Run Check Tests + +on: + schedule: + - cron: '0 4 * * *' #Runs daily at 4 AM UTC + push: + branches: + - master + - develop + + pull_request: + branches: + - develop + +permissions: + id-token: write + contents: read + +jobs: + check-script: + runs-on: + labels: check + steps: + - uses: actions/checkout@v4 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: ${{ secrets.AWS_OIDC_ROLE_TO_ASSUME }} + aws-region: eu-west-1 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + + - name: Before script + env: + GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} + GITHUB_JOB_NAME: ${{ github.job }} + run: | + sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules + git submodule update --init --recursive + sed -i '/git submodule/d' bin/first-build.sh + sed -i 's/--abort-on-container-exit/-d/' bin/first-build.sh + TAB=$'\t' + export FALLBACK_BRANCH=$([ "$GITHUB_BRANCH" == "master" ] && echo "main" && echo "master" || echo "develop") + git submodule foreach 'bash -c "git checkout master ; git checkout develop ; git checkout $FALLBACK_BRANCH ; git checkout $GITHUB_BRANCH ; exit 0"' + git submodule foreach git rev-parse --abbrev-ref HEAD + + - name: Run Script + env: + GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} + GITHUB_JOB_NAME: ${{ github.job }} + run: | + ./bin/first-build.sh + until curl --silent -I -f --fail http://localhost:3333 ; do printf .; sleep 1; done + sleep 240 + if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:3200)!= "200" )); then exit 1; fi; + if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:3100)!= "200" )); then exit 1; fi; + if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/ping)!= "200" )); then exit 1; fi; + if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:3333)!= "200" )); then exit 1; fi; + if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000)!= "200" )); then exit 1; fi; + docker ps --format '{{.Image}}' | sort >> docker_up_output.txt + diff <(grep -v 'moby/buildkit:buildx-stable-1' docker_up_output.txt) test/image_names.txt + + - name: Cleanup Docker Resources + if: always() + run: | + echo "Running post-job cleanup..." + docker stop $(docker ps -q) || true + docker rm $(docker ps -aq) || true + docker rmi $(docker images -q) || true + docker volume rm $(docker volume ls -q) || true diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 836c4fd..0000000 --- a/.travis.yml +++ /dev/null @@ -1,32 +0,0 @@ -dist: jammy -git: - submodules: false -before_script: - - sed -i 's/git@github.com:/https:\/\/github.com\//' .gitmodules - - git submodule update --init --recursive - - sed -i '/git submodule/d' bin/first-build.sh - - sed -i 's/--abort-on-container-exit/-d/' bin/first-build.sh - - TAB=$'\t' - # For each submodule, go to a branch with the same name as this branch - - export FALLBACK_BRANCH=$([ "$TRAVIS_BRANCH" == "master" ] && echo "main" && echo "master" || echo "develop") - - git submodule foreach 'bash -c "git checkout master ; git checkout develop ; git checkout $FALLBACK_BRANCH ; git checkout $TRAVIS_BRANCH ; exit 0"' - - git submodule foreach git rev-parse --abbrev-ref HEAD - - echo "$DOCKER_PASSWORD" | docker login -u "$DOCKER_USERNAME" --password-stdin -script: - - ./bin/first-build.sh - - until curl --silent -I -f --fail http://localhost:3333 ; do printf .; sleep 1; done - - sleep 240 - - if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:3200)!= "200" )); then exit 1; fi; # Pender - - if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:3100)!= "200" )); then exit 1; fi; # Alegre - - if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/ping)!= "200" )); then exit 1; fi; # Presto - - if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:3333)!= "200" )); then exit 1; fi; # Check Web - - if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000)!= "200" )); then exit 1; fi; # Check API - - docker ps --format '{{.Image}}' | sort >> docker_up_output.txt - - diff docker_up_output.txt test/image_names.txt -notifications: - slack: - secure: liY9HT9EJU3jlqt4mHnMgAkIxv38WtpJgGukZ+ZZ7tiVHR9NIK+Ca0zRBcFD0iFDR8XXXQi2D69zjhUFDpmilTm5IcO6gv74Tha3kVEPAZEOCoOqTHFaqKqdYs+i+ewfy1x3Wg8ZEeDBYoVY8THPoLzufix281L3dhg+gu4YTNGq7lOfYs7BkulxJQHiAjrjjI9f2kTSqMUPldlQJK9EKMqc6QUiEEiX+lj7hJSY2fCw5GM0rrf5OQ+98ihZfn+kng2glBelyfuPQMl91cWC1BakhbinujfxcTLuq+DpQD2n1NE/omoTKCMMp4BX3iEZjUlolg/pgUuVTt7LaSVHtLmLJlsuzMNutbIxDA2Y4iv822l2ag+PWDuVD2Peh0imeid+hwpAOkaHWLLT5Uw2vhYUWcEY1FoSbWLax/6cMRAxzD15gU4I3qD9q11ZFtN/KoGirV6H4ZNHVdXSiirZCBi0yY2rSd7pvEgPws6ptOMn3q24vHOr2qfpbgMJ2MW1FSU1xgRVTlf9W/Khx+YvNZlPWFe9dre5ft/9v5DlcyBUSZiWh3ZlSsUDu+Ju0ji9jsd/RwPOTZK4pWZHH+LJ5uIuYdSHQGiAvoaQFf80tA+upJdVi0M2+g8Mw7NiKzgfNrlyWr9O7eYp+AeYuziXVV/h2nZardOFacwd0bNNdLI= -env: - global: - - secure: Xr/jfoqd4M8AxGAWMKH3OWPMTLm77ZaclKSFSz3n6tR57ZwN+WyxF+gh49eLYk96BREnBx5OMqI8jm4f3xXJ2ROUKi16LyxPu0ZZE0X4RbwDBos3DRLErdAolL793qkgvobtUA53R/u6LkQOuGL7156TV3PwVBqfQuVSlP22nhvMrGRVqXWIcw60PrxmCok05tWJVV7ktSWt2dwhMgRPLqhEleWMOld/k0QACq/w9EipDrDAYMFuprvsgjfnp5aljL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6o6d1N1AVURi/8ehe9o7KFeAEK/Zs41lE= \ No newline at end of file diff --git a/bin/first-build.sh b/bin/first-build.sh index 81c0809..ce7ebce 100755 --- a/bin/first-build.sh +++ b/bin/first-build.sh @@ -18,5 +18,5 @@ replace_secret 'check-api' 'config/config.yml' 'google_client_id' replace_secret 'check-api' 'config/config.yml' 'google_client_secret' # Build & Run -docker-compose build -docker-compose up --abort-on-container-exit +docker compose build +docker compose up --abort-on-container-exit diff --git a/bin/localtunnel.sh b/bin/localtunnel.sh index 1b049f7..0a79a13 100755 --- a/bin/localtunnel.sh +++ b/bin/localtunnel.sh @@ -4,9 +4,9 @@ RETVAL=0 localtunnel_on() { configurator/do.sh deploy localtunnel - docker-compose exec api touch tmp/restart.txt - docker-compose exec pender touch tmp/restart.txt - docker-compose exec web cp config.js build/web/js + docker compose exec api touch tmp/restart.txt + docker compose exec pender touch tmp/restart.txt + docker compose exec web cp config.js build/web/js lt --port 3000 --subdomain check-api & lt --port 3333 --subdomain check-web & lt --port 3200 --subdomain pender & @@ -15,9 +15,9 @@ localtunnel_on() { localtunnel_off() { pkill -f subdomain configurator/do.sh deploy local - docker-compose exec api touch tmp/restart.txt - docker-compose exec pender touch tmp/restart.txt - docker-compose exec web cp config.js build/web/js + docker compose exec api touch tmp/restart.txt + docker compose exec pender touch tmp/restart.txt + docker compose exec web cp config.js build/web/js } case "$1" in diff --git a/bin/update-l10n.sh b/bin/update-l10n.sh index 9961444..d99bb46 100755 --- a/bin/update-l10n.sh +++ b/bin/update-l10n.sh @@ -5,16 +5,16 @@ cd check-web && git checkout develop && git pull && cd - && \ # cd check-search && git checkout develop && git pull && cd - && \ echo 'Updating Check API translations...' && \ -(docker-compose exec api /tx push) && \ -(docker-compose exec api /tx pull) && \ +(docker compose exec api /tx push) && \ +(docker compose exec api /tx pull) && \ # FIXME: Configure check-tiplines resource pulling # (docker-compose exec api bundle exec rake transifex:download_tipline) && \ echo 'Updating Check Web translations...' && \ -(docker-compose exec web npm run transifex:merge-source) && \ -(docker-compose exec web /tx push) && \ -(docker-compose exec web /tx pull) && \ -(docker-compose exec web npm run transifex:merge-translated) && \ +(docker compose exec web npm run transifex:merge-source) && \ +(docker compose exec web /tx push) && \ +(docker compose exec web /tx pull) && \ +(docker compose exec web npm run transifex:merge-translated) && \ # echo 'Updating Check Mark translations...' && \ # (docker-compose exec mark npm run transifex:upload) && \ diff --git a/docker-compose.yml b/docker-compose.yml index 8ca946d..8354ca1 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -1,4 +1,3 @@ -version: "2.1" volumes: elasticsearch: postgres: diff --git a/docker-test.yml b/docker-test.yml index dbb4c1b..69b4e92 100644 --- a/docker-test.yml +++ b/docker-test.yml @@ -1,4 +1,3 @@ -version: "2.1" networks: default: name: dev diff --git a/docker-upgradedb.yml b/docker-upgradedb.yml index 94e8f5e..70f9f8e 100644 --- a/docker-upgradedb.yml +++ b/docker-upgradedb.yml @@ -1,4 +1,3 @@ -version: "2.1" volumes: postgres: postgres11: