Skip to content

Commit

Permalink
Initial reset piscsi repository of 2023-11-22
Browse files Browse the repository at this point in the history
  • Loading branch information
uweseimet committed Nov 22, 2023
0 parents commit 8541c84
Show file tree
Hide file tree
Showing 406 changed files with 63,486 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
# Exclude all by default
/*

# Paths to include
!/docker/backend/piscsi_wrapper.sh
!/docker/web/web_start_wrapper.sh
!/doc
!/python
!/cpp
!/os_integration
!/test
!/easyinstall.sh
!/LICENCE
!/README.md

# Dev artifacts to exclude
**/.git

/cpp/bin
/cpp/obj

**/venv*
**/*.pyc
**/__pycache__
**/.pytest_cache
**/piscsi_interface_pb2.py
**/report.xml

**/.idea
**/.vscode
**/.DS_Store

**/core
**/*.swp
**/current

**/node_modules
**/messages.pot
**/messages.mo
10 changes: 10 additions & 0 deletions .github/ISSUE_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
# Info

- Which version of Pi are you using:
- Which github revision of software:
- Which board version:
- Which computer is the PiSCSI connected to:
- Which OS you are using (output of 'lsb_release -a'):


# Describe the issue
62 changes: 62 additions & 0 deletions .github/workflows/arm_cross_compile.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
on:
workflow_call:
inputs:
connect-type:
required: true
type: string
# Debug flag indicates whether to build a debug build (no optimization, debugger symbols)
debug-flag:
required: false
type: boolean

jobs:
build_arm:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: cpp
env:
APT_ARM_TOOLCHAIN: "gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf binutils-arm-linux-gnueabihf libspdlog-dev"
APT_LIBRARIES: "libspdlog-dev:armhf libpcap-dev:armhf libevdev2:armhf libev-dev:armhf protobuf-compiler libprotobuf-dev:armhf"
steps:
- uses: actions/checkout@v3

- name: Add armhf as architecture
run: sudo dpkg --add-architecture armhf

- name: Reconfigure apt for arch amd64
run: sudo sed -i "s/deb /deb [arch=amd64] /g" /etc/apt/sources.list

- name: Add armhf repos (jammy)
run: sudo bash -c "echo \"deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy main multiverse restricted universe\" >> /etc/apt/sources.list"

- name: Add armhf repos (jammy-updates)
run: sudo bash -c "echo \"deb [arch=armhf] http://ports.ubuntu.com/ubuntu-ports/ jammy-updates main multiverse restricted universe\" >> /etc/apt/sources.list"

- name: Update apt
run: sudo apt update

- name: Install apt packages
run: sudo apt-get --yes install ${{ env.APT_ARM_TOOLCHAIN }} ${{ env.APT_LIBRARIES }}

- name: Build debug strings
if: ${{ inputs.debug-flag }}
run: |
echo "debug_flag_compile=DEBUG\=1" >> $GITHUB_ENV
echo "debug_flag_filename=debug-" >> $GITHUB_ENV
- name: Compile
run: make all -j 6 CONNECT_TYPE=${{ inputs.connect-type }} ${{ env.debug_flag_compile }} CROSS_COMPILE=arm-linux-gnueabihf-

# We need to tar the binary outputs to retain the executable
# file permission. Currently, actions/upload-artifact only
# supports .ZIP files.
# This is workaround for https://github.com/actions/upload-artifact/issues/38
- name: Tar binary output
run: tar -czvf ${{ env.debug_flag_filename }}piscsi-${{ inputs.connect-type }}.tar.gz ./bin

- name: Upload binaries
uses: actions/upload-artifact@v3
with:
name: ${{ env.debug_flag_filename }}arm-binaries-${{ inputs.connect-type }}.tar.gz
path: cpp/${{ env.debug_flag_filename }}piscsi-${{ inputs.connect-type }}.tar.gz
50 changes: 50 additions & 0 deletions .github/workflows/build_code.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Build ARM binaries

