3333 type : string
3434
3535jobs :
36+ build-compose-cache :
37+ name : " Build Docker Compose cache"
38+ runs-on : ubuntu-latest
39+ timeout-minutes : 10
40+ steps :
41+ - name : " Checkout code"
42+ uses : actions/checkout@v6
43+ - name : " Set up Docker Buildx"
44+ uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
45+ - name : " Build images for cache"
46+ run : |
47+ docker buildx build \
48+ --cache-from type=gha,scope=compose-test \
49+ --cache-to type=gha,scope=compose-test,mode=max \
50+ --target asset_builder \
51+ --progress=plain \
52+ .
53+ docker buildx build \
54+ --cache-from type=gha,scope=compose-test \
55+ --cache-to type=gha,scope=compose-test,mode=max \
56+ --target development \
57+ --progress=plain \
58+ .
59+
3660 test-unit :
3761 name : " Unit tests"
62+ needs : [build-compose-cache]
3863 runs-on : ubuntu-latest
39- timeout-minutes : 5
64+ timeout-minutes : 10
4065 steps :
4166 - name : " Checkout code"
4267 uses : actions/checkout@v6
68+ - name : " Set up Docker Buildx"
69+ uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
70+ - name : " Build Docker images from cache"
71+ run : |
72+ PROJECT_NAME="${GITHUB_REPOSITORY#*/}"
73+ docker buildx build \
74+ --cache-from type=gha,scope=compose-test \
75+ --cache-to type=gha,scope=compose-test,mode=max \
76+ --target asset_builder \
77+ -t "${PROJECT_NAME}_asset_builder:latest" \
78+ --load \
79+ .
80+ docker buildx build \
81+ --cache-from type=gha,scope=compose-test \
82+ --cache-to type=gha,scope=compose-test,mode=max \
83+ --target development \
84+ -t "${PROJECT_NAME}_web:latest" \
85+ --load \
86+ .
4387 - name : " Run unit test suite"
88+ env :
89+ COMPOSE_FILE : docker-compose.yml:docker-compose.ci.yml
90+ COMPOSE_PROJECT_NAME : ${{ github.event.repository.name }}
4491 run : |
4592 cp .env.example .env
4693 make test-unit
@@ -49,12 +96,35 @@ jobs:
4996 echo "Nothing to save"
5097 test-lint :
5198 name : " Linting"
99+ needs : [build-compose-cache]
52100 runs-on : ubuntu-latest
53- timeout-minutes : 5
101+ timeout-minutes : 10
54102 steps :
55103 - name : " Checkout code"
56104 uses : actions/checkout@v6
105+ - name : " Set up Docker Buildx"
106+ uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
107+ - name : " Build Docker images from cache"
108+ run : |
109+ PROJECT_NAME="${GITHUB_REPOSITORY#*/}"
110+ docker buildx build \
111+ --cache-from type=gha,scope=compose-test \
112+ --cache-to type=gha,scope=compose-test,mode=max \
113+ --target asset_builder \
114+ -t "${PROJECT_NAME}_asset_builder:latest" \
115+ --load \
116+ .
117+ docker buildx build \
118+ --cache-from type=gha,scope=compose-test \
119+ --cache-to type=gha,scope=compose-test,mode=max \
120+ --target development \
121+ -t "${PROJECT_NAME}_web:latest" \
122+ --load \
123+ .
57124 - name : " Run linting"
125+ env :
126+ COMPOSE_FILE : docker-compose.yml:docker-compose.ci.yml
127+ COMPOSE_PROJECT_NAME : ${{ github.event.repository.name }}
58128 run : |
59129 cp .env.example .env
60130 make test-lint
@@ -63,12 +133,35 @@ jobs:
63133 echo "Nothing to save"
64134 test-features :
65135 name : " Feature tests"
136+ needs : [build-compose-cache]
66137 runs-on : ubuntu-latest
67138 timeout-minutes : 10
68139 steps :
69140 - name : " Checkout code"
70141 uses : actions/checkout@v6
142+ - name : " Set up Docker Buildx"
143+ uses : docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
144+ - name : " Build Docker images from cache"
145+ run : |
146+ PROJECT_NAME="${GITHUB_REPOSITORY#*/}"
147+ docker buildx build \
148+ --cache-from type=gha,scope=compose-test \
149+ --cache-to type=gha,scope=compose-test,mode=max \
150+ --target asset_builder \
151+ -t "${PROJECT_NAME}_asset_builder:latest" \
152+ --load \
153+ .
154+ docker buildx build \
155+ --cache-from type=gha,scope=compose-test \
156+ --cache-to type=gha,scope=compose-test,mode=max \
157+ --target development \
158+ -t "${PROJECT_NAME}_web:latest" \
159+ --load \
160+ .
71161 - name : " Run feature tests"
162+ env :
163+ COMPOSE_FILE : docker-compose.yml:docker-compose.ci.yml
164+ COMPOSE_PROJECT_NAME : ${{ github.event.repository.name }}
72165 run : |
73166 cp .env.example .env
74167 make test-features
0 commit comments