2022-11-16 20:52:41 +01:00
|
|
|
name: Automatic tests (DEV)
|
2022-06-06 11:52:25 +02:00
|
|
|
|
2023-04-29 15:21:30 +02:00
|
|
|
permissions: read-all
|
|
|
|
|
2022-06-06 11:52:25 +02:00
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches: [dev]
|
|
|
|
|
|
|
|
jobs:
|
2023-04-29 16:47:28 +02:00
|
|
|
# Containers
|
2023-05-04 23:21:36 +02:00
|
|
|
build-containers:
|
|
|
|
strategy:
|
|
|
|
matrix:
|
|
|
|
image: [bunkerweb, scheduler, autoconf, ui]
|
|
|
|
include:
|
|
|
|
- image: bunkerweb
|
|
|
|
dockerfile: src/bw/Dockerfile
|
|
|
|
- image: scheduler
|
|
|
|
dockerfile: src/scheduler/Dockerfile
|
|
|
|
- image: autoconf
|
|
|
|
dockerfile: src/autoconf/Dockerfile
|
|
|
|
- image: ui
|
|
|
|
dockerfile: src/ui/Dockerfile
|
2023-04-29 16:47:28 +02:00
|
|
|
uses: ./.github/workflows/container-build.yml
|
|
|
|
with:
|
|
|
|
RELEASE: dev
|
2023-08-02 15:59:23 +02:00
|
|
|
CACHE: true
|
2023-04-29 16:47:28 +02:00
|
|
|
ARCH: linux/amd64
|
2023-05-04 23:21:36 +02:00
|
|
|
IMAGE: ${{ matrix.image }}
|
|
|
|
DOCKERFILE: ${{ matrix.dockerfile }}
|
2023-04-29 16:47:28 +02:00
|
|
|
secrets:
|
|
|
|
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
PRIVATE_REGISTRY: ${{ secrets.PRIVATE_REGISTRY }}
|
|
|
|
PRIVATE_REGISTRY_TOKEN: ${{ secrets.PRIVATE_REGISTRY_TOKEN }}
|
2022-11-16 21:57:33 +01:00
|
|
|
|
|
|
|
# Python code security
|
|
|
|
code-security:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
permissions:
|
|
|
|
actions: read
|
|
|
|
contents: read
|
|
|
|
security-events: write
|
|
|
|
strategy:
|
|
|
|
fail-fast: false
|
|
|
|
matrix:
|
|
|
|
language: ["python"]
|
|
|
|
steps:
|
2022-12-14 17:10:39 +01:00
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Initialize CodeQL
|
|
|
|
uses: github/codeql-action/init@v2
|
|
|
|
with:
|
|
|
|
languages: ${{ matrix.language }}
|
|
|
|
config-file: ./.github/codeql.yml
|
|
|
|
- name: Perform CodeQL Analysis
|
|
|
|
uses: github/codeql-action/analyze@v2
|
|
|
|
with:
|
|
|
|
category: "/language:${{matrix.language}}"
|
2023-04-29 16:47:28 +02:00
|
|
|
|
|
|
|
# UI tests
|
|
|
|
tests-ui:
|
2023-05-05 14:18:57 +02:00
|
|
|
needs: [code-security, build-containers]
|
2023-04-29 16:47:28 +02:00
|
|
|
uses: ./.github/workflows/tests-ui.yml
|
|
|
|
with:
|
|
|
|
RELEASE: dev
|
|
|
|
secrets:
|
|
|
|
PRIVATE_REGISTRY: ${{ secrets.PRIVATE_REGISTRY }}
|
|
|
|
PRIVATE_REGISTRY_TOKEN: ${{ secrets.PRIVATE_REGISTRY_TOKEN }}
|
2023-05-15 13:10:27 +02:00
|
|
|
|
|
|
|
# Core tests
|
|
|
|
prepare-tests-core:
|
|
|
|
needs: [code-security, build-containers]
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Checkout repository
|
|
|
|
uses: actions/checkout@v3
|
|
|
|
- id: set-matrix
|
|
|
|
run: |
|
|
|
|
tests=$(find ./tests/core/ -maxdepth 1 -mindepth 1 -type d -printf "%f\n" | jq -c --raw-input --slurp 'split("\n")| .[0:-1]')
|
|
|
|
echo "::set-output name=tests::$tests"
|
|
|
|
outputs:
|
|
|
|
tests: ${{ steps.set-matrix.outputs.tests }}
|
|
|
|
tests-core:
|
|
|
|
needs: prepare-tests-core
|
|
|
|
strategy:
|
2023-05-15 13:37:54 +02:00
|
|
|
fail-fast: false
|
2023-05-15 13:10:27 +02:00
|
|
|
matrix:
|
|
|
|
test: ${{ fromJson(needs.prepare-tests-core.outputs.tests) }}
|
|
|
|
uses: ./.github/workflows/test-core.yml
|
|
|
|
with:
|
|
|
|
TEST: ${{ matrix.test }}
|
|
|
|
RELEASE: dev
|
|
|
|
secrets:
|
|
|
|
PRIVATE_REGISTRY: ${{ secrets.PRIVATE_REGISTRY }}
|
2023-06-26 18:49:49 +02:00
|
|
|
PRIVATE_REGISTRY_TOKEN: ${{ secrets.PRIVATE_REGISTRY_TOKEN }}
|
2023-08-21 17:05:09 +02:00
|
|
|
|
2023-08-02 15:47:33 +02:00
|
|
|
# Push with dev tag
|
|
|
|
push-dev:
|
2023-08-21 17:05:09 +02:00
|
|
|
needs: [tests-ui, tests-core]
|
2023-08-02 15:47:33 +02:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Login to Docker Hub
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKER_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKER_TOKEN }}
|
|
|
|
- name: Login to private repository
|
|
|
|
uses: docker/login-action@v2
|
|
|
|
with:
|
|
|
|
registry: ${{ secrets.PRIVATE_REGISTRY }}
|
|
|
|
username: registry
|
|
|
|
password: ${{ secrets.PRIVATE_REGISTRY_TOKEN }}
|
|
|
|
- name: Push BW image
|
|
|
|
run: docker pull ${{ secrets.PRIVATE_REGISTRY }}/infra/bunkerweb-tests:dev && docker tag ${{ secrets.PRIVATE_REGISTRY }}/infra/bunkerweb-tests:dev bunkerity/bunkerweb:dev && docker push bunkerity/bunkerweb:dev
|
|
|
|
- name: Push scheduler image
|
|
|
|
run: docker pull ${{ secrets.PRIVATE_REGISTRY }}/infra/scheduler-tests:dev && docker tag ${{ secrets.PRIVATE_REGISTRY }}/infra/scheduler-tests:dev bunkerity/bunkerweb-scheduler:dev && docker push bunkerity/bunkerweb-scheduler:dev
|
|
|
|
- name: Push UI image
|
|
|
|
run: docker pull ${{ secrets.PRIVATE_REGISTRY }}/infra/ui-tests:dev && docker tag ${{ secrets.PRIVATE_REGISTRY }}/infra/ui-tests:dev bunkerity/bunkerweb-ui:dev && docker push bunkerity/bunkerweb-ui:dev
|
|
|
|
- name: Push autoconf image
|
|
|
|
run: docker pull ${{ secrets.PRIVATE_REGISTRY }}/infra/autoconf-tests:dev && docker tag ${{ secrets.PRIVATE_REGISTRY }}/infra/autoconf-tests:dev bunkerity/bunkerweb-autoconf:dev && docker push bunkerity/bunkerweb-autoconf:dev
|