Merge pull request #323 from antmicro/umarcor/ci/inputs

ci/sphinx-tuttest: reduce duplication
This commit is contained in:
Tomasz Michalak 2022-06-20 18:08:48 +02:00 committed by GitHub
commit e6070a4657
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
5 changed files with 173 additions and 218 deletions

View File

@ -124,39 +124,6 @@ if [ "$fpga_family" = "xc7" ]; then
"hello-k")
snippets="${activate_env} projf-makefiles/hello/hello-arty/K/README.rst:hello-arty-k"
;;
"hello-l")
snippets="${activate_env} projf-makefiles/hello/hello-arty/L/README.rst:hello-arty-l"
;;
"hello-b")
snippets="${activate_env} projf-makefiles/hello/hello-arty/B/README.rst:hello-arty-b"
;;
"hello-c")
snippets="${activate_env} projf-makefiles/hello/hello-arty/C/README.rst:hello-arty-c"
;;
"hello-d")
snippets="${activate_env} projf-makefiles/hello/hello-arty/D/README.rst:hello-arty-d"
;;
"hello-e")
snippets="${activate_env} projf-makefiles/hello/hello-arty/E/README.rst:hello-arty-e"
;;
"hello-f")
snippets="${activate_env} projf-makefiles/hello/hello-arty/F/README.rst:hello-arty-f"
;;
"hello-g")
snippets="${activate_env} projf-makefiles/hello/hello-arty/G/README.rst:hello-arty-g"
;;
"hello-h")
snippets="${activate_env} projf-makefiles/hello/hello-arty/H/README.rst:hello-arty-h"
;;
"hello-i")
snippets="${activate_env} projf-makefiles/hello/hello-arty/I/README.rst:hello-arty-i"
;;
"hello-j")
snippets="${activate_env} projf-makefiles/hello/hello-arty/J/README.rst:hello-arty-j"
;;
"hello-k")
snippets="${activate_env} projf-makefiles/hello/hello-arty/K/README.rst:hello-arty-k"
;;
"hello-l")
snippets="${activate_env} projf-makefiles/hello/hello-arty/L/README.rst:hello-arty-l"
;;

123
.github/scripts/generate_job_matrices.py vendored Executable file
View File

@ -0,0 +1,123 @@
#!/usr/bin/env python3
#
# Copyright (C) 2021-2022 F4PGA Authors
#
# 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
#
# https://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
from os import environ
from sys import argv as sys_argv
isFork = len(sys_argv)>1 and sys_argv[1] != 'chipsalliance/f4pga-examples'
runs_on = (
'ubuntu-latest'
if isFork else
['self-hosted', 'Linux', 'X64']
)
def get_jobs(
distribution: str = 'debian',
usesSurelog: bool = False
):
examples = [
"pulse_width_led",
"hello-a",
"hello-b",
"hello-c",
"hello-d",
"hello-e",
"hello-f",
"hello-g",
"hello-h",
"hello-i",
"hello-j",
]
# Skip tests that are currently unsupported
if not usesSurelog:
examples.extend([
"litex",
"picosoc",
"litex_linux",
"button_controller",
"timer",
"hello-k",
"hello-l"
])
jobs = []
osvers = []
if distribution == "debian":
osvers.extend([
("debian", "buster"),
("debian", "bullseye"),
("debian", "sid")
])
elif distribution == "ubuntu":
osvers.extend([
("ubuntu", "focal")
])
elif distribution == "fedora":
osvers.extend([
("fedora", "35"),
("fedora", "36")
])
if not isFork:
examples.extend(["counter"])
# Skip tests that are currently unsupported
if not usesSurelog:
examples.extend(["litex_sata"])
if distribution == "ubuntu":
osvers.extend([
("ubuntu", "xenial"),
("ubuntu", "bionic"),
])
elif distribution == "centos":
osvers.extend([
("centos", "7")
])
for osver in osvers:
jobs.extend([{
'name': "Surelog" if usesSurelog else "Default",
'runs-on': runs_on,
'fpga-fam': "xc7",
'os': osver[0],
'os-version': osver[1],
'example': example,
'surelog': "-parse -DSYNTHESIS" if usesSurelog else ""
} for example in examples])
jobs.extend([{
'name': "Surelog" if usesSurelog else "Default",
'runs-on': runs_on,
'fpga-fam': "eos-s3",
'os': osver[0],
'os-version': osver[1],
'example': "counter",
'surelog': "-parse -DSYNTHESIS" if usesSurelog else ""
} for osver in osvers])
return jobs
for distribution in ['debian', 'ubuntu', 'fedora', 'centos']:
jobs = get_jobs(distribution, False) + get_jobs(distribution, True)
print(f'::set-output name={distribution}::{jobs!s}')
print(f"{distribution}: {jobs!s}")

