|
| 1 | +name: Build and Run Check Tests |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 4 * * *' #Runs daily at 4 AM UTC |
| 6 | + push: |
| 7 | + branches: |
| 8 | + - master |
| 9 | + - develop |
| 10 | + |
| 11 | + pull_request: |
| 12 | + branches: |
| 13 | + - develop |
| 14 | + |
| 15 | +permissions: |
| 16 | + id-token: write |
| 17 | + contents: read |
| 18 | + |
| 19 | +jobs: |
| 20 | + check-script: |
| 21 | + runs-on: |
| 22 | + labels: check |
| 23 | + steps: |
| 24 | + - uses: actions/checkout@v4 |
| 25 | + |
| 26 | + - name: Configure AWS Credentials |
| 27 | + uses: aws-actions/configure-aws-credentials@v4 |
| 28 | + with: |
| 29 | + role-to-assume: ${{ secrets.AWS_OIDC_ROLE_TO_ASSUME }} |
| 30 | + aws-region: eu-west-1 |
| 31 | + |
| 32 | + - name: Set up QEMU |
| 33 | + uses: docker/setup-qemu-action@v3 |
| 34 | + |
| 35 | + - name: Set up Docker Buildx |
| 36 | + uses: docker/setup-buildx-action@v3 |
| 37 | + |
| 38 | + - name: Before script |
| 39 | + env: |
| 40 | + GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} |
| 41 | + GITHUB_JOB_NAME: ${{ github.job }} |
| 42 | + run: | |
| 43 | + sed -i 's/[email protected]:/https:\/\/github.com\//' .gitmodules |
| 44 | + git submodule update --init --recursive |
| 45 | + sed -i '/git submodule/d' bin/first-build.sh |
| 46 | + sed -i 's/--abort-on-container-exit/-d/' bin/first-build.sh |
| 47 | + TAB=$'\t' |
| 48 | + export FALLBACK_BRANCH=$([ "$GITHUB_BRANCH" == "master" ] && echo "main" && echo "master" || echo "develop") |
| 49 | + git submodule foreach 'bash -c "git checkout master ; git checkout develop ; git checkout $FALLBACK_BRANCH ; git checkout $GITHUB_BRANCH ; exit 0"' |
| 50 | + git submodule foreach git rev-parse --abbrev-ref HEAD |
| 51 | + |
| 52 | + - name: Run Script |
| 53 | + env: |
| 54 | + GITHUB_BRANCH: ${{ github.head_ref || github.ref_name }} |
| 55 | + GITHUB_JOB_NAME: ${{ github.job }} |
| 56 | + run: | |
| 57 | + ./bin/first-build.sh |
| 58 | + until curl --silent -I -f --fail http://localhost:3333 ; do printf .; sleep 1; done |
| 59 | + sleep 240 |
| 60 | + if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:3200)!= "200" )); then exit 1; fi; |
| 61 | + if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:3100)!= "200" )); then exit 1; fi; |
| 62 | + if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:8000/ping)!= "200" )); then exit 1; fi; |
| 63 | + if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:3333)!= "200" )); then exit 1; fi; |
| 64 | + if (( $(curl -s -o /dev/null -w "%{http_code}" http://localhost:3000)!= "200" )); then exit 1; fi; |
| 65 | + docker ps --format '{{.Image}}' | sort >> docker_up_output.txt |
| 66 | + diff <(grep -v 'moby/buildkit:buildx-stable-1' docker_up_output.txt) test/image_names.txt |
| 67 | +
|
| 68 | + - name: Cleanup Docker Resources |
| 69 | + if: always() |
| 70 | + run: | |
| 71 | + echo "Running post-job cleanup..." |
| 72 | + docker stop $(docker ps -q) || true |
| 73 | + docker rm $(docker ps -aq) || true |
| 74 | + docker rmi $(docker images -q) || true |
| 75 | + docker volume rm $(docker volume ls -q) || true |
0 commit comments