Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/cicd-1-pull-request.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ jobs:
secrets: inherit
build-stage:
name: 'Build stage'
needs: [metadata]
needs: [metadata, test-stage]
uses: ./.github/workflows/stage-3-build.yaml
with:
build_datetime: '${{ needs.metadata.outputs.build_datetime }}'
Expand Down
140 changes: 131 additions & 9 deletions .github/workflows/stage-2-test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -33,42 +33,164 @@ on:
type: string

jobs:
build-compose-cache:
name: "Build Docker Compose cache"
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
- name: "Build asset_builder for cache"
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8
with:
context: .
target: asset_builder
push: false
load: true
tags: ${{ github.event.repository.name }}_asset_builder:latest
cache-from: type=gha,scope=compose-asset
cache-to: type=gha,scope=compose-asset,mode=min
- name: "Build web image for cache"
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8
with:
context: .
target: development
push: false
load: true
tags: ${{ github.event.repository.name }}_web:latest
cache-from: type=gha,scope=compose-web
cache-to: type=gha,scope=compose-web,mode=min

test-unit:
name: "Unit tests"
needs: [build-compose-cache]
runs-on: ubuntu-latest
timeout-minutes: 5
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
- name: "Build asset_builder from cache"
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8
with:
context: .
target: asset_builder
push: false
load: true
tags: ${{ github.event.repository.name }}_asset_builder:latest
cache-from: type=gha,scope=compose-asset
cache-to: type=gha,scope=compose-asset,mode=min
- name: "Build web image from cache"
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8
with:
context: .
target: development
push: false
load: true
tags: ${{ github.event.repository.name }}_web:latest
cache-from: type=gha,scope=compose-web
cache-to: type=gha,scope=compose-web,mode=min
- name: "Run unit test suite"
env:
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
COMPOSE_PROJECT_NAME: ${{ github.event.repository.name }}
run: |
cp .env.example .env
make test-unit
- name: "Save the result of fast test suite"
run: |
echo "Nothing to save"
run: echo "Nothing to save"

test-lint:
name: "Linting"
needs: [build-compose-cache]
runs-on: ubuntu-latest
timeout-minutes: 5
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
- name: "Build asset_builder from cache"
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8
with:
context: .
target: asset_builder
push: false
load: true
tags: ${{ github.event.repository.name }}_asset_builder:latest
cache-from: type=gha,scope=compose-asset
cache-to: type=gha,scope=compose-asset,mode=min
- name: "Build web image from cache"
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8
with:
context: .
target: development
push: false
load: true
tags: ${{ github.event.repository.name }}_web:latest
cache-from: type=gha,scope=compose-web
cache-to: type=gha,scope=compose-web,mode=min
- name: "Run linting"
env:
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
COMPOSE_PROJECT_NAME: ${{ github.event.repository.name }}
run: |
cp .env.example .env
make test-lint
- name: "Save the linting result"
run: echo "Nothing to save"

test-features:
name: "Feature tests"
needs: [build-compose-cache]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: "Checkout code"
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@8d2750c68a42422c14e847fe6c8ac0403b4cbd6f
- name: "Build asset_builder from cache"
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8
with:
context: .
target: asset_builder
push: false
load: true
tags: ${{ github.event.repository.name }}_asset_builder:latest
cache-from: type=gha,scope=compose-asset
cache-to: type=gha,scope=compose-asset,mode=min
- name: "Build web image from cache"
uses: docker/build-push-action@10e90e3645eae34f1e60eeb005ba3a3d33f178e8
with:
context: .
target: development
push: false
load: true
tags: ${{ github.event.repository.name }}_web:latest
cache-from: type=gha,scope=compose-web
cache-to: type=gha,scope=compose-web,mode=min
- name: "Run feature tests"
env:
COMPOSE_FILE: docker-compose.yml:docker-compose.ci.yml
COMPOSE_PROJECT_NAME: ${{ github.event.repository.name }}
run: |
echo "Nothing to save"
cp .env.example .env
make test-features
- name: "Save result"
run: echo "Nothing to save"

test-coverage:
name: "Test coverage"
needs: [test-unit]
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: "Checkout code"
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
- name: "Run test coverage check"
run: |
make test-coverage
Expand All @@ -85,7 +207,7 @@ jobs:
timeout-minutes: 5
steps:
- name: "Checkout code"
uses: actions/checkout@v6
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd
with:
fetch-depth: 0 # Full history is needed to improving relevancy of reporting
- name: "Perform static analysis"
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/stage-4-acceptance.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,6 @@ jobs:
uses: actions/checkout@v6
- name: "Run UI test"
run: |
cp .env.example .env
make test-ui
- name: "Save result"
run: |
Expand Down
11 changes: 11 additions & 0 deletions docker-compose.ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
# Used only in CI (COMPOSE_FILE=docker-compose.yml:docker-compose.ci.yml) to pin
# pre-built image names so tests use the cached images instead of rebuilding.
# Not loaded when running docker compose locally.

services:
web:
image: ${COMPOSE_PROJECT_NAME}_web:latest
pull_policy: never
asset_builder:
image: ${COMPOSE_PROJECT_NAME}_asset_builder:latest
pull_policy: never
2 changes: 1 addition & 1 deletion scripts/tests/ui.sh → scripts/tests/features.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
echo Running UI Tests
echo Running Feature Tests

if [[ -n "${TAG:-}" ]]; then
TAG="--tags=$TAG"
Expand Down
5 changes: 5 additions & 0 deletions scripts/tests/test.mk
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ test-unit: # Run your unit tests from scripts/test/unit @Testing
test-lint: # Lint your code from scripts/test/lint @Testing
make _test name="lint"

test-features: # Run feature (Behave) tests @Testing
make _test name="features"

test-coverage: # Evaluate code coverage from scripts/test/coverage @Testing
make _test name="coverage"

Expand Down Expand Up @@ -55,6 +58,7 @@ test: # Run all the test tasks @Testing
make \
test-unit \
test-lint \
test-features \
test-coverage \
test-contract \
test-security \
Expand Down Expand Up @@ -89,3 +93,4 @@ ${VERBOSE}.SILENT: \
test-ui \
test-ui-performance \
test-unit \
test-features \