View File

@ -1,103 +0,0 @@
#!/usr/bin/env python3
#
# Copyright (C) 2021-2022 F4PGA Authors
#
# 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
#
# https://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
from sys import argv as sys_argv
isFork = len(sys_argv)>1 and sys_argv[1] != 'chipsalliance/f4pga-examples'
usesSurelog = len(sys_argv)>2 and sys_argv[2] == 'Surelog'
runs_on = (
'ubuntu-latest'
if isFork else
['self-hosted', 'Linux', 'X64']
)
examples = [
"pulse_width_led",
"hello-a",
"hello-b",
"hello-c",
"hello-d",
"hello-e",
"hello-f",
"hello-g",
"hello-h",
"hello-i",
"hello-j",
]
# Skip tests that are currently unsupported
if not usesSurelog:
examples = [
"litex",
"picosoc",
"litex_linux",
"button_controller",
"timer",
"hello-k",
"hello-l"
] + examples
jobs = []
osvers = [
("ubuntu", "focal"),
("debian", "buster"),
("debian", "bullseye"),
("debian", "sid"),
("fedora", "35"),
("fedora", "36"),
]
if not isFork:
examples = [
"counter",
] + examples
# Skip tests that are currently unsupported
if not usesSurelog:
examples = [
"litex_sata",
] + examples
osvers += [
("ubuntu", "xenial"),
("ubuntu", "bionic"),
("centos", "7"),
]
for osver in osvers:
jobs += [{
'runs-on': runs_on,
'fpga-fam': "xc7",
'os': osver[0],
'os-version': osver[1],
'example': example
} for example in examples]
jobs += [{
'runs-on': runs_on,
'fpga-fam': "eos-s3",
'os': osver[0],
'os-version': osver[1],
'example': "counter"
} for osver in osvers]
print(f'::set-output name=matrix::{jobs!s}')
print(str(jobs))

View File

@ -14,13 +14,51 @@ on:
jobs:
Pipeline:
Matrices:
if: ${{ !(github.event_name != 'pull_request' && github.actor == 'dependabot[bot]') }}
runs-on: ubuntu-latest
outputs:
debian: ${{ steps.generate.outputs.debian }}
ubuntu: ${{ steps.generate.outputs.ubuntu }}
fedora: ${{ steps.generate.outputs.fedora }}
centos: ${{ steps.generate.outputs.centos }}
steps:
- uses: actions/checkout@v3
- id: generate
run: ./.github/scripts/generate_job_matrices.py '${{ github.repository }}'
Debian:
needs: Matrices
uses: ./.github/workflows/sphinx-tuttest.yml
with:
matrix: ${{ needs.Matrices.outputs.debian }}
Ubuntu:
needs: Matrices
uses: ./.github/workflows/sphinx-tuttest.yml
with:
matrix: ${{ needs.Matrices.outputs.ubuntu }}
Fedora:
needs: Matrices
uses: ./.github/workflows/sphinx-tuttest.yml
with:
matrix: ${{ needs.Matrices.outputs.fedora }}
Centos:
needs: Matrices
uses: ./.github/workflows/sphinx-tuttest.yml
with:
matrix: ${{ needs.Matrices.outputs.centos }}
Automerge:
needs: Pipeline
needs:
- Debian
- Ubuntu
- Fedora
- Centos
if: github.event_name == 'pull_request' && github.actor == 'dependabot[bot]'
runs-on: ubuntu-latest
name: Automerge dependabot PRs

