[SC64][CI/CD] Moved docker build environment to another repository (#7)

This commit is contained in:
Mateusz Faderewski 2021-09-26 14:42:50 +02:00 committed by GitHub
parent 7207d1a528
commit ec1fbf3ec1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
14 changed files with 56 additions and 217 deletions

View File

Before

Width:  |  Height:  |  Size: 1.4 MiB

After

Width:  |  Height:  |  Size: 1.4 MiB

View File

Before

Width:  |  Height:  |  Size: 1.1 MiB

After

Width:  |  Height:  |  Size: 1.1 MiB

View File

Before

Width:  |  Height:  |  Size: 1.8 MiB

After

Width:  |  Height:  |  Size: 1.8 MiB

View File

@ -1,49 +0,0 @@
name: Build docker
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- created
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: polprzewodnikowy/sc64env
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Log in to the Container registry
uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
with:
context: ./docker
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}

View File

@ -1,4 +1,4 @@
name: Build fw/hw/sw name: build
on: on:
push: push:
@ -22,7 +22,7 @@ jobs:
submodules: true submodules: true
- name: Build script - name: Build script
run: ./build.sh run: ./build_in_docker.sh
- name: Upload artifact - name: Upload artifact
uses: actions/upload-artifact@v2 uses: actions/upload-artifact@v2

View File

@ -66,8 +66,8 @@ Current goal is to fix bugs in SDRAM and PC modules.
## Finished sample ## Finished sample
![SummerCart64 clean PCB](.media/sc64_clean_pcb.jpg) ![SummerCart64 clean PCB](.github/sc64_clean_pcb.jpg)
![SummerCart64 on table](.media/sc64_on_table.jpg) ![SummerCart64 on table](.github/sc64_on_table.jpg)
![SummerCart64 in partialy disassembled Nintendo 64](.media/sc64_in_n64.jpg) ![SummerCart64 in partialy disassembled Nintendo 64](.github/sc64_in_n64.jpg)

View File

@ -1,3 +1,45 @@
#!/bin/bash #!/bin/bash
docker run --mount type=bind,src="$(pwd)",target="/workdir" ghcr.io/polprzewodnikowy/sc64env:v0.9 /bin/bash ./docker/build.sh
PACKAGE_FILE_NAME="SummerCart64"
FILES=(
"./fw/output_files/SummerCart64.pof"
"./hw/v1/ftdi-template.xml"
"./sw/cic/UltraCIC-III.hex"
"./sw/riscv/build/controller.rom"
"./LICENSE"
)
set -e
pushd sw/cic
echo "Building UltraCIC-III software"
avra UltraCIC-III.asm -D attiny45
popd
pushd sw/n64
echo "Building N64 bootloader software"
make clean all
popd
pushd sw/riscv
echo "Building RISC-V controller software"
make clean all
popd
pushd fw
echo "Building FPGA firmware"
quartus_sh --flow compile ./SummerCart64.qpf
popd
echo "Zipping files"
if [[ -e "./${PACKAGE_FILE_NAME}.zip" ]]; then
rm -f "./${PACKAGE_FILE_NAME}.zip"
fi
zip -r "./${PACKAGE_FILE_NAME}.zip" ${FILES[@]}

3
build_in_docker.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
docker run --mount type=bind,src="$(pwd)",target="/workdir" ghcr.io/polprzewodnikowy/sc64env:v1.0 /bin/bash ./build.sh

View File

@ -1,93 +0,0 @@
FROM ubuntu:18.04 AS base
FROM base AS build_base
SHELL ["/bin/bash", "-c"]
WORKDIR /tmp/scratchpad
ENV DEBIAN_FRONTEND="noninteractive"
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y \
autoconf \
automake \
autotools-dev \
bc \
bison \
build-essential \
bzip2 \
curl \
expect \
file \
flex \
g++ \
gawk \
gcc \
gcc-multilib \
git \
gperf \
libexpat-dev \
libgmp-dev \
libmpc-dev \
libmpfr-dev \
libpng-dev \
libtool \
make \
patchutils \
python3 \
texinfo \
texinfo \
wget \
zlib1g-dev
FROM build_base AS build_riscv
RUN git clone --branch 2021.09.21 https://github.com/riscv/riscv-gnu-toolchain && \
pushd ./riscv-gnu-toolchain && \
./configure --prefix=/opt/riscv --with-arch=rv32i --with-abi=ilp32 && \
make -j$(nproc) && \
popd && \
rm -rf ./riscv-gnu-toolchain
FROM build_base AS build_n64
ENV N64_INST=/opt/n64
ENV FORCE_DEFAULT_GCC=true
RUN git clone https://github.com/DragonMinded/libdragon && \
pushd ./libdragon && \
git checkout fc4b6708df7439b9386bb6631e24d8909d78d6ae && \
pushd ./tools && \
./build-toolchain.sh && \
popd && \
make install && \
make tools-install && \
popd && \
rm -rf ./libdragon
FROM build_base AS build_quartus
ADD setup_quartus.sh .
RUN mkdir -p ./quartus && \
pushd ./quartus && \
wget -q http://download.altera.com/akdlm/software/acdsinst/20.1std.1/720/ib_tar/Quartus-lite-20.1.1.720-linux.tar && \
tar xvf Quartus-lite-20.1.1.720-linux.tar && \
popd && \
./setup_quartus.sh 20.1 && \
rm -rf ./quartus setup_quartus.sh
FROM base AS release
WORKDIR /workdir
ENV DEBIAN_FRONTEND="noninteractive"
ENV LC_ALL="en_US.UTF-8"
ENV N64_INST="/usr/local"
ENV PATH="${PATH}:/opt/intelFPGA_lite/20.1/quartus/bin"
RUN apt-get update && \
apt-get upgrade -y && \
apt-get install -y avra make python3 libglib2.0-0 libtcmalloc-minimal4 libmpc3 locales zip && \
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen && \
locale-gen en_US.UTF-8 && \
/usr/sbin/update-locale LANG=en_US.UTF-8
COPY --from=build_riscv /opt/riscv /usr/local
COPY --from=build_n64 /opt/n64 /usr/local
COPY --from=build_quartus /opt/intelFPGA_lite /opt/intelFPGA_lite
ENV LD_PRELOAD="/usr/lib/x86_64-linux-gnu/libtcmalloc_minimal.so.4"

