Skip to content

Add Apicula for Gowin FPGA Devices #11

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Apr 8, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
92 changes: 92 additions & 0 deletions .github/workflows/apicula.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
# Authors:
# Unai Martinez-Corral
# Lucas Teske
#
# Copyright 2019-2021 Unai Martinez-Corral <[email protected]>
#
# 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
62 changes: 62 additions & 0 deletions debian-buster/apicula.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
# syntax=docker/dockerfile:1.2

# Authors:
# Unai Martinez-Corral
# Lucas Teske
#
# Copyright 2019-2021 Unai Martinez-Corral <[email protected]>
#
# 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
5 changes: 5 additions & 0 deletions doc/development.adoc
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,11 @@ GHAStatus:verilator[]
a|* {blank}
+
--
GHAStatus:apicula[]
--
* {blank}
+
--
GHAStatus:ghdl-yosys-plugin[]
--
* {blank}
Expand Down
9 changes: 9 additions & 0 deletions doc/tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -254,3 +254,12 @@ z3:
- 'formal:min'
- 'formal'
- 'formal:all'

#---

apicula:
url: 'https://hdl.github.io/awesome/items/apicula'
pkg:
- 'apicula'
use:
- 'apicula'
4 changes: 4 additions & 0 deletions graph/graph.dot
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,7 @@ digraph G {
"build:build"
"build:dev"
{ node [color=limegreen, fontcolor=limegreen]
"apicula"
"arachne-pnr"
"ghdl"
"ghdl:llvm"
Expand All @@ -57,6 +58,7 @@ digraph G {
"yosys"
}
{ node [color=mediumblue, fontcolor=mediumblue]
"pkg:apicula"
"pkg:arachne-pnr"
"pkg:boolector"
"pkg:cvc4"
Expand Down Expand Up @@ -186,6 +188,8 @@ digraph G {
subgraph cluster_impl {
label = "Impl";
m_impl -> {
"apicula"
"pkg:apicula"
"arachne-pnr"
"pkg:arachne-pnr"
"icestorm"
Expand Down
33 changes: 33 additions & 0 deletions graph/impl.dot
Original file line number Diff line number Diff line change
Expand Up @@ -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"];
Expand All @@ -40,6 +41,7 @@ digraph G {
"build:build"
"build:dev"
{ node [color=limegreen, fontcolor=limegreen]
"apicula"
"arachne-pnr"
"ghdl:yosys"
"icestorm"
Expand All @@ -52,6 +54,7 @@ digraph G {
"nextpnr"
}
{ node [color=mediumblue, fontcolor=mediumblue]
"pkg:apicula"
"pkg:arachne-pnr"
"pkg:icestorm"
"pkg:prjtrellis"
Expand Down Expand Up @@ -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]
Expand Down Expand Up @@ -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;
Expand Down Expand Up @@ -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";

Expand Down
31 changes: 31 additions & 0 deletions test/apicula.pkg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/bin/sh

# Authors:
# Unai Martinez-Corral
# Lucas Teske
#
# Copyright 2020-2021 Unai Martinez-Corral <[email protected]>
#
# 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
31 changes: 31 additions & 0 deletions test/apicula.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
#!/usr/bin/env sh

# Authors:
# Unai Martinez-Corral
# Lucas Teske
#
# Copyright 2020-2021 Unai Martinez-Corral <[email protected]>
#
# 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