View File

@ -2,98 +2,28 @@ name: doc-test
on:
workflow_call:
inputs:
matrix:
description: 'Distribution to execute tests on'
required: true
type: string
jobs:
Matrix:
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.generate.outputs.matrix }}
surelog-matrix: ${{ steps.generate-surelog.outputs.matrix }}
steps:
- name: Setup repository
uses: actions/checkout@v3
- name: Generate examples matrix
id: generate
run: ./.github/scripts/generate_job_matrix.py '${{ github.repository }}'
- name: Generate examples matrix
id: generate-surelog
run: ./.github/scripts/generate_job_matrix.py '${{ github.repository }}' Surelog
Test:
needs: Matrix
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.Matrix.outputs.matrix) }}
include: ${{ fromJson(inputs.matrix) }}
runs-on: ${{ matrix.runs-on }}
name: ${{ matrix.fpga-fam }} | ${{ matrix.os }} ${{ matrix.os-version }} | ${{ matrix.example }}
name: ${{ matrix.os-version }} | ${{ matrix.name }} | ${{ matrix.fpga-fam }} | ${{ matrix.example }}
env:
LANG: "en_US.UTF-8"
DEBIAN_FRONTEND: "noninteractive"
GHA_PREEMPTIBLE: "false"
SURELOG_CMD: ""
container: ${{matrix.os}}:${{matrix.os-version}}
steps:
- name: Setup repository
uses: actions/checkout@v3
with:
submodules: recursive
- name: Install utils
run: |
case ${{ matrix.os }} in
ubuntu|debian) apt -qqy update && apt -qqy install git wget locales && locale-gen $LANG ;;
centos) yum -y install git wget ;;
fedora) dnf install -y git wget ;;
esac
- name: Install tuttest
run: |
wget https://github.com/antmicro/tuttest/releases/download/v0.2-beta/tuttest -O /usr/bin/tuttest
chmod a+rx /usr/bin/tuttest
- name: Install SymbiFlow toolchain
run: bash .github/scripts/install-toolchain.sh ${{matrix.fpga-fam}} ${{matrix.os}}
- name: Build examples
run: bash .github/scripts/build-examples.sh ${{matrix.fpga-fam}} ${{matrix.example}}
- uses: actions/upload-artifact@v3
with:
name: f4pga-examples-bitstreams
path: '**/*.bit'
- uses: actions/upload-artifact@v3
with:
name: f4pga-examples-plots
path: '**/plot_*.svg'
Test-Surelog:
needs: Matrix
strategy:
fail-fast: false
matrix:
include: ${{ fromJson(needs.Matrix.outputs.surelog-matrix) }}
runs-on: ${{ matrix.runs-on }}
name: Surelog frontend - ${{ matrix.fpga-fam }} | ${{ matrix.os }} ${{ matrix.os-version }} | ${{ matrix.example }}
env:
LANG: "en_US.UTF-8"
DEBIAN_FRONTEND: "noninteractive"
GHA_PREEMPTIBLE: "false"
SURELOG_CMD: "-parse -DSYNTHESIS"
SURELOG_CMD: ${{ matrix.surelog }}
container: ${{matrix.os}}:${{matrix.os-version}}
@ -125,10 +55,10 @@ jobs:
- uses: actions/upload-artifact@v3
with:
name: f4pga-examples-bitstreams-systemverilog-plugin
name: f4pga-examples-bitstreams-${{ matrix.name }}
path: '**/*.bit'
- uses: actions/upload-artifact@v3
with:
name: f4pga-examples-plots-systemverilog-plugin
name: f4pga-examples-plots-${{ matrix.name }}
path: '**/plot_*.svg'