-
Notifications
You must be signed in to change notification settings - Fork 53
75 lines (65 loc) · 2.69 KB
/
ci-test.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
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