Separate nightly jobs

This commit is contained in:
cytopia
2022-03-26 19:30:43 +01:00
parent 52c1a907f9
commit 0011b2e6ed
5 changed files with 333 additions and 1 deletions

View File

@@ -0,0 +1,174 @@
---
# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: nightly
# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
# Runs daily
schedule:
- cron: '0 0 * * *'
jobs:
# -----------------------------------------------------------------------------------------------
# (1/8) Determine parameter settings
# -----------------------------------------------------------------------------------------------
params:
uses: ./.github/workflows/params-nightly_master.yml
# -----------------------------------------------------------------------------------------------
# (2/8) Configure Build and Deploy Matrices
# -----------------------------------------------------------------------------------------------
configure:
needs: [params]
uses: ./.github/workflows/zzz-reuse-configure.yml
with:
enabled: true
can_deploy: true
matrix: ${{ needs.params.outputs.matrix }}
refs: ${{ needs.params.outputs.refs }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (3/8) Build & Test base
# -----------------------------------------------------------------------------------------------
base:
needs:
- params
- configure
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: base
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (4/8) Build & Test mods
# -----------------------------------------------------------------------------------------------
mods:
needs:
- params
- configure
- base
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: mods
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (5/8) Build & Test prod
# -----------------------------------------------------------------------------------------------
prod:
needs:
- params
- configure
- base
- mods
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: prod
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (6/8) Build & Test work
# -----------------------------------------------------------------------------------------------
work:
needs:
- params
- configure
- base
- mods
- prod
uses: ./.github/workflows/zzz-reuse-build.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
flavour: work
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (7/8) Push images
# -----------------------------------------------------------------------------------------------
push-image:
needs:
- params
- configure
- base
- mods
- prod
- work
uses: ./.github/workflows/zzz-reuse-deploy-images.yml
with:
enabled: true
can_deploy: true
build_matrix: ${{ needs.configure.outputs.matrix_build }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}
# -----------------------------------------------------------------------------------------------
# (8/8) Push Manifests
# -----------------------------------------------------------------------------------------------
push-manifest:
needs:
- params
- configure
- base
- mods
- prod
- work
- push-image
uses: ./.github/workflows/zzz-reuse-deploy-manifests.yml
with:
enabled: true
can_deploy: true
deploy_matrix: ${{ needs.configure.outputs.matrix_deploy }}
params_matrix: ${{ needs.params.outputs.matrix }}
has_refs: ${{ needs.configure.outputs.has_refs }}
artifact_prefix: ${{ needs.configure.outputs.artifact_prefix }}
secrets:
dockerhub_username: ${{ secrets.DOCKERHUB_USERNAME }}
dockerhub_password: ${{ secrets.DOCKERHUB_PASSWORD }}

View File

@@ -21,7 +21,7 @@ jobs:
# (1/8) Determine parameter settings
# -----------------------------------------------------------------------------------------------
params:
uses: ./.github/workflows/params.yml
uses: ./.github/workflows/params-nightly_tags.yml
# -----------------------------------------------------------------------------------------------

View File

@@ -0,0 +1,76 @@
---
# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: params
# -------------------------------------------------------------------------------------------------
# Custom Variables
# -------------------------------------------------------------------------------------------------
env:
MATRIX: >-
[
{
"NAME": "PHP",
"VERSION": ["5.2"],
"FLAVOUR": ["default"],
"ARCH": ["linux/amd64"]
},
{
"NAME": "PHP",
"VERSION": ["5.3", "5.4", "5.5", "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"],
"FLAVOUR": ["default"],
"ARCH": ["linux/amd64"]
}
]
# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
workflow_call:
outputs:
matrix:
description: "The determined version matrix"
value: ${{ jobs.params.outputs.matrix }}
refs:
description: "The determined git ref matrix (only during scheduled run)"
value: ${{ jobs.params.outputs.refs }}
jobs:
params:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
refs: ${{ steps.set-refs.outputs.matrix }}
steps:
- name: "[Set-Output] Matrix"
id: set-matrix
run: |
echo "::set-output name=matrix::$( echo '${{ env.MATRIX }}' | jq -M -c )"
- name: "[Set-Output] Matrix 'Refs' (master branch and latest tag)"
id: set-refs
uses: cytopia/git-ref-matrix-action@v0.1.4
with:
repository_default_branch: master
branches: master
num_latest_tags: 0
if: github.event_name == 'schedule'
- name: "[DEBUG] Show settings'"
run: |
echo 'Matrix'
echo '--------------------'
echo '${{ steps.set-matrix.outputs.matrix }}'
echo
echo 'Matrix: Refs'
echo '--------------------'
echo '${{ steps.set-matrix-refs.outputs.matrix }}'
echo

View File

@@ -0,0 +1,76 @@
---
# -------------------------------------------------------------------------------------------------
# Job Name
# -------------------------------------------------------------------------------------------------
name: params
# -------------------------------------------------------------------------------------------------
# Custom Variables
# -------------------------------------------------------------------------------------------------
env:
MATRIX: >-
[
{
"NAME": "PHP",
"VERSION": ["5.2"],
"FLAVOUR": ["default"],
"ARCH": ["linux/amd64"]
},
{
"NAME": "PHP",
"VERSION": ["5.3", "5.4", "5.5", "5.6", "7.0", "7.1", "7.2", "7.3", "7.4", "8.0", "8.1", "8.2"],
"FLAVOUR": ["default"],
"ARCH": ["linux/amd64"]
}
]
# -------------------------------------------------------------------------------------------------
# When to run
# -------------------------------------------------------------------------------------------------
on:
workflow_call:
outputs:
matrix:
description: "The determined version matrix"
value: ${{ jobs.params.outputs.matrix }}
refs:
description: "The determined git ref matrix (only during scheduled run)"
value: ${{ jobs.params.outputs.refs }}
jobs:
params:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
refs: ${{ steps.set-refs.outputs.matrix }}
steps:
- name: "[Set-Output] Matrix"
id: set-matrix
run: |
echo "::set-output name=matrix::$( echo '${{ env.MATRIX }}' | jq -M -c )"
- name: "[Set-Output] Matrix 'Refs' (master branch and latest tag)"
id: set-refs
uses: cytopia/git-ref-matrix-action@v0.1.4
with:
repository_default_branch: master
branches: ""
num_latest_tags: 1
if: github.event_name == 'schedule'
- name: "[DEBUG] Show settings'"
run: |
echo 'Matrix'
echo '--------------------'
echo '${{ steps.set-matrix.outputs.matrix }}'
echo
echo 'Matrix: Refs'
echo '--------------------'
echo '${{ steps.set-matrix-refs.outputs.matrix }}'
echo