Skip to content

chore(tests): Update test files to work with Docker Compose v2 #525

chore(tests): Update test files to work with Docker Compose v2

chore(tests): Update test files to work with Docker Compose v2 #525

Workflow file for this run

name: CI
on:
# Automatically run CI on Release and Pre-Release tags and main branch
# (except changes to non-relevant paths)
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
branches:
- main
paths-ignore:
- "plugins/**"
- ".github/workflows/plugins.yml"
# Automatically run CI on branches, that have active PR opened
pull_request:
branches:
- main
paths-ignore:
- "plugins/**"
- ".github/workflows/plugins.yml"
# To make it possible to trigger e2e CI workflow for any arbitrary git ref
workflow_dispatch:
env:
ARTIFACT_RETENTION_DAYS: 7
GO_VERSION: 1.21
GO_LINT_VERSION: v1.56.2
jobs:
lint-python:
runs-on: ubuntu-latest
env:
PYTHON: 3.7
steps:
- uses: actions/checkout@v4
- name: Setup Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: x64
- name: Install dependencies
run: make install-python-ci-dependencies
- name: Lint python
run: make lint-python
lint-go:
runs-on: ubuntu-latest
steps:
- name: Set up Go
id: setup-go
uses: actions/setup-go@v5
with:
go-version: ${{ env.GO_VERSION }}
- uses: actions/checkout@v4
- name: Lint Common module
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GO_LINT_VERSION }}
working-directory: common
args: --timeout 3m --verbose --skip-files=testutils/mocks/ManagementClientInterface.go
- name: Lint Management Service module
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GO_LINT_VERSION }}
working-directory: management-service
skip-pkg-cache: true
skip-build-cache: true
args: --timeout 3m --verbose
- name: Lint Treatment Service module
uses: golangci/golangci-lint-action@v3
with:
version: ${{ env.GO_LINT_VERSION }}
working-directory: treatment-service
skip-pkg-cache: true
skip-build-cache: true
args: --timeout 3m --verbose
unit-tests-management:
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}/api/.go
services:
postgres:
image: postgres:13-alpine
env:
POSTGRES_DB: xp
POSTGRES_USER: xp
POSTGRES_PASSWORD: xp
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Test Dependencies
uses: ./.github/actions/setup-tests
with:
go-version: ${{ env.GO_VERSION }}
- name: Run Management Service test
env:
DATABASE_HOST: localhost
DATABASE_NAME: xp
DATABASE_USER: xp
DATABASE_PASSWORD: xp
run: make test-management-service
unit-tests-treatment:
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}/api/.go
services:
postgres:
image: postgres:13-alpine
env:
POSTGRES_DB: xp
POSTGRES_USER: xp
POSTGRES_PASSWORD: xp
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Test Dependencies
uses: ./.github/actions/setup-tests
with:
go-version: ${{ env.GO_VERSION }}
- name: Run Treatment Service test
env:
DATABASE_HOST: localhost
DATABASE_NAME: xp
DATABASE_USER: xp
DATABASE_PASSWORD: xp
run: make test-treatment-service
e2e-tests:
runs-on: ubuntu-latest
env:
GOPATH: ${{ github.workspace }}/api/.go
services:
postgres:
image: postgres:13-alpine
env:
POSTGRES_DB: xp
POSTGRES_USER: xp
POSTGRES_PASSWORD: xp
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
- 5432:5432
steps:
- name: Check out code
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Setup Test Dependencies
uses: ./.github/actions/setup-tests
with:
go-version: ${{ env.GO_VERSION }}
- name: Setup Python
id: setup-python
uses: actions/setup-python@v5
with:
python-version: "3.10"
architecture: x64
- name: Install dependencies
run: make install-python-ci-dependencies
- name: Build binaries
run: make build
- name: Publish Management Service Artifact
uses: actions/upload-artifact@v4
with:
name: management-service-binary
path: management-service/bin/
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
- name: Publish Treatment Service Artifact
uses: actions/upload-artifact@v4
with:
name: treatment-service-binary
path: treatment-service/bin/
retention-days: ${{ env.ARTIFACT_RETENTION_DAYS }}
- name: Run E2E tests
env:
DATABASE_HOST: localhost
DATABASE_NAME: xp
DATABASE_USER: xp
DATABASE_PASSWORD: xp
run: make e2e-ci
release-rules:
runs-on: ubuntu-latest
outputs:
release-type: ${{ steps.release-rules.outputs.release-type }}
steps:
- uses: actions/checkout@v4
- id: release-rules
uses: ./.github/actions/release-rules
release:
# Automatically publish release and pre-release artifacts.
#
# As for dev releases, make it possible to publish artifacts
# manually by approving 'deployment' in the 'manual' environment.
#
# Dev build can be released either from the 'main' branch or
# by running this workflow manually with `workflow_dispatch` event.
if: >-
contains('release,pre-release', needs.release-rules.outputs.release-type)
|| ( github.event_name != 'pull_request' )
|| ( github.event.pull_request.head.repo.full_name == github.repository )
needs:
- lint-python
- lint-go
- unit-tests-management
- unit-tests-treatment
- e2e-tests
- release-rules
uses: ./.github/workflows/release.yml
with:
environment: ${{ needs.release-rules.outputs.release-type == 'dev' && 'manual' || '' }}
secrets:
ghcr_token: ${{ secrets.GITHUB_TOKEN }}