on:
workflow_dispatch:
push:
paths:
- 'cpp/**'
- '.github/workflows/build_code.yml'
- '.github/workflows/arm_cross_compile.yml'
pull_request:
paths:
- 'cpp/**'
- '.github/workflows/build_code.yml'
- '.github/workflows/arm_cross_compile.yml'
types:
- assigned
- opened
- synchronize
- reopened
branches:
- 'develop'
- 'main'

jobs:
fullspec:
uses: PiSCSI/piscsi/.github/workflows/arm_cross_compile.yml@develop
with:
connect-type: "FULLSPEC"

standard:
uses: PiSCSI/piscsi/.github/workflows/arm_cross_compile.yml@develop
with:
connect-type: "STANDARD"

aibom:
uses: PiSCSI/piscsi/.github/workflows/arm_cross_compile.yml@develop
with:
connect-type: "AIBOM"

gamernium:
uses: PiSCSI/piscsi/.github/workflows/arm_cross_compile.yml@develop
with:
connect-type: "GAMERNIUM"

# The fullspec connection board is the most common
debug-fullspec:
uses: PiSCSI/piscsi/.github/workflows/arm_cross_compile.yml@develop
with:
connect-type: "FULLSPEC"
debug-flag: true
118 changes: 118 additions & 0 deletions .github/workflows/cpp.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,118 @@
name: C++ Tests; Full Static Analysis

on:
workflow_dispatch:
push:
paths:
- 'cpp/**'
- 'python/**'
- '.github/workflows/cpp.yml'
pull_request:
paths:
- 'cpp/**'
- 'python/**'
- '.github/workflows/cpp.yml'
branches:
- 'develop'
- 'main'

env:
APT_PACKAGES: libspdlog-dev libpcap-dev libevdev2 libev-dev protobuf-compiler libgtest-dev libgmock-dev

jobs:
unit_tests:
runs-on: ubuntu-22.04
defaults:
run:
working-directory: cpp
steps:
- uses: actions/checkout@v3

- name: Install dependencies
run: sudo apt-get install ${{ env.APT_PACKAGES }}

- name: Build unit tests
run: make -j $(nproc) test

- name: Run unit tests
run: (set -o pipefail && bin/piscsi_test | tee piscsi_test_log.txt)

- name: Upload logs
uses: actions/upload-artifact@v3
with:
name: piscsi_test_log.txt
path: cpp/piscsi_test_log.txt

sonarcloud:
runs-on: ubuntu-22.04
if: github.repository == 'PiSCSI/piscsi'
env:
SOURCES: cpp
BUILD_WRAPPER_OUT_DIR: "$HOME/.build_wrapper_out" # Directory where build-wrapper output will be placed
SONAR_SCANNER_VERSION: 5.0.1.3006
SONAR_SERVER_URL: "https://sonarcloud.io"
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
SONAR_PROJECT_KEY: "akuker-PISCSI"
SONAR_ORGANIZATION: "piscsi"
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis

- name: Install dependencies
run: sudo apt-get install ${{ env.APT_PACKAGES }}

- name: Set up JDK 17
uses: actions/setup-java@v1
with:
java-version: 17

- uses: actions/cache@v3
name: Cache SonarCloud setup
id: sonar-install-cache
with:
path: ~/.sonar
key: sonar-with-build-wrapper-${{ env.SONAR_SCANNER_VERSION }}

