bunkerized-nginx/.github/workflows/staging.yml

275 lines
8.6 KiB
YAML
Raw Normal View History

name: Automatic tests (STAGING)
permissions: read-all
2023-03-01 17:46:40 +01:00
on:
push:
branches: [staging]
jobs:
# Build Docker images
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
uses: ./.github/workflows/container-build.yml
with:
2023-08-15 11:40:05 +02:00
RELEASE: testing
ARCH: linux/amd64
CACHE: true
PUSH: true
IMAGE: ${{ matrix.image }}
DOCKERFILE: ${{ matrix.dockerfile }}
secrets:
DOCKER_USERNAME: ${{ secrets.DOCKER_USERNAME }}
DOCKER_TOKEN: ${{ secrets.DOCKER_TOKEN }}
PRIVATE_REGISTRY: ${{ secrets.PRIVATE_REGISTRY }}
PRIVATE_REGISTRY_TOKEN: ${{ secrets.PRIVATE_REGISTRY_TOKEN }}
2023-03-01 17:46:40 +01:00
# Build Linux packages
build-packages:
strategy:
matrix:
linux: [ubuntu, debian, fedora, rhel]
include:
- linux: ubuntu
package: deb
- linux: debian
package: deb
- linux: fedora
package: rpm
- linux: rhel
package: rpm
2023-04-29 21:43:26 +02:00
uses: ./.github/workflows/linux-build.yml
with:
2023-08-15 11:40:05 +02:00
RELEASE: testing
LINUX: ${{ matrix.linux }}
PACKAGE: ${{ matrix.package }}
TEST: true
PLATFORMS: linux/amd64
2023-04-29 21:43:26 +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 }}
2023-03-01 17:46:40 +01:00
2023-08-15 12:37:03 +02:00
# # Code security
# code-security:
# runs-on: ubuntu-latest
# permissions:
# actions: read
# contents: read
# security-events: write
# strategy:
# fail-fast: false
# matrix:
# language: ["python"]
# steps:
# - 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-03-09 10:04:59 +01:00
2023-08-15 12:37:03 +02:00
# # Create infrastructures
# create-infras:
# needs: [code-security, build-containers, build-packages]
# strategy:
# matrix:
# type: [docker, autoconf, swarm, k8s, linux]
# uses: ./.github/workflows/staging-create-infra.yml
# with:
# TYPE: ${{ matrix.type }}
# secrets:
# CICD_SECRETS: ${{ secrets.CICD_SECRETS }}
2023-03-01 17:46:40 +01:00
2023-08-15 12:37:03 +02:00
# # Perform tests
# staging-tests:
# needs: [create-infras]
# strategy:
# matrix:
# type: [docker, autoconf, swarm, k8s, linux]
# include:
# - type: docker
# runs_on: "['self-hosted', 'bw-docker']"
# - type: autoconf
# runs_on: "['self-hosted', 'bw-autoconf']"
# - type: swarm
# runs_on: "['self-hosted', 'bw-swarm']"
# - type: k8s
# runs_on: "['ubuntu-latest']"
# - type: linux
# runs_on: "['self-hosted', 'bw-linux']"
# uses: ./.github/workflows/staging-tests.yml
# with:
# TYPE: ${{ matrix.type }}
# RUNS_ON: ${{ matrix.runs_on }}
# secrets: inherit
# tests-ui:
# needs: [create-infras]
# uses: ./.github/workflows/tests-ui.yml
# with:
# RELEASE: testing
# secrets:
# PRIVATE_REGISTRY: ${{ secrets.PRIVATE_REGISTRY }}
# PRIVATE_REGISTRY_TOKEN: ${{ secrets.PRIVATE_REGISTRY_TOKEN }}
# prepare-tests-core:
# needs: [create-infras]
# 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:
# fail-fast: false
# matrix:
# test: ${{ fromJson(needs.prepare-tests-core.outputs.tests) }}
# uses: ./.github/workflows/test-core.yml
# with:
# TEST: ${{ matrix.test }}
# RELEASE: testing
# secrets:
# PRIVATE_REGISTRY: ${{ secrets.PRIVATE_REGISTRY }}
# PRIVATE_REGISTRY_TOKEN: ${{ secrets.PRIVATE_REGISTRY_TOKEN }}
2023-04-29 21:43:26 +02:00
2023-08-15 12:37:03 +02:00
# # Delete infrastructures
# delete-infras:
# if: ${{ always() }}
# needs: [staging-tests]
# strategy:
# matrix:
# type: [docker, autoconf, swarm, k8s, linux]
# uses: ./.github/workflows/staging-delete-infra.yml
# with:
# TYPE: ${{ matrix.type }}
# secrets:
# CICD_SECRETS: ${{ secrets.CICD_SECRETS }}
2023-08-15 11:40:05 +02:00
# Push Docker images
push-images:
2023-08-15 12:37:03 +02:00
# needs: [staging-tests, tests-ui, tests-core]
needs: [build-containers, build-packages]
2023-08-15 11:40:05 +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:testing && docker tag ${{ secrets.PRIVATE_REGISTRY }}/infra/bunkerweb-tests:testing bunkerity/bunkerweb:testing && docker push bunkerity/bunkerweb:testing
- name: Push scheduler image
run: docker pull ${{ secrets.PRIVATE_REGISTRY }}/infra/scheduler-tests:testing && docker tag ${{ secrets.PRIVATE_REGISTRY }}/infra/scheduler-tests:testing bunkerity/bunkerweb-scheduler:testing && docker push bunkerity/bunkerweb-scheduler:testing
- name: Push UI image
run: docker pull ${{ secrets.PRIVATE_REGISTRY }}/infra/ui-tests:testing && docker tag ${{ secrets.PRIVATE_REGISTRY }}/infra/ui-tests:testing bunkerity/bunkerweb-ui:testing && docker push bunkerity/bunkerweb-ui:testing
- name: Push autoconf image
run: docker pull ${{ secrets.PRIVATE_REGISTRY }}/infra/autoconf-tests:testing && docker tag ${{ secrets.PRIVATE_REGISTRY }}/infra/autoconf-tests:testing bunkerity/bunkerweb-autoconf:testing && docker push bunkerity/bunkerweb-autoconf:testing
# Push Linux packages
push-packages:
2023-08-15 12:37:03 +02:00
# needs: [staging-tests, tests-ui, tests-core]
needs: [build-containers, build-packages]
2023-08-15 11:40:05 +02:00
strategy:
matrix:
linux: [ubuntu, debian, fedora, el]
arch: [amd64]
2023-08-15 11:40:05 +02:00
include:
- release: testing
repo: bunkerweb
- linux: ubuntu
separator: _
suffix: ""
version: jammy
package: deb
- linux: debian
separator: _
suffix: ""
version: bullseye
package: deb
- linux: fedora
separator: "-"
suffix: "1."
version: 38
package: rpm
- linux: el
separator: "-"
suffix: "1."
version: 8
package: rpm
- linux: ubuntu
arch: amd64
package_arch: amd64
- linux: debian
arch: amd64
package_arch: amd64
- linux: fedora
arch: amd64
package_arch: x86_64
- linux: el
arch: amd64
package_arch: x86_64
uses: ./.github/workflows/push-packagecloud.yml
with:
SEPARATOR: ${{ matrix.separator }}
SUFFIX: ${{ matrix.suffix }}
REPO: ${{ matrix.repo }}
LINUX: ${{ matrix.linux }}
VERSION: ${{ matrix.version }}
PACKAGE: ${{ matrix.package }}
BW_VERSION: ${{ matrix.release }}
PACKAGE_ARCH: ${{ matrix.package_arch }}
ARCH: ${{ matrix.arch }}
secrets:
PACKAGECLOUD_TOKEN: ${{ secrets.PACKAGECLOUD_TOKEN }}
# Push doc
push-doc:
needs: [push-images, push-packages]
permissions:
contents: write
uses: ./.github/workflows/push-doc.yml
with:
VERSION: testing
ALIAS: unstable
secrets:
BUNKERBOT_TOKEN: ${{ secrets.BUNKERBOT_TOKEN }}
# Push on GH
push-gh:
needs: [push-doc]
permissions:
contents: write
discussions: write
uses: ./.github/workflows/push-github.yml
with:
VERSION: testing
PRERELEASE: true