Build and Run Check Tests #43
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 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 |