Skip to content

[xschem] a3048a30 WIP results #444

[xschem] a3048a30 WIP results

[xschem] a3048a30 WIP results #444

# Authors:
# Unai Martinez-Corral
# <umartinezcorral@antmicro.com>
# <unai.martinezcorral@ehu.eus>
#
# Copyright Unai Martinez-Corral
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
# SPDX-License-Identifier: Apache-2.0
name: .build-test-release
run-name: '[${{ inputs.key }}] ${{ inputs.message }}'
on:
workflow_call:
inputs: &inputs
key:
description: 'Name of the job in the configuration.'
required: true
type: string
skip-test:
description: 'Skip testing the built images.'
required: false
default: false
type: string
skip-release:
description: 'Skip pushing and mirroring to container registries.'
required: false
default: false
type: string
# NOTE:
# This input is not used by the worflow_call but only by the workflow_dispatch.
# However, in order to use an anchor in GitHub Actions both events need to have exactly the same key-values;
# that's because GiHub did not implement merge keys despite taking more than 4 years to support YAML anchors.
message:
description: 'Message to show in the name of the run.'
required: false
default: "dispatched"
type: string
workflow_dispatch:
inputs: *inputs
env:
DOCKER_BUILDKIT: 1
jobs:
matrix:
runs-on: ubuntu-latest
outputs:
skip: ${{ steps.skipper.outputs.skip }}
matrix: ${{ steps.generate.outputs.matrix }}
name: ${{ inputs.key }}-matrix
steps:
- name: ❔ Skipper
if: github.event_name == 'workflow_dispatch'
id: skipper
shell: python
run: |
from os import environ
tsha = "${{ inputs.message }}".split(" ")[0]
if tsha != 'dispatched':
csha = "${{ github.sha }}"[0:8]
if tsha and (csha != tsha):
with open(environ["GITHUB_STEP_SUMMARY"], 'a', encoding='utf-8') as ghs:
ghs.write(f"Trigger `{tsha}` and current `{csha}` SHA mismatch!")
with open(environ['GITHUB_OUTPUT'], 'a', encoding='utf-8') as gho:
gho.write("skip=true\n")
exit(1)
- name: ⚙️ Generate matrix
id: generate
uses: $/.github/generate-matrix
with:
key: ${{ inputs.key }}
jobs:
needs: matrix
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include: ${{ fromJSON(needs.matrix.outputs.matrix) }}
name: ${{ matrix.arch }}/${{ matrix.os }} | ${{ matrix.imgs }}
steps:
- name: 📄 Build, test and release
uses: $/.github/build-test-release
with:
gh_token: '${{ github.token }}'
docker_user: '${{ secrets.DOCKER_USER }}'
docker_pass: '${{ secrets.DOCKER_PASS }}'
skip-test: ${{ inputs.skip-test }}
skip-release: ${{ inputs.skip-release }}
architecture: ${{ matrix.arch }}
collection: ${{ matrix.os }}
images: ${{ matrix.imgs }}
key: ${{ inputs.key }}
results:
needs:
- matrix
- jobs
if: >-
!cancelled() &&
needs.matrix.outputs.skip != 'true'
runs-on: ubuntu-latest
name: ${{ inputs.key }}-results
steps:
- name: '📥 Download artifact(s): Summary'
uses: actions/download-artifact@v8
with:
pattern: Summary_${{ inputs.key }}_*
merge-multiple: true
- name: 📑 Process artifacts
uses: $/.github/self-script
with:
scriptfile: summary.py
env:
GH_OUTPUT_MATRIX: ${{ needs.matrix.outputs.matrix }}