Skip to content

Commit

Permalink
add: gowin nextpnr build
Browse files Browse the repository at this point in the history
  • Loading branch information
racerxdl committed Jan 14, 2021
1 parent 63b9a3a commit ee90e38
Show file tree
Hide file tree
Showing 8 changed files with 236 additions and 5 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/apicula.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Authors:
# Unai Martinez-Corral
# Lucas Teske
#
# Copyright 2019-2021 Unai Martinez-Corral <unai.martinezcorral@ehu.eus>
#
# 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
steps:

- uses: actions/checkout@v2
with:
submodules: recursive

- run: echo "$(pwd)/.github/bin" >> $GITHUB_PATH

- run: dockerBuild pkg:apicula apicula pkg
- run: dockerBuild apicula apicula

- run: dockerTestPkg apicula
- run: dockerTest 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 }}

- run: dockerPush pkg:apicula
if: github.event_name != 'pull_request' && github.repository == 'hdl/containers'

- run: dockerPush apicula
if: github.event_name != 'pull_request' && github.repository == 'hdl/containers'
6 changes: 6 additions & 0 deletions .github/workflows/nextpnr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,15 @@ jobs:
- run: dockerBuild nextpnr:icestorm nextpnr icestorm
- run: dockerBuild nextpnr:ecp5 nextpnr ecp5
- run: dockerBuild nextpnr:prjtrellis nextpnr prjtrellis
- run: dockerBuild nextpnr:gowin nextpnr gowin
- run: dockerBuild nextpnr:apicula nextpnr apicula
- run: dockerBuild nextpnr nextpnr

- run: dockerTest nextpnr:ice40
- run: dockerTest nextpnr:icestorm
- run: dockerTest nextpnr:ecp5
- run: dockerTest nextpnr:prjtrellis
- run: dockerTest nextpnr:gowin
- run: dockerTest nextpnr

- name: Login to DockerHub
Expand All @@ -74,5 +77,8 @@ jobs:
- run: dockerPush nextpnr:prjtrellis
if: github.event_name != 'pull_request' && github.repository == 'hdl/containers'

- run: dockerPush nextpnr:gowin
if: github.event_name != 'pull_request' && github.repository == 'hdl/containers'

- run: dockerPush nextpnr
if: github.event_name != 'pull_request' && github.repository == 'hdl/containers'
40 changes: 40 additions & 0 deletions apicula.dockerfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
# Authors:
# Unai Martinez-Corral
# Lucas Teske
#
# Copyright 2019-2021 Unai Martinez-Corral <unai.martinezcorral@ehu.eus>
#
# 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

FROM hdlc/build:build AS build

RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends python3-setuptools python3-pip

RUN mkdir /tmp/apicula \
&& cd /tmp/apicula \
&& pip3 install apycula --target /tmp/apicula

#---

FROM scratch AS pkg
COPY --from=build /tmp/apicula /apicula

#---

FROM hdlc/build:base
RUN apt-get update -qq \
&& DEBIAN_FRONTEND=noninteractive apt-get -y install --no-install-recommends python3-setuptools python3-pip \
&& pip3 install apycula
40 changes: 36 additions & 4 deletions nextpnr.dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -92,14 +92,43 @@ COPY --from=build-ecp5 /opt/nextpnr /
FROM ecp5 AS prjtrellis
COPY --from=hdlc/pkg:prjtrellis /prjtrellis /


#---

FROM build-ice40 AS build-all
COPY --from=hdlc/pkg:prjtrellis /prjtrellis /
FROM build AS build-gowin
COPY --from=hdlc/apicula /usr/local/bin/gowin* /usr/local/bin
COPY --from=hdlc/apicula /usr/local/lib/python3.7/dist-packages /usr/local/lib/python3.7/dist-packages

RUN mkdir -p /tmp/nextpnr/build \
&& cd /tmp/nextpnr \
&& curl -fsSL https://codeload.github.com/YosysHQ/nextpnr/tar.gz/master | tar xzf - --strip-components=1 \
&& cd build \
&& cmake .. \
-DARCH=gowin \
-DBUILD_GUI=OFF \
-DBUILD_PYTHON=ON \
-DUSE_OPENMP=ON \
&& make -j $(nproc) \
&& make DESTDIR=/opt/nextpnr install

#---

FROM base AS gowin
COPY --from=build-gowin /opt/nextpnr /

#---

FROM gowin AS apicula
COPY --from=hdlc/apicula /usr/local/bin/gowin* /usr/local/bin
COPY --from=hdlc/apicula /usr/local/lib/python3.7/dist-packages /usr/local/lib/python3.7/dist-packages

#---

FROM build AS build-generic

RUN cd /tmp/nextpnr/build \
&& cmake .. \
-DARCH=all \
-DARCH=generic \
-DBUILD_GUI=OFF \
-DBUILD_PYTHON=ON \
-DUSE_OPENMP=ON \
Expand All @@ -109,4 +138,7 @@ RUN cd /tmp/nextpnr/build \
#---

FROM base AS all
COPY --from=build-all /opt/nextpnr /
COPY --from=build-ice40 /opt/nextpnr /
COPY --from=build-ecp5 /opt/nextpnr /
COPY --from=build-gowin /opt/nextpnr /
COPY --from=build-generic /opt/nextpnr /
28 changes: 28 additions & 0 deletions test/apicula.pkg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/sh

# Authors:
# Unai Martinez-Corral
#
# Copyright 2020-2021 Unai Martinez-Corral <unai.martinezcorral@ehu.eus>
#
# 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

./_todo.sh
30 changes: 30 additions & 0 deletions test/apicula.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
#!/usr/bin/env sh

# Authors:
# Unai Martinez-Corral
#
# Copyright 2020-2021 Unai Martinez-Corral <unai.martinezcorral@ehu.eus>
#
# 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
31 changes: 31 additions & 0 deletions test/nextpnr--gowin.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 <unai.martinezcorral@ehu.eus>
#
# 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/nextpnr-gowin.sh

./_todo.sh
2 changes: 1 addition & 1 deletion test/smoke-tests

0 comments on commit ee90e38

Please sign in to comment.