View File

@ -1,42 +0,0 @@
#!/bin/bash
PACKAGE_FILE_NAME="SummerCart64"
FILES=(
"./fw/output_files/SummerCart64.pof"
"./hw/v1/ftdi-template.xml"
"./sw/cic/UltraCIC-III.hex"
"./sw/riscv/build/controller.rom"
"./LICENSE"
)
pushd sw/cic
echo "Building UltraCIC-III software"
avra UltraCIC-III.asm -D attiny45
popd
pushd sw/n64
echo "Building N64 bootloader software"
make clean all
popd
pushd sw/riscv
echo "Building RISC-V controller software"
make clean all
popd
pushd fw
echo "Building FPGA firmware"
quartus_sh --flow compile SummerCart64.qpf
popd
echo "Zipping files"
if [[ -e "./${PACKAGE_FILE_NAME}.zip" ]]; then
rm -f "./${PACKAGE_FILE_NAME}.zip"
fi
zip -r "./${PACKAGE_FILE_NAME}.zip" ${FILES[@]}

View File

@ -1,25 +0,0 @@
#!/usr/bin/expect
set timeout -1
set version [lindex $argv 0]
spawn ./quartus/setup.sh
expect {
"Press \\\[Enter\\\] to continue:" { send "\r"; exp_continue }
"Do you accept this license? \\\[y/n\\\]" { send "y\r"; exp_continue }
"Installation directory \\\[/root/intelFPGA_lite/$version\\\]:" { send "/opt/intelFPGA_lite/$version\r"; exp_continue }
"Quartus Prime Lite Edition (Free) \\\[Y/n\\\] :" { send "y\r"; exp_continue }
"Quartus Prime Lite Edition (Free) - Quartus Prime Help" { send "n\r"; exp_continue }
"Quartus Prime Lite Edition (Free) - Devices \\\[Y/n\\\] " { send "y\r"; exp_continue }
"Quartus Prime Lite Edition (Free) - Devices - MAX 10 FPGA" { send "y\r"; exp_continue }
"Quartus Prime Lite Edition (Free) - Devices - " { send "n\r"; exp_continue }
"ModelSim - Intel FPGA Starter Edition (Free)" { send "n\r"; exp_continue }
"ModelSim - Intel FPGA Edition" { send "n\r"; exp_continue }
"Is the selection above correct? \\\[Y/n\\\]:" { send "y\r"; exp_continue }
"Create shortcuts on Desktop \\\[Y/n\\\]:" { send "n\r"; exp_continue }
"Launch Quartus Prime Lite Edition \\\[Y/n\\\]:" { send "n\r"; exp_continue }
"Provide your feedback at" { send "n\r"; exp_continue }
eof { }
}

3
fw/build.sh Executable file
View File

@ -0,0 +1,3 @@
#!/bin/bash
docker run --mount type=bind,src="$(pwd)/..",target="/workdir" ghcr.io/polprzewodnikowy/sc64env:v1.0 /bin/bash -c "cd fw && quartus_sh --flow compile ./SummerCart64.qpf"

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
docker run --mount type=bind,src="$(pwd)",target="/workdir" ghcr.io/polprzewodnikowy/sc64env:v0.9 /bin/bash -c "make clean all" docker run --mount type=bind,src="$(pwd)",target="/workdir" ghcr.io/polprzewodnikowy/sc64env:v1.0 /bin/bash -c "make clean all"

View File

@ -1,3 +1,3 @@
#!/bin/bash #!/bin/bash
docker run --mount type=bind,src="$(pwd)",target="/workdir" ghcr.io/polprzewodnikowy/sc64env:v0.9 /bin/bash -c "make clean all" docker run --mount type=bind,src="$(pwd)",target="/workdir" ghcr.io/polprzewodnikowy/sc64env:v1.0 /bin/bash -c "make clean all"