-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
043a20c
commit daaedf6
Showing
18 changed files
with
291 additions
and
151 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,156 @@ | ||
name: CI Pipeline | ||
|
||
on: | ||
push: | ||
branches: | ||
- '*' | ||
pull_request: | ||
branches: | ||
- '*' | ||
|
||
jobs: | ||
run-c-static-analysis: | ||
name: Run C Static Analysis | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Docker Compose | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y docker-compose | ||
- name: Build and Start Docker Compose | ||
run: | | ||
docker-compose up -d --build | ||
- name: Run C Static Analysis | ||
run: | | ||
docker-compose exec -T app bash -c "dos2unix /workspace/ContinuousIntegration/run_c_static_code_analysis.sh && bash /workspace/ContinuousIntegration/run_c_static_code_analysis.sh" | ||
- name: Copy C Analysis Reports to Host | ||
run: | | ||
docker cp app:/workspace/build/C_Lint_ReportApplicationOnly.txt . | ||
docker cp app:/workspace/build/C_Lint_ReportFull.txt . | ||
- name: Archive C Analysis Reports | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: c-lint-reports | ||
path: | | ||
C_Lint_ReportApplicationOnly.txt | ||
C_Lint_ReportFull.txt | ||
- name: Clean Up Containers | ||
run: | | ||
docker-compose down | ||
run-python-static-analysis: | ||
name: Run Python Static Analysis | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Docker Compose | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y docker-compose | ||
- name: Build and Start Docker Compose | ||
run: | | ||
docker-compose up -d --build | ||
- name: Run Python Static Analysis | ||
run: | | ||
docker-compose exec -T app bash -c "dos2unix /workspace/ContinuousIntegration/run_python_static_code_analysis.sh && bash /workspace/ContinuousIntegration/run_python_static_code_analysis.sh" | ||
- name: Copy Python Analysis Reports to Host | ||
run: | | ||
docker cp app:/workspace/build/python_lint_report ./python_lint_report | ||
- name: Archive Python Analysis Reports | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: python-lint-reports | ||
path: python_lint_report | ||
|
||
- name: Clean Up Containers | ||
run: | | ||
docker-compose down | ||
run-shell-static-analysis: | ||
name: Run Shell Static Analysis | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Docker Compose | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y docker-compose | ||
- name: Build and Start Docker Compose | ||
run: | | ||
docker-compose up -d --build | ||
- name: Run Shell Static Analysis | ||
run: | | ||
docker-compose exec -T app bash -c "dos2unix /workspace/ContinuousIntegration/run_shellscripts_static_code_analysis.sh && bash /workspace/ContinuousIntegration/run_shellscripts_static_code_analysis.sh" | ||
- name: Copy Shell Analysis Report to Host | ||
run: | | ||
docker cp app:/workspace/build/Shell_Script_Lint_Report.txt Shell_Script_Lint_Report.txt | ||
- name: Archive Shell Analysis Report | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: shell-lint-report | ||
path: Shell_Script_Lint_Report.txt | ||
|
||
- name: Clean Up Containers | ||
run: | | ||
docker-compose down | ||
build-firmware: | ||
name: Build Firmware | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v3 | ||
|
||
- name: Install Docker Compose | ||
run: | | ||
sudo apt-get update | ||
sudo apt-get install -y docker-compose | ||
- name: Build and Start Docker Compose | ||
run: | | ||
docker-compose up -d --build | ||
- name: Build Firmware | ||
run: | | ||
docker-compose exec -T app bash -c "cd /workspace/build && cmake ../Software/Firmware/ && make -j$(nproc)" | ||
- name: Copy Firmware Files to Host | ||
run: | | ||
docker cp app:/workspace/build/IonizationChamber.cdb . | ||
docker cp app:/workspace/build/IonizationChamber.lk . | ||
docker cp app:/workspace/build/IonizationChamber.ihx . | ||
docker cp app:/workspace/build/IonizationChamber.map . | ||
- name: Archive Firmware Build Artifacts | ||
uses: actions/upload-artifact@v3 | ||
with: | ||
name: firmware-build-artifacts | ||
path: | | ||
IonizationChamber.cdb | ||
IonizationChamber.lk | ||
IonizationChamber.ihx | ||
IonizationChamber.map | ||
- name: Clean Up Containers | ||
run: | | ||
docker-compose down |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
3 changes: 0 additions & 3 deletions
3
ContinuousIntegration/run_shellscripts_static_code_analysis.sh
This file was deleted.
Oops, something went wrong.
File renamed without changes.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
# ContinuousIntegration | ||
|
||
This folder contains scripts used by GitHub Continuous Integration. It is recommended to run these scripts locally before submitting a pull request. |
File renamed without changes.
6 changes: 6 additions & 0 deletions
6
DevOps/ContinuousIntegration/run_python_static_code_analysis.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/bin/bash | ||
|
||
# shellcheck disable=SC1091 | ||
source /workspace/venv/bin/activate | ||
|
||
flake8 --format=html --htmldir=python_lint_report /workspace/Software/DataAcquisition/ /workspace/Simulation |
3 changes: 3 additions & 0 deletions
3
DevOps/ContinuousIntegration/run_shellscripts_static_code_analysis.sh
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/bin/bash | ||
|
||
shellcheck /workspace/ContinuousIntegration/*.sh | tee Shell_Script_Lint_Report.txt |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,64 @@ | ||
# Use an official Ubuntu as a base image | ||
FROM ubuntu:20.04 AS build | ||
|
||
# Set environment variables to prevent interaction during installation | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Install git, build tools, and dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
git \ | ||
build-essential \ | ||
cmake \ | ||
pkg-config \ | ||
libusb-1.0-0-dev \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Install stm8flash | ||
RUN git clone https://github.com/vdudouyt/stm8flash.git | ||
RUN cd stm8flash && make -j$(nproc) | ||
|
||
# Use another Ubuntu image for runtime | ||
FROM ubuntu:20.04 AS runtime | ||
|
||
# Set environment variables to prevent interaction during installation | ||
ENV DEBIAN_FRONTEND=noninteractive | ||
|
||
# Install runtime dependencies | ||
RUN apt-get update && apt-get install -y \ | ||
libusb-1.0-0 \ | ||
sdcc \ | ||
build-essential \ | ||
cmake \ | ||
git \ | ||
make \ | ||
pkg-config \ | ||
libusb-1.0-0-dev \ | ||
screen \ | ||
doxygen \ | ||
uncrustify \ | ||
python3-pip \ | ||
poppler-utils \ | ||
cppcheck \ | ||
r-base-core \ | ||
shellcheck \ | ||
dos2unix \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
RUN apt-get update && apt-get install -y \ | ||
python3-venv \ | ||
&& rm -rf /var/lib/apt/lists/* | ||
|
||
# Copy the stm8flash binary from the build stage | ||
COPY --from=build /stm8flash/stm8flash /usr/bin/ | ||
|
||
# Install flake8 in a Python virtual environment | ||
RUN python3 -m venv /workspace/venv && \ | ||
/workspace/venv/bin/pip install --upgrade pip && \ | ||
/workspace/venv/bin/pip install flake8 flake8-html pyserial | ||
|
||
# Create workspace directory and set it as the working directory | ||
RUN mkdir -p /workspace/build | ||
WORKDIR /workspace/build | ||
|
||
# Command to run the container | ||
CMD ["bash"] |
Oops, something went wrong.