Setup Github release and enable systemwide installation #5855
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: 'main' | |
run-name: ${{ github.event_name == 'workflow_dispatch' && github.ref_name || '' }} | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
pull_request: | |
concurrency: | |
group: ${{ github.repository }}-${{ github.workflow }}-${{ github.ref }} | |
cancel-in-progress: true | |
env: | |
GHA_CUSTOM_LINE_PREFIX: "▌" | |
jobs: | |
emit-workflow-info: | |
name: Emit Workflow Info | |
if: ${{ github.event_name == 'workflow_dispatch' }} | |
runs-on: [self-hosted, Linux, X64, gcp-custom-runners] | |
container: 'bitnami/git:2.40.1-debian-11-r4' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: false | |
fetch-depth: 1 | |
style-check: | |
name: Style check | |
runs-on: [self-hosted, Linux, X64, gcp-custom-runners] | |
container: bitnami/git:2.40.1-debian-11-r4 | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 1 | |
- name: Install dependencies | |
run: | | |
apt-get update -q | |
apt-get install -y git clang-format python3 jq | |
- name: Sources format check | |
run: | | |
./.github/scripts/format_sources.sh | |
if ! git diff --exit-code; then | |
echo | |
echo "Format locally using: ./.github/scripts/format_sources.sh" | |
echo | |
false | |
fi | |
- name: Sort check | |
run: | | |
./.github/scripts/sort_passlists.sh | |
if ! git diff --exit-code; then | |
echo | |
echo "Sort locally using: ./.github/scripts/sort_passlists.sh" | |
echo | |
false | |
fi | |
build-binaries: | |
strategy: | |
matrix: | |
include: | |
- name: 'Build Synlig Release' | |
artifact-name: 'binaries-release' | |
apt-extra-deps: 'gcc g++' | |
cc: 'gcc' | |
cxx: 'g++' | |
build-binaries-args: 'install install@surelog PREFIX=out' | |
- name: 'Build Plugin' | |
artifact-name: 'binaries-plugin' | |
cc: 'gcc' | |
cxx: 'g++' | |
apt-extra-deps: 'gcc g++' | |
build-binaries-args: 'plugin install@surelog PREFIX=out' | |
- name: 'Build Synlig (ASAN)' | |
artifact-name: 'binaries-asan' | |
cc: 'clang-15' | |
cxx: 'clang++-15' | |
apt-extra-deps: 'clang-15' | |
build-binaries-args: 'install install@surelog ENABLE_ASAN=1 CFG_BUILD_TYPE=asan PREFIX=out' | |
- name: 'Build Package' | |
artifact-name: 'binaries-package' | |
apt-extra-deps: 'gcc g++' | |
cc: 'gcc' | |
cxx: 'g++' | |
build-binaries-args: 'install DESTDIR=out' | |
name: ${{ matrix.name }} | |
runs-on: [self-hosted, Linux, X64, gcp-custom-runners] | |
container: debian:bookworm | |
env: | |
CC: ${{ matrix.cc }} | |
CXX: ${{ matrix.cxx }} | |
BUILD_BINARIES_ARGS: ${{ matrix.build-binaries-args }} | |
CCACHE_DIR: "${{ github.workspace }}/.cache/" | |
DEBIAN_FRONTEND: noninteractive | |
GHA_MACHINE_TYPE: "n2-highmem-8" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: false | |
fetch-depth: 1 | |
- name: Set up common configuration | |
run: | | |
./.github/scripts/set-up-common-debian-configuration.sh | |
./.github/scripts/set-up-common-git-configuration.sh | |
- name: Install dependencies | |
run: | | |
apt-get update -q | |
apt-get install -y \ | |
ant \ | |
bison \ | |
build-essential \ | |
ccache \ | |
cmake \ | |
default-jre \ | |
flex \ | |
git \ | |
google-perftools \ | |
libffi-dev \ | |
libfl-dev \ | |
libgoogle-perftools-dev \ | |
libreadline-dev \ | |
pkg-config \ | |
python3 \ | |
python3-dev \ | |
python3-pip \ | |
python3-orderedmultidict \ | |
swig \ | |
tcl-dev \ | |
tclsh \ | |
uuid \ | |
uuid-dev \ | |
wget \ | |
${{ matrix.apt-extra-deps }} \ | |
; | |
- name: Checkout submodules | |
run: | | |
git submodule sync | |
git submodule update --depth 1 --init --recursive --checkout \ | |
third_party/{surelog,yosys} \ | |
; | |
- name: Setup cache | |
uses: actions/cache@v2 | |
with: | |
path: ${{ env.CCACHE_DIR }} | |
key: cache_${{ matrix.artifact-name }}_${{ github.run_id }} | |
restore-keys: cache_${{ matrix.artifact-name }}_ | |
- name: Build binaries | |
run: | | |
export PATH="/usr/lib/ccache:/usr/local/opt/ccache/libexec:$PATH" | |
make -j $(nproc) ${BUILD_BINARIES_ARGS} | |
# By default actions/upload-artifact@v2 do not preserve file permissions | |
# tar directory to workaround this issue | |
# See https://github.com/actions/upload-artifact/issues/38 | |
tar -cvf ${{ matrix.artifact-name }}.tar out | |
- name: Upload binaries | |
uses: actions/upload-artifact@v2 | |
with: | |
name: ${{ matrix.artifact-name }} | |
path: | | |
${{ matrix.artifact-name }}.tar | |
- name: Upload load graphs | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: plots | |
path: | | |
**/plot_*.svg | |
build-tools: | |
name: Build tools | |
runs-on: [self-hosted, Linux, X64, gcp-custom-runners] | |
container: debian:bookworm | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
GHA_MACHINE_TYPE: "n2-standard-4" | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: false | |
fetch-depth: 1 | |
- name: Set up common Debian configuration | |
run: | | |
./.github/scripts/set-up-common-debian-configuration.sh | |
./.github/scripts/set-up-common-git-configuration.sh | |
- name: Install dependencies | |
run: | | |
apt-get update -q | |
apt-get install -y \ | |
ant \ | |
bison \ | |
build-essential \ | |
ccache \ | |
cmake \ | |
default-jre \ | |
flex \ | |
git \ | |
gcc \ | |
g++ \ | |
google-perftools \ | |
libffi-dev \ | |
libfl-dev \ | |
libgoogle-perftools-dev \ | |
libreadline-dev \ | |
pkg-config \ | |
python3 \ | |
python3-dev \ | |
python3-pip \ | |
python3-orderedmultidict \ | |
swig \ | |
tcl-dev \ | |
tclsh \ | |
uuid \ | |
uuid-dev \ | |
wget \ | |
; | |
- name: Checkout submodules | |
run: | | |
git submodule sync | |
git submodule update --depth 1 --init --recursive --checkout \ | |
third_party/sv2v \ | |
third_party/yosys \ | |
; | |
- name: Build sv2v | |
run: | | |
export PATH=$PWD/install/bin:/usr/local/bin:${PATH} | |
wget -qO- https://get.haskellstack.org/ | sh -s - -f -d /usr/local/bin | |
make install@sv2v -j $(nproc) | |
- name: Build tools | |
run: | | |
make install@yosys-tools -j $(nproc) | |
- name: Pack tools | |
run: | | |
tar -cvf tools.tar out | |
- name: Upload binaries | |
uses: actions/upload-artifact@v2 | |
with: | |
name: tools | |
path: | | |
tools.tar | |
- name: Upload load graphs | |
if: ${{ !cancelled() }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: plots | |
path: | | |
**/plot_*.svg | |
tests-parsing: | |
name: Parsing Tests | |
uses: ./.github/workflows/parsing-tests.yml | |
secrets: | |
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }} | |
permissions: | |
pull-requests: write | |
needs: build-binaries | |
tests-formal-verification: | |
name: Formal Verification Tests | |
uses: ./.github/workflows/formal-verification.yml | |
needs: | |
- build-binaries | |
- build-tools | |
tests-bsg-micro-designs-diff: | |
name: Diff generated BSG Micro Designs tests | |
uses: ./.github/workflows/bsg-test-diff.yml | |
needs: | |
- build-binaries | |
tests-large-designs: | |
name: Large Designs Tests | |
uses: ./.github/workflows/large-designs.yml | |
needs: build-binaries | |
release: | |
permissions: | |
contents: write | |
name: Release Package | |
needs: | |
- build-binaries | |
- tests-parsing | |
- tests-formal-verification | |
- tests-large-designs | |
runs-on: ubuntu-22.04 | |
if: ${{github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/master')}} | |
steps: | |
- uses: actions/checkout@v2 | |
with: | |
# Download complete repository + tags | |
fetch-depth: 0 | |
- name: Download artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: binaries-package | |
# See https://github.com/actions/upload-artifact/issues/38 | |
- name: Extract | |
run: | | |
tar -xf binaries-package.tar | |
- name: Prepare tarball | |
run: | | |
(cd out && tar -zcvf release.tar.gz usr) | |
- name: Name tarball and apply TAG | |
run: | | |
GIT_VERSION=${GIT_VERSION:-$(git rev-parse --short "$GITHUB_SHA")} | |
DATE=$(git show -s --date=short --format=%cd) | |
FULL_TARBALL=synlig-$GIT_VERSION-$DATE.tar.gz | |
# Create a tag of form 2021-12-06-ad2466e | |
TAG="${TAG:-$(git show -s --date=short --format=%cd-%h)}" | |
git tag "$TAG" || true | |
echo "TAG=$TAG" >> $GITHUB_ENV | |
mv out/release.tar.gz $FULL_TARBALL | |
tar -tvf $FULL_TARBALL | |
- name: Get PR data | |
uses: 8BitJonny/[email protected] | |
with: | |
sha: ${{ github.event.pull_request.head.sha }} | |
id: release_pr | |
- name: Deploy release | |
env: | |
RELEASE_NAME: > | |
${{ steps.release_pr.outputs.pr_found == 'true' | |
&& | |
format('{0}: #{1}: {2}', | |
env.TAG, | |
steps.release_pr.outputs.number, | |
steps.release_pr.outputs.pr_title) | |
|| | |
env.TAG }} | |
RELEASE_BODY: > | |
${{ steps.release_pr.outputs.pr_found == 'true' | |
&& | |
steps.release_pr.outputs.pr_body | |
|| | |
'' }} | |
uses: svenstaro/upload-release-action@v2 | |
with: | |
repo_token: ${{ secrets.GITHUB_TOKEN }} | |
file: synlig-*.tar.gz | |
tag: ${{ env.TAG }} | |
release_name: ${{ env.RELEASE_NAME }} | |
body: ${{ env.RELEASE_BODY }} | |
overwrite: true | |
file_glob: true | |
# Synlig requires yosys version 0.40 or later | |
# which is currently not available in debian repositories. | |
# This test can be uncommented when required version will be available. | |
# test-release-with-packaged-yosys: | |
# name: Release Package Installation Test | |
# runs-on: [self-hosted, Linux, X64] | |
# container: debian:sid | |
# needs: release | |
# env: | |
# DEBIAN_FRONTEND: noninteractive | |
# PIPX_BIN_DIR: /usr/local/bin | |
# | |
# steps: | |
# - name: Prepare Repository | |
# uses: actions/checkout@v2 | |
# with: | |
# fetch-depth: 1 | |
# | |
# - name: Install Prerequisites | |
# run: | | |
# apt update -qq | |
# apt install -y --no-install-recommends pipx git | |
# pipx install git+https://github.com/antmicro/tuttest#egg=tuttest | |
# | |
# - name: Install Dependencies | |
# run: | | |
# tuttest README.md install-yosys-debian | bash - | |
# | |
# - name: Install Plugin | |
# run: | | |
# tuttest README.md download-plugin | bash - | |
# tuttest README.md install-plugin | bash - | |
# | |
# - name: Load Plugin | |
# run: | | |
# tuttest README.md load-plugin | yosys -Q | tee log.txt | |
# grep ^ERROR log.txt || exit 0 | |
# exit 1 | |
# | |
# - name: Test Plugin | |
# run: | | |
# tuttest README.md example-verilog | bash - | |
# tuttest README.md example-multiple-files | yosys | |
# | |
# - name: Test sv2v pull and build | |
# run: | | |
# export PATH=`pwd`/out/current/bin:$PATH | |
# tuttest README.md sv2v-update | bash - | |
# tuttest README.md sv2v-build | bash - | |
test-readme-install-from-source: | |
name: Test "Installation from source" from README | |
runs-on: [self-hosted, Linux, X64, gcp-custom-runners] | |
container: debian:trixie | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
PIPX_BIN_DIR: /usr/local/bin | |
steps: | |
- name: Prepare Repository | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 1 | |
- name: Install Prerequisites | |
run: | | |
apt update -qq | |
apt install -y --no-install-recommends pipx git | |
pipx install git+https://github.com/antmicro/tuttest#egg=tuttest | |
- name: Install Dependencies | |
run: | | |
tuttest README.md dependencies | bash - | |
- name: Build Binaries | |
run: | | |
tuttest README.md build-binaries | bash - | |
- name: Test Binaries | |
run: | | |
tuttest README.md load-plugin | (. <(tuttest README.md path-setup) && yosys) | |
(tuttest README.md path-setup; tuttest README.md example-verilog) | bash - | |
(tuttest README.md path-setup; tuttest README.md example-uhdm-ver1) | bash - | |
(tuttest README.md path-setup; tuttest README.md example-uhdm-ver2) | bash - | |
tuttest README.md example-multiple-files | (. <(tuttest README.md path-setup) && yosys) | |
# Synlig requires yosys version 0.40 or later | |
# which is currently not available in debian repositories. | |
# This test can be uncommented when required version will be available. | |
# test-plugin-with-packaged-yosys: | |
# name: Test With Packaged Yosys | |
# runs-on: [self-hosted, Linux, X64] | |
# container: debian:sid | |
# needs: build-binaries | |
# env: | |
# DEBIAN_FRONTEND: noninteractive | |
# PIPX_BIN_DIR: /usr/local/bin | |
# | |
# steps: | |
# - uses: actions/checkout@v3 | |
# with: | |
# submodules: false | |
# fetch-depth: 1 | |
# | |
# - name: Download binaries | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: binaries-debian | |
# | |
# - name: Extract | |
# run: tar -xf binaries-debian.tar | |
# | |
# - name: Install Yosys & Plugin | |
# run: | | |
# apt update -q | |
# apt install -y yosys yosys-dev | |
# ./install_plugin.sh | |
# | |
# - name: Load Plugin | |
# run: | | |
# yosys -Q -m systemverilog \ | |
# -p "help read_systemverilog" \ | |
# -p "help read_uhdm" 2>&1 | tee log.txt | |
# grep ^ERROR log.txt || exit 0 | |
# exit 1 | |
test-plugin-with-bundled-yosys: | |
name: Test With Bundled Yosys | |
runs-on: [self-hosted, Linux, X64, gcp-custom-runners] | |
container: debian:trixie | |
needs: build-binaries | |
env: | |
DEBIAN_FRONTEND: noninteractive | |
PIPX_BIN_DIR: /usr/local/bin | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: false | |
fetch-depth: 1 | |
- name: Install Prerequisites | |
run: | | |
apt update -qq | |
apt install -y --no-install-recommends pipx git | |
pipx install git+https://github.com/antmicro/tuttest#egg=tuttest | |
- name: Install Dependencies | |
run: | | |
# Don't need all the build dependencies, but will ensure everything | |
# yosys needs at runtime will be installed | |
tuttest README.md dependencies | bash - | |
- name: Download binaries | |
uses: actions/download-artifact@v2 | |
with: | |
name: binaries-plugin | |
- name: Extract | |
run: | | |
# Extract into a different directory than it was built in | |
# to ensure no path dependencies | |
tar --one-top-level -xf binaries-plugin.tar | |
- name: Verify yosys-config | |
run: | | |
# Check that the directories reported by yosys-config exist | |
echo "yosys-config reports data directory is" $(binaries-debian/out/current/bin/yosys-config --datdir) | |
ls $(binaries-debian/out/current/bin/yosys-config --datdir) > /dev/null | |
- name: Load Plugin | |
run: | | |
binaries-debian/out/current/bin/yosys \ | |
-Q -m systemverilog \ | |
-p "help read_systemverilog" \ | |
-p "help read_uhdm" 2>&1 | tee log.txt | |
grep ^ERROR log.txt || exit 0 | |
exit 1 | |
# needed for test linting | |
upload-event-file: | |
name: Upload GHA event file | |
runs-on: ubuntu-latest | |
steps: | |
- run: cp "$GITHUB_EVENT_PATH" ./event.json | |
- name: Upload event file as artifact | |
uses: actions/upload-artifact@v2 | |
with: | |
name: event.json | |
path: event.json |