- name: Set up SonarCloud scanner
if: steps.sonar-install-cache.outputs.cache-hit != 'true'
env:
SONAR_SCANNER_DOWNLOAD_URL: https://binaries.sonarsource.com/Distribution/sonar-scanner-cli/sonar-scanner-cli-${{ env.SONAR_SCANNER_VERSION }}-linux.zip
run: |
mkdir -p $HOME/.sonar
curl -sSLo /tmp/sonar-scanner.zip ${{ env.SONAR_SCANNER_DOWNLOAD_URL }}
unzip -o /tmp/sonar-scanner.zip -d $HOME/.sonar/
- name: Set up SonarCloud build wrapper
if: steps.sonar-install-cache.outputs.cache-hit != 'true'
env:
BUILD_WRAPPER_DOWNLOAD_URL: ${{ env.SONAR_SERVER_URL }}/static/cpp/build-wrapper-linux-x86.zip
run: |
curl -sSLo /tmp/build-wrapper-linux-x86.zip ${{ env.BUILD_WRAPPER_DOWNLOAD_URL }}
unzip -o /tmp/build-wrapper-linux-x86.zip -d $HOME/.sonar/
- name: Generate coverage
run: >-
(mkdir -p ${{ env.BUILD_WRAPPER_OUT_DIR }} || true) &&
$HOME/.sonar/build-wrapper-linux-x86/build-wrapper-linux-x86-64
--out-dir ${{ env.BUILD_WRAPPER_OUT_DIR }}
make -j $(nproc) -C $SOURCES coverage
- name: Run gcov
working-directory: cpp
run: gcov --preserve-paths $(find -name '*.gcno')

- name: Run sonar-scanner
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: >-
$HOME/.sonar/sonar-scanner-${{ env.SONAR_SCANNER_VERSION }}-linux/bin/sonar-scanner
--define sonar.host.url="${{ env.SONAR_SERVER_URL }}"
--define sonar.projectKey=${{ env.SONAR_PROJECT_KEY }}
--define sonar.organization=${{ env.SONAR_ORGANIZATION }}
--define sonar.cfamily.build-wrapper-output="${{ env.BUILD_WRAPPER_OUT_DIR }}"
--define sonar.cfamily.gcov.reportsPath=.
--define sonar.coverage.exclusions="cpp/**/test/**"
--define sonar.cpd.exclusions="cpp/**/test/**"
--define sonar.inclusions="cpp/**,python/**"
--define sonar.python.version=3.9,3.11
69 changes: 69 additions & 0 deletions .github/workflows/rpi_image_creation.yml.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
name: Generate a PiSCSI OS image, based upon the official Rapsberry Pi OS

# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the rpi_image_creation branch
push:
branches: [ rpi_image_creation ]
pull_request:
branches: [ rpi_image_creation ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest

# Steps represent a sequence of tasks that will be executed as part of the job
# TODO: I don't think this step is needed....
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout PiSCSI
uses: actions/checkout@v2
with:
path: PISCSI

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- name: Checkout PiSCSI
uses: actions/checkout@v2
with:
repository: akuker/pi-gen
path: pi-gen

- name: Install Raspberry Pi build toolchain
run: sudo apt-get install coreutils quilt parted qemu-user-static debootstrap zerofree zip dosfstools libarchive-tools libcap2-bin grep rsync xz-utils file git curl bc qemu-utils kpartx

- name: Configure the build
run: |
echo -----------------------------------------------------
echo "IMG_NAME=PiSCSI-$GITHUB_RUN_ID" > config
echo "TARGET_HOSTNAME=piscsi" >> config
echo "ENABLE_SSH=1" >> config
echo "LOCALE_DEFAULT=en_US.UTF-8" >> config
echo "KEYBOARD_KEYMAP=us" >> config
echo "KEYBOARD_LAYOUT=\"English (US)\"" >> config
echo -----------------------------------------------------
cat config
working-directory: pi-gen

- name: Run the Raspberry Pi build generation tool
run: sudo ./build.sh
working-directory: pi-gen

- name: List the files in the deploy directory
run: |
echo -----------------------------------------------------
ls -alh pi-gen/deploy/
echo -----------------------------------------------------

- name: Archive the build artifacts
uses: actions/upload-artifact@v2.2.4
with:
# Artifact name
name: raspberry-pi-image
# A file, directory or wildcard pattern that describes what to upload
path: pi-gen/deploy/*
Loading

0 comments on commit 8541c84

Please sign in to comment.