-
Notifications
You must be signed in to change notification settings - Fork 24
128 lines (102 loc) · 4.12 KB
/
ci-tests.yml
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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
name: ci-tests
on:
push:
paths-ignore:
- '**.md'
- '.mkdocs.yml'
- 'docs/**'
branches: [ master ]
jobs:
phpcomposer:
runs-on: ubuntu-20.04
steps:
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: imagick, gd, mysqli, pdo, intl, mbstring
tools: composer:v2
- uses: actions/checkout@v3
- name: Check if packagist is up and if not use a mirror...
run: nc -N -w1 asset-packagist.org 443 || composer config -g repos.packagist composer https://packagist.fi
- name: Configure github token
run: composer config -g github-oauth.github.com "${{ secrets.GITHUBOAUTHTOKEN }}"
- name: Validate frontend composer.json and composer.lock
run: |
cd frontend
composer validate
- name: Validate backend composer.json and composer.lock
run: |
cd backend
composer validate
- name: Install frontend dependencies
run: |
cd frontend
php8.3 /usr/bin/composer update --no-dev --prefer-dist --no-progress
- name: Install backend dependencies
run: |
cd backend
php8.3 /usr/bin/composer update --no-dev --prefer-dist --no-progress
dockerbuilds:
needs: [phpcomposer]
runs-on: ubuntu-20.04
env:
GITHUB_OAUTH_TOKEN: ${{ secrets.GITHUBOAUTHTOKEN }}
DOCKER_BUILDKIT: 0
BUILDKIT_PROGRESS: plain
steps:
- name: Setup PHP with PECL extension
uses: shivammathur/setup-php@v2
with:
php-version: '8.3'
extensions: imagick, gd, mysqli, pdo, intl, mbstring
tools: composer:v2
- uses: actions/checkout@v3
- name: Enable experimental docker features
run: |
echo $'{\n "experimental": true\n}' | sudo tee /etc/docker/daemon.json
sudo service docker restart
- name: Configure github token
run: composer config -g github-oauth.github.com "${{ secrets.GITHUBOAUTHTOKEN }}"
- name: Install frontend dependencies
run: |
cd frontend
php8.3 /usr/bin/composer update --no-dev --prefer-dist --no-progress
- name: Install backend dependencies
run: |
cd backend
php8.3 /usr/bin/composer update --no-dev --prefer-dist --no-progress
- name: Build the all-in-one Docker image
run: docker build --no-cache --squash . --file contrib/Dockerfile --tag echothrust/echoctf.red-all-in-one:latest
- name: Build the DB Docker image
run: docker build --no-cache --squash . --file contrib/Dockerfile-mariadb --tag echothrust/echoctf.red-db:latest
- name: Build the frontend Docker image
run: docker build --no-cache --squash . --file contrib/Dockerfile-frontend --tag echothrust/echoctf.red-frontend:latest
- name: Build the backend Docker image
run: docker build --no-cache --squash . --file contrib/Dockerfile-backend --tag echothrust/echoctf.red-backend:latest
- name: Build the vpn Docker image
run: docker build --no-cache --squash . --file contrib/Dockerfile-vpn --tag echothrust/echoctf.red-vpn:latest
- name: Login to DockerHub
run: docker login -u ${{ secrets.DOCKER_USERNAME }} -p${{ secrets.DOCKER_PASSWORD }}
- name: Push the all-in-one Docker image
run: docker push echothrust/echoctf.red-all-in-one:latest
- name: Push the DB Docker image
run: docker push echothrust/echoctf.red-db:latest
- name: Push the frontend Docker image
run: docker push echothrust/echoctf.red-frontend:latest
- name: Push the backend Docker image
run: docker push echothrust/echoctf.red-backend:latest
- name: Push the vpn Docker image
run: docker push echothrust/echoctf.red-vpn:latest
- name: Build the docker compose stack
run: docker compose up -d
- name: Check running containers
run: docker ps -a
- name: Drop containers
run: docker compose down --rmi all
- name: Build the docker compose-novpn.yml stack
run: docker compose -f docker-compose-novpn.yml up -d
- name: Check running containers
run: docker ps -a
- name: Drop containers
run: docker compose down --rmi all