Go full build chain

This commit is contained in:
cytopia
2022-03-25 01:43:34 +01:00
parent ff04507e50
commit 29d34dcdb2

View File

@@ -279,7 +279,6 @@ jobs:
uses: actions/download-artifact@v3 uses: actions/download-artifact@v3
with: with:
name: ${{ steps.import.outputs.file }} name: ${{ steps.import.outputs.file }}
path: ${{ steps.import.outputs.file }}
- name: "[Import] load" - name: "[Import] load"
uses: cytopia/shell-command-retry-action@v0.1.2 uses: cytopia/shell-command-retry-action@v0.1.2
@@ -332,6 +331,229 @@ jobs:
path: ${{ steps.artifact.outputs.file }} path: ${{ steps.artifact.outputs.file }}
# -----------------------------------------------------------------------------------------------
# JOB (2/3): BUILD-PROD
# -----------------------------------------------------------------------------------------------
build-prod:
needs: [configure, build-base, build-mods]
name: Build ${{ matrix.name }}-${{ matrix.version }} (${{ matrix.arch }}) ${{ matrix.refs }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.configure.outputs.matrix_build) }}
if: inputs.enabled
steps:
# ------------------------------------------------------------
# Setup repository
# ------------------------------------------------------------
- name: "[SETUP] Checkout repository (current)"
uses: actions/checkout@v3
with:
fetch-depth: 0
if: needs.configure.outputs.has_refs == 0
- name: "[SETUP] Checkout repository (ref: ${{ matrix.refs }})"
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ matrix.refs }}
if: needs.configure.outputs.has_refs != 0
- name: "[SETUP] Setup QEMU environment"
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: "[SETUP] Determine Docker tag"
id: tag
uses: cytopia/docker-tag-action@v0.4.15
# ------------------------------------------------------------
# Import
# ------------------------------------------------------------
- name: "[Import] Set name"
id: import
run: |
PREFIX="${{ needs.configure.outputs.artifact_mods }}"
VERSION="${{ matrix.version }}"
ARCH="${{ matrix.arch }}"
TAG="${{ steps.tag.outputs.docker-tag }}"
NAME="$( echo "${PREFIX}-${VERSION}-${ARCH}-${TAG}" | sed 's|/|-|g' )"
echo "::set-output name=file::${NAME}"
echo "file=${NAME}"
- name: "[Import] Download"
uses: actions/download-artifact@v3
with:
name: ${{ steps.import.outputs.file }}
- name: "[Import] load"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load VERSION=${{ matrix.version }} FLAVOUR=prod ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }} INFILE=${{ steps.import.outputs.file }}
# ------------------------------------------------------------
# Build
# ------------------------------------------------------------
- name: Build
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make build VERSION=${{ matrix.version }} FLAVOUR=prod ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
# ------------------------------------------------------------
# Test
# ------------------------------------------------------------
#- name: Test
# uses: cytopia/shell-command-retry-action@v0.1.2
# with:
# command: |
# make test VERSION=${{ matrix.version }} FLAVOUR=prod ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
# ------------------------------------------------------------
# Export
# ------------------------------------------------------------
- name: "[Artifact] Set name"
id: artifact
run: |
PREFIX="${{ needs.configure.outputs.artifact_prod }}"
VERSION="${{ matrix.version }}"
ARCH="${{ matrix.arch }}"
TAG="${{ steps.tag.outputs.docker-tag }}"
NAME="$( echo "${PREFIX}-${VERSION}-${ARCH}-${TAG}" | sed 's|/|-|g' )"
echo "::set-output name=file::${NAME}"
echo "file=${NAME}"
- name: "[Artifact] Export"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make save VERSION=${{ matrix.version }} FLAVOUR=prod ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }} OUTFILE=${{ steps.artifact.outputs.file }}
- name: "[Artifact] Upload"
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact.outputs.file }}
path: ${{ steps.artifact.outputs.file }}
# -----------------------------------------------------------------------------------------------
# JOB (2/3): BUILD-WORK
# -----------------------------------------------------------------------------------------------
build-work:
needs: [configure, build-base, build-mods, build-prod]
name: Build ${{ matrix.name }}-${{ matrix.version }} (${{ matrix.arch }}) ${{ matrix.refs }}
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.configure.outputs.matrix_build) }}
if: inputs.enabled
steps:
# ------------------------------------------------------------
# Setup repository
# ------------------------------------------------------------
- name: "[SETUP] Checkout repository (current)"
uses: actions/checkout@v3
with:
fetch-depth: 0
if: needs.configure.outputs.has_refs == 0
- name: "[SETUP] Checkout repository (ref: ${{ matrix.refs }})"
uses: actions/checkout@v3
with:
fetch-depth: 0
ref: ${{ matrix.refs }}
if: needs.configure.outputs.has_refs != 0
- name: "[SETUP] Setup QEMU environment"
uses: docker/setup-qemu-action@v1
with:
image: tonistiigi/binfmt:latest
platforms: all
- name: "[SETUP] Determine Docker tag"
id: tag
uses: cytopia/docker-tag-action@v0.4.15
# ------------------------------------------------------------
# Import
# ------------------------------------------------------------
- name: "[Import] Set name"
id: import
run: |
PREFIX="${{ needs.configure.outputs.artifact_prod }}"
VERSION="${{ matrix.version }}"
ARCH="${{ matrix.arch }}"
TAG="${{ steps.tag.outputs.docker-tag }}"
NAME="$( echo "${PREFIX}-${VERSION}-${ARCH}-${TAG}" | sed 's|/|-|g' )"
echo "::set-output name=file::${NAME}"
echo "file=${NAME}"
- name: "[Import] Download"
uses: actions/download-artifact@v3
with:
name: ${{ steps.import.outputs.file }}
- name: "[Import] load"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make load VERSION=${{ matrix.version }} FLAVOUR=work ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }} INFILE=${{ steps.import.outputs.file }}
# ------------------------------------------------------------
# Build
# ------------------------------------------------------------
- name: Build
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make build VERSION=${{ matrix.version }} FLAVOUR=work ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
# ------------------------------------------------------------
# Test
# ------------------------------------------------------------
#- name: Test
# uses: cytopia/shell-command-retry-action@v0.1.2
# with:
# command: |
# make test VERSION=${{ matrix.version }} FLAVOUR=work ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }}
# ------------------------------------------------------------
# Export
# ------------------------------------------------------------
- name: "[Artifact] Set name"
id: artifact
run: |
PREFIX="${{ needs.configure.outputs.artifact_work }}"
VERSION="${{ matrix.version }}"
ARCH="${{ matrix.arch }}"
TAG="${{ steps.tag.outputs.docker-tag }}"
NAME="$( echo "${PREFIX}-${VERSION}-${ARCH}-${TAG}" | sed 's|/|-|g' )"
echo "::set-output name=file::${NAME}"
echo "file=${NAME}"
- name: "[Artifact] Export"
uses: cytopia/shell-command-retry-action@v0.1.2
with:
command: |
make save VERSION=${{ matrix.version }} FLAVOUR=work ARCH=${{ matrix.arch }} TAG=${{ steps.tag.outputs.docker-tag }} OUTFILE=${{ steps.artifact.outputs.file }}
- name: "[Artifact] Upload"
uses: actions/upload-artifact@v3
with:
name: ${{ steps.artifact.outputs.file }}
path: ${{ steps.artifact.outputs.file }}
# # ------------------------------------------------------------ # # ------------------------------------------------------------
# # Deploy # # Deploy
# # ------------------------------------------------------------ # # ------------------------------------------------------------