Skip to content

Commit

Permalink
Cv2-5632 migrate check ci (#99)
Browse files Browse the repository at this point in the history
migrate check ci 

---------
  • Loading branch information
chinelo-obitube authored Nov 14, 2024
1 parent 7764ce0 commit 1cdd82c
Show file tree
Hide file tree
Showing 8 changed files with 89 additions and 49 deletions.
75 changes: 75 additions & 0 deletions .github/workflows/ci-test.yaml
Original file line number Diff line number Diff line change
@@ -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/[email protected]:/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
32 changes: 0 additions & 32 deletions .travis.yml

This file was deleted.

4 changes: 2 additions & 2 deletions bin/first-build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
12 changes: 6 additions & 6 deletions bin/localtunnel.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 &
Expand All @@ -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
Expand Down
12 changes: 6 additions & 6 deletions bin/update-l10n.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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) && \
Expand Down
1 change: 0 additions & 1 deletion docker-compose.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "2.1"
volumes:
elasticsearch:
postgres:
Expand Down
1 change: 0 additions & 1 deletion docker-test.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "2.1"
networks:
default:
name: dev
Expand Down
1 change: 0 additions & 1 deletion docker-upgradedb.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "2.1"
volumes:
postgres:
postgres11:
Expand Down

0 comments on commit 1cdd82c

Please sign in to comment.