diff --git a/.github/workflows/apicula.yml b/.github/workflows/apicula.yml new file mode 100644 index 00000000..ca0f2552 --- /dev/null +++ b/.github/workflows/apicula.yml @@ -0,0 +1,92 @@ +# Authors: +# Unai Martinez-Corral +# Lucas Teske +# +# Copyright 2019-2021 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: 'apicula' + +on: + pull_request: + push: + schedule: + - cron: '0 0 * * 5' + workflow_dispatch: + repository_dispatch: + types: [ apicula ] + +env: + DOCKER_BUILDKIT: 1 + +jobs: + + apicula: + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + os: + - debian-buster + steps: + + - uses: actions/checkout@v2 + with: + submodules: recursive + + - run: echo "$(pwd)/.github/bin" >> $GITHUB_PATH + + - run: dockerBuild -b ${{ matrix.os }} -i pkg:apicula -d apicula -t pkg + - run: dockerBuild -b ${{ matrix.os }} -i apicula -d apicula + + - run: dockerTestPkg ${{ matrix.os }} apicula + - run: dockerTest ${{ matrix.os }} apicula + + - name: Login to ghcr.io + if: github.event_name != 'pull_request' && github.repository == 'hdl/containers' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: gha + password: ${{ github.token }} + + - if: github.event_name != 'pull_request' && github.repository == 'hdl/containers' + run: >- + dockerPush ${{ matrix.os }} + pkg:apicula + apicula + + - name: Login to DockerHub + if: github.event_name != 'pull_request' && github.repository == 'hdl/containers' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASS }} + + # Mirror to docker.io/hdlc + + - name: Login to docker.io + if: github.event_name != 'pull_request' && github.repository == 'hdl/containers' && ${{ matrix.os }} == 'debian-buster' + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USER }} + password: ${{ secrets.DOCKER_PASS }} + + - if: github.event_name != 'pull_request' && github.repository == 'hdl/containers' && ${{ matrix.os }} == 'debian-buster' + run: >- + dockerMirror ${{ matrix.os }} + pkg:apicula + apicula diff --git a/debian-buster/apicula.dockerfile b/debian-buster/apicula.dockerfile new file mode 100644 index 00000000..ccc1b0e8 --- /dev/null +++ b/debian-buster/apicula.dockerfile @@ -0,0 +1,62 @@ +# syntax=docker/dockerfile:1.2 + +# Authors: +# Unai Martinez-Corral +# Lucas Teske +# +# Copyright 2019-2021 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 + +ARG REGISTRY='ghcr.io/hdl/debian-buster' +ARG IMAGE="build:base" + +#--- + +FROM $REGISTRY/build:build AS build + +RUN apt-get update -qq \ + && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ + python3-dev \ + python3-setuptools \ + python3-wheel + +RUN mkdir /opt/apicula /tmp/apicula \ + && curl -fsSL https://files.pythonhosted.org/packages/1a/d6/b3162f87ff114d639095fe7c0655080ee16caff9037d6629f738d8b28d92/Apycula-0.0.1a6.tar.gz | tar -xvzf - --strip-components=1 -C /opt/apicula \ + && cd /opt/apicula \ + && python3 setup.py bdist_wheel \ + && mv dist/*.whl /tmp/apicula/ + +#--- + +FROM scratch AS pkg +COPY --from=build /tmp/apicula /apicula + +#--- + +# WORKAROUND: this is required because '--mount=' does not support ARGs +FROM $REGISTRY/pkg:apicula AS pkg-apicula + +FROM $REGISTRY/$IMAGE + +RUN apt-get update -qq \ + && DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends \ + python3-pip \ + python3-setuptools \ + python3-wheel + +RUN --mount=type=cache,from=pkg-apicula,src=/apicula,target=/tmp/apicula/ \ + pip3 install -U /tmp/apicula/*.whl --progress-bar off \ + && rm -rf ~/.cache diff --git a/doc/development.adoc b/doc/development.adoc index 9b777c99..15ba47e8 100644 --- a/doc/development.adoc +++ b/doc/development.adoc @@ -37,6 +37,11 @@ GHAStatus:verilator[] a|* {blank} + -- +GHAStatus:apicula[] +-- +* {blank} ++ +-- GHAStatus:ghdl-yosys-plugin[] -- * {blank} diff --git a/doc/tools.yml b/doc/tools.yml index 1f310648..826fbf1a 100644 --- a/doc/tools.yml +++ b/doc/tools.yml @@ -254,3 +254,12 @@ z3: - 'formal:min' - 'formal' - 'formal:all' + +#--- + +apicula: + url: 'https://hdl.github.io/awesome/items/apicula' + pkg: + - 'apicula' + use: + - 'apicula' diff --git a/graph/graph.dot b/graph/graph.dot index a806df82..8d6c0238 100644 --- a/graph/graph.dot +++ b/graph/graph.dot @@ -40,6 +40,7 @@ digraph G { "build:build" "build:dev" { node [color=limegreen, fontcolor=limegreen] + "apicula" "arachne-pnr" "ghdl" "ghdl:llvm" @@ -57,6 +58,7 @@ digraph G { "yosys" } { node [color=mediumblue, fontcolor=mediumblue] + "pkg:apicula" "pkg:arachne-pnr" "pkg:boolector" "pkg:cvc4" @@ -186,6 +188,8 @@ digraph G { subgraph cluster_impl { label = "Impl"; m_impl -> { + "apicula" + "pkg:apicula" "arachne-pnr" "pkg:arachne-pnr" "icestorm" diff --git a/graph/impl.dot b/graph/impl.dot index 5abf7fd7..17288ba2 100644 --- a/graph/impl.dot +++ b/graph/impl.dot @@ -25,6 +25,7 @@ digraph G { # Dockerfiles { node [shape=note, color=dodgerblue, fontcolor=dodgerblue] + d_apicula [label="apicula"]; d_arachnepnr [label="arachne-pnr"]; d_icestorm [label="icestorm"]; d_impl [label="impl"]; @@ -40,6 +41,7 @@ digraph G { "build:build" "build:dev" { node [color=limegreen, fontcolor=limegreen] + "apicula" "arachne-pnr" "ghdl:yosys" "icestorm" @@ -52,6 +54,7 @@ digraph G { "nextpnr" } { node [color=mediumblue, fontcolor=mediumblue] + "pkg:apicula" "pkg:arachne-pnr" "pkg:icestorm" "pkg:prjtrellis" @@ -87,6 +90,29 @@ digraph G { # Workflows + subgraph cluster_apicula { + { rank=same + node [shape=cylinder, color=grey, fontcolor=grey] + "p_apicula_build:build" [label="build:build"] + "p_apicula_build:base" [label="build:base"] + "p_apicula_scratch" [label="scratch"] + } + + d_apicula -> { + "apicula" + "pkg:apicula" + } [style=dotted]; + + { rank=same + node [shape=folder, color=red, fontcolor=red] + "t_apicula" [label="apicula"]; + "t_pkg:apicula" [label="apicula.pkg"]; + } + + "apicula" -> "t_apicula"; + "pkg:apicula" -> "t_pkg:apicula"; + } + subgraph cluster_arachenpnr { { rank=same node [shape=cylinder, color=grey, fontcolor=grey] @@ -291,6 +317,10 @@ digraph G { # Dockerfile dependencies + "build:build" -> "p_apicula_build:build" -> d_apicula; + "build:base" -> "p_apicula_build:base" -> d_apicula; + "scratch" -> "p_apicula_scratch" -> d_apicula; + "build:build" -> "p_arachnepnr_build:build" -> d_arachnepnr; "build:base" -> "p_arachnepnr_build:base" -> d_arachnepnr; "scratch" -> "p_arachnepnr_scratch" -> d_arachnepnr; @@ -324,6 +354,9 @@ digraph G { # Image dependencies { edge [style=dashed] + "p_apicula_build:base" -> "apicula"; + "p_apicula_scratch" -> "pkg:apicula"; + "p_arachnepnr_build:base" -> "arachne-pnr"; "p_arachnepnr_scratch" -> "pkg:arachne-pnr"; diff --git a/test/apicula.pkg.sh b/test/apicula.pkg.sh new file mode 100755 index 00000000..b97ad170 --- /dev/null +++ b/test/apicula.pkg.sh @@ -0,0 +1,31 @@ +#!/bin/sh + +# Authors: +# Unai Martinez-Corral +# Lucas Teske +# +# Copyright 2020-2021 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 + +set -e + +cd $(dirname "$0") + +./_tree.sh + +ls -la /*.whl + +./_todo.sh diff --git a/test/apicula.sh b/test/apicula.sh new file mode 100755 index 00000000..3d7af181 --- /dev/null +++ b/test/apicula.sh @@ -0,0 +1,31 @@ +#!/usr/bin/env sh + +# Authors: +# Unai Martinez-Corral +# Lucas Teske +# +# Copyright 2020-2021 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 + +set -e + +cd $(dirname "$0") + +./_env.sh + +./smoke-tests/apicula.sh + +./_todo.sh