mirror of
https://github.com/tillitis/tillitis-key1.git
synced 2024-12-29 17:36:26 -05:00
Add github action with basic CI that builds
Signed-off-by: Daniel Lublin <daniel@lublin.se>
This commit is contained in:
parent
b7d0698e1b
commit
9a6a790715
42
.github/workflows/ci.yaml
vendored
Normal file
42
.github/workflows/ci.yaml
vendored
Normal file
@ -0,0 +1,42 @@
|
||||
|
||||
name: ci
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
pull_request: {}
|
||||
# allow manual runs:
|
||||
workflow_dispatch: {}
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
runs-on: ubuntu-latest
|
||||
container:
|
||||
image: ghcr.io/tillitis/tkey-builder:1
|
||||
steps:
|
||||
- name: checkout
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
# fetch-depth: 0
|
||||
persist-credentials: false
|
||||
|
||||
- name: fix
|
||||
# https://github.com/actions/runner-images/issues/6775
|
||||
run: |
|
||||
git config --global --add safe.directory "$GITHUB_WORKSPACE"
|
||||
|
||||
# make firmwares first to fail sooner
|
||||
- name: make
|
||||
working-directory: hw/application_fpga
|
||||
run: make firmware.bin testfw.bin all
|
||||
|
||||
- name: check fmt of c code
|
||||
working-directory: hw/application_fpga
|
||||
run: |
|
||||
make -C fw/tk1 checkfmt
|
||||
make -C fw/testfw checkfmt
|
||||
|
||||
# TODO? first deal with hw/boards/ and hw/production_test/
|
||||
# - name: check for SPDX tags
|
||||
# run: ./LICENSES/spdx-ensure
|
97
LICENSES/spdx-ensure
Executable file
97
LICENSES/spdx-ensure
Executable file
@ -0,0 +1,97 @@
|
||||
#!/bin/bash
|
||||
set -eu
|
||||
|
||||
tag="SPDX-License-Identifier:"
|
||||
|
||||
dirsok=(
|
||||
.github/workflows/
|
||||
LICENSES/
|
||||
doc/
|
||||
hw/application_fpga/core/picorv32/
|
||||
hw/application_fpga/core/uart/
|
||||
hw/application_fpga/fw/tk1/blake2s/
|
||||
)
|
||||
|
||||
filesok=(
|
||||
.editorconfig
|
||||
.gitattributes
|
||||
.gitignore
|
||||
README.md
|
||||
contrib/99-tillitis.rules
|
||||
contrib/Dockerfile
|
||||
contrib/Makefile
|
||||
dco.md
|
||||
hw/application_fpga/core/timer/README.md
|
||||
hw/application_fpga/core/tk1/README.md
|
||||
hw/application_fpga/core/touch_sense/README.md
|
||||
hw/application_fpga/core/trng/README.md
|
||||
hw/application_fpga/core/uds/README.txt
|
||||
hw/application_fpga/data/udi.hex
|
||||
hw/application_fpga/data/uds.hex
|
||||
hw/application_fpga/fw/.clang-format
|
||||
hw/application_fpga/fw/testfw/Makefile
|
||||
hw/application_fpga/fw/tk1/Makefile
|
||||
hw/application_fpga/tools/makehex/makehex.py
|
||||
hw/application_fpga/tools/reset-tk1
|
||||
hw/application_fpga/tools/tpt/README.md
|
||||
)
|
||||
|
||||
is_missingok() {
|
||||
item="$1"
|
||||
# ok for empty files
|
||||
[[ -f "$item" ]] && [[ ! -s "$item" ]] && return 0
|
||||
for fileok in "${filesok[@]}"; do
|
||||
[[ "$item" = "$fileok" ]] && return 0
|
||||
done
|
||||
for dirok in "${dirsok[@]}"; do
|
||||
[[ "$item" =~ ^$dirok ]] && return 0
|
||||
done
|
||||
return 1
|
||||
}
|
||||
|
||||
printf "* Checking for SPDX tags in %s\n" "$PWD"
|
||||
|
||||
mapfile -t repofiles < <(git ls-files || true)
|
||||
if [[ -z "${repofiles[*]}" ]]; then
|
||||
printf "* No files in the repo?!\n"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
failed=0
|
||||
|
||||
printed=0
|
||||
for fileok in "${filesok[@]}"; do
|
||||
[[ -f "$fileok" ]] && continue
|
||||
if (( !printed )); then
|
||||
printf "* Some files in filesok are themselves missing:\n"
|
||||
printed=1
|
||||
failed=1
|
||||
fi
|
||||
printf "%s\n" "$fileok"
|
||||
done
|
||||
|
||||
printed=0
|
||||
for dirok in "${dirsok[@]}"; do
|
||||
[[ -d "$dirok" ]] && continue
|
||||
if (( !printed )); then
|
||||
printf "* Some dirs in dirsok are themselves missing:\n"
|
||||
printed=1
|
||||
failed=1
|
||||
fi
|
||||
printf "%s\n" "$dirok"
|
||||
done
|
||||
|
||||
printed=0
|
||||
for file in "${repofiles[@]}"; do
|
||||
is_missingok "$file" && continue
|
||||
if ! grep -q "$tag" "$file"; then
|
||||
if (( !printed )); then
|
||||
printf "* Files missing the SPDX tag:\n"
|
||||
printed=1
|
||||
failed=1
|
||||
fi
|
||||
printf "%s\n" "$file"
|
||||
fi
|
||||
done
|
||||
|
||||
exit "$failed"
|
@ -7,6 +7,7 @@ RUN apt-get -qq update -y \
|
||||
build-essential \
|
||||
ca-certificates \
|
||||
clang \
|
||||
clang-format \
|
||||
cmake \
|
||||
flex \
|
||||
gawk \
|
||||
@ -42,7 +43,7 @@ RUN apt-get -qq update -y \
|
||||
&& rm -rf /var/lib/apt/lists/*
|
||||
|
||||
|
||||
FROM base as builder
|
||||
FROM base as toolsbuilder
|
||||
|
||||
RUN git clone --depth=1 https://github.com/YosysHQ/icestorm /src
|
||||
WORKDIR /src
|
||||
@ -85,4 +86,5 @@ RUN rm -rf /src
|
||||
|
||||
|
||||
FROM base
|
||||
COPY --from=builder /usr/local/ /usr/local
|
||||
LABEL org.opencontainers.image.description="Toolchain for building TKey FPGA bitstream, firmware, apps"
|
||||
COPY --from=toolsbuilder /usr/local/ /usr/local
|
||||
|
@ -24,7 +24,7 @@ sudo apt install build-essential clang lld llvm bison flex libreadline-dev \
|
||||
libboost-thread-dev libboost-program-options-dev \
|
||||
libboost-iostreams-dev cmake libhidapi-dev \
|
||||
ninja-build libglib2.0-dev libpixman-1-dev \
|
||||
golang
|
||||
golang clang-format
|
||||
```
|
||||
|
||||
## Gateware: Yosys/Icestorm toolchain
|
||||
|
@ -1,6 +1,9 @@
|
||||
# Uses ../.clang-format
|
||||
FMTFILES=main.c
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
# Uses ../.clang-format
|
||||
clang-format --dry-run --ferror-limit=0 $(FMTFILES)
|
||||
clang-format --verbose -i $(FMTFILES)
|
||||
.PHONY: checkfmt
|
||||
checkfmt:
|
||||
clang-format --dry-run --ferror-limit=0 --Werror $(FMTFILES)
|
||||
|
@ -1,6 +1,9 @@
|
||||
# Uses ../.clang-format
|
||||
FMTFILES=main.c lib.h lib.c proto.h proto.c types.h
|
||||
.PHONY: fmt
|
||||
fmt:
|
||||
# Uses ../.clang-format
|
||||
clang-format --dry-run --ferror-limit=0 $(FMTFILES)
|
||||
clang-format --verbose -i $(FMTFILES)
|
||||
.PHONY: checkfmt
|
||||
checkfmt:
|
||||
clang-format --dry-run --ferror-limit=0 --Werror $(FMTFILES)
|
||||
|
Loading…
Reference in New Issue
Block a user