Skip to content

Commit

Permalink
Use Caching in GitHub Actions (#697)
Browse files Browse the repository at this point in the history
* ci: add caching to integration tests

* ci: attempt to use actions/setup-node

* ci : fix path issue

* ci: add working directories

* ci: fix node path

* ci: change paths

* ci: wip

* wip

* wip

* ci: wip

* ci: wip

* ci: wip

* ci: wip

* ci: introduce caching where appropriate

* wip

* wip

* wip

* wip

* wip

* wip

* test: Single compose file

* test: Remove version

* test: build manually

* test: Remove version

* fix: Invert ifs

* test: Use old script

* test: add env variable

* test: Cache manually

* test: Use min caching

* test: Cache Nuget

* test: Remove nuget

* test: Move cache

* test: Add dotnet setup

* test: Remove dotnet

* Use NuGet Package locking

* test: Use local docker registry

* test: Use local registry

* test:change registry port to 6000

* test: Use own steps for pushing

* test: fix image names

* test: Remove nuget locks

* test: remove pushing script

* test: Fix image names

* test: Fix image names again, parallel building

* test: add down cmd to group

* test: Use registry cache-to

* fix: typo

* fix: Remove registry cache-to

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* wip

* chore: Remove unused/commented out code

* chore: Remove docker setup in test runner

* chore: Implement caching for integration tests and transport tests

* Add cached time for SQL Server

* chore: Remove temporary Cache Times file

* chore: Remove temporary test workflow file

* chore: Remove commented out version numbers

* chore: Update versions of cache and setup-node actions

* chore: Update node version and remove check-latest

* chore: Rename build job, step names, variable names

* chore: Remove unnecessary docker logs

* chore: Load docker images automatically

* chore: Remove skipped tests from logger summary

* fix: Make load docker images script executable

* fix: Correct path of loadDockerImages.sh for transport tests

* chore: Remove separate build jobs, use the cached one

* fix: Specify docker buildx driver and login to ghcr

* test: Try oci media type

* fix: Remove duplicated database-migrator image build

* test: Use ghcr for artifacts

* fix: Let docker pull images

* test: Use uploaded images from ghcr

* test: Try multiple outputs

* test: Load images from ghcr completely

* fix: Revert back to local docker

* fix: Remove tags from images

* fix: Tag images, so that compose can use them

* chore: Unify tags, remove old properties

* chore: Remove old comments

* chore: Use tagged images

* chore: Remove includePassedTests logger property

* chore: Use semantic versioning

---------

Co-authored-by: Nikola Vetnić <[email protected]>
Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com>
  • Loading branch information
3 people authored Jun 24, 2024
1 parent 018a73b commit dace53d
Show file tree
Hide file tree
Showing 7 changed files with 260 additions and 163 deletions.
1 change: 0 additions & 1 deletion .ci/docker-compose.test.postgres.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.3"
services:
### infrastructure ###

Expand Down
1 change: 0 additions & 1 deletion .ci/docker-compose.test.sqlserver.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
version: "3.3"
services:
### infrastructure ###

Expand Down
25 changes: 6 additions & 19 deletions .ci/docker-compose.test.yml
Original file line number Diff line number Diff line change
@@ -1,11 +1,8 @@
version: "3.3"
services:
consumer-api:
container_name: consumer-api-test
hostname: consumer-api
build:
context: ..
dockerfile: ConsumerApi/Dockerfile
image: consumer-api:0.0.1
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
Expand All @@ -24,9 +21,7 @@ services:
admin-ui:
container_name: admin-ui-test
hostname: admin-ui
build:
context: ..
dockerfile: AdminApi/src/AdminApi/Dockerfile
image: admin-ui:0.0.1
environment:
- ASPNETCORE_ENVIRONMENT=Development
ports:
Expand All @@ -42,9 +37,7 @@ services:

event-handler-service:
container_name: event-handler-service-test
build:
context: ..
dockerfile: EventHandlerService/src/EventHandlerService/Dockerfile
image: event-handler-service:0.0.1
environment:
- ASPNETCORE_ENVIRONMENT=Development
depends_on:
Expand All @@ -58,9 +51,7 @@ services:

sse-server:
container_name: sse-server-test
build:
context: ..
dockerfile: SseServer/src/SseServer/Dockerfile
image: sse-server:0.0.1
environment:
- ASPNETCORE_ENVIRONMENT=Development
configs:
Expand All @@ -69,9 +60,7 @@ services:

database-migrator:
container_name: database-migrator-test
build:
context: ..
dockerfile: DatabaseMigrator/Dockerfile
image: database-migrator:0.0.1
depends_on:
seed-database:
condition: service_completed_successfully
Expand Down Expand Up @@ -109,9 +98,7 @@ services:

seed-client:
container_name: seed-client-test
build:
context: ..
dockerfile: Modules/Devices/src/Devices.AdminCli/Dockerfile
image: seed-client:0.0.1
depends_on:
consumer-api:
condition: service_healthy
Expand Down
16 changes: 11 additions & 5 deletions .ci/integrationTest.postgres.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ dockerCompose() {
docker compose -f ./.ci/docker-compose.test.yml -f ./.ci/docker-compose.test.postgres.yml "$@"
}

dockerCompose down
dockerCompose build
dockerCompose up -d
dotnet restore "Backbone.sln"
dotnet build --no-restore "Backbone.sln"
{
dockerCompose down;
dockerCompose up -d --no-build
} &
{
dotnet restore "Backbone.sln";
dotnet build --no-restore "Backbone.sln"
}
wait

export CONSUMER_API_BASE_ADDRESS="http://localhost:5000"
export ADMIN_API_BASE_ADDRESS="http://localhost:5173"

dotnet test --no-restore --no-build --filter "Category=Integration&TestCategory!~ignore" --logger "GitHubActions;summary.includeNotFoundTests=false" "Backbone.sln"
16 changes: 11 additions & 5 deletions .ci/integrationTest.sqlserver.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,17 @@ dockerCompose() {
docker compose -f ./.ci/docker-compose.test.yml -f ./.ci/docker-compose.test.sqlserver.yml "$@"
}

dockerCompose down
dockerCompose build
dockerCompose up -d
dotnet restore "Backbone.sln"
dotnet build --no-restore "Backbone.sln"
{
dockerCompose down;
dockerCompose up -d --no-build
} &
{
dotnet restore "Backbone.sln";
dotnet build --no-restore "Backbone.sln"
}
wait

export CONSUMER_API_BASE_ADDRESS="http://localhost:5000"
export ADMIN_API_BASE_ADDRESS="http://localhost:5173"

dotnet test --no-restore --no-build --filter "Category=Integration&TestCategory!~ignore" --logger "GitHubActions;summary.includeNotFoundTests=false" "Backbone.sln"
6 changes: 6 additions & 0 deletions .ci/loadDockerImages.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#!/bin/bash
set -e

for f in /tmp/*.tar; do
docker load --input $f
done
Loading

0 comments on commit dace53d

Please sign in to comment.