Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
106 changes: 106 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
# Prerequisites
*.d

# Compiled Object files
*.slo
*.lo
*.o
*.obj

# Precompiled Headers
*.gch
*.pch

# Compiled Dynamic libraries
*.so
*.dylib
*.dll

# Fortran module files
*.mod
*.smod

# Compiled Static libraries
*.lai
*.la
*.a
*.lib
*.exp
*.pdb
*.ilk

# Executables
*.exe
*.out
*.app
chud.log

# Directories
!.deps/rexo
gh*/
vcpkg*/
node_modules*/
bazel*/
doxygen*/
clangd*/
cmake*/
config*/
build*/
output*/
coverage*/
libs*/
logs*/
report*/
pkg*/

.scannerwork*/
.sonar*/
.deps*/
.cache*/
.history*/
.venv*/
.tools*/

# Files
dump.txt
callgrind.out.*
lcov.info
.args
.~*
**/*.c.s
**/*.gcda
**/*.gcno
**/*.s
**/*.i
**/*.o
**/*.
**/*tests/*.
appwrite/.env
wget.log*

bazel-*/
bazel-*

.vscode/settings.json
.vscode/settings.local.json
src/compile_commands.json
Testing

src/std/version.h

.rexo/
.vs/
main-tests-vm1/
.scannerwork/.sonar_lock
__pycache__/
*.egg-info/
dist/
*.egg
.coverage
.pytest_cache/
.patch/
/examples/python/.coverage
.PVS-Studio/
./vscode/settings.json
.tmp
videos/
24 changes: 10 additions & 14 deletions .github/workflows/c-cpp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,28 +9,24 @@ on:

jobs:
build:
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
runs-on: ubuntu-latest
container:
image: defaultwriter/c-image-repo:latest
steps:
- uses: actions/checkout@v2
if: github.event_name == 'pull_request'
- uses: actions/checkout@v4
with:
submodules: true
fetch-depth: 0
ref: ${{ github.event.pull_request.head.ref }}

- uses: actions/checkout@v2
if: github.event_name == 'push'
with:
submodules: true
fetch-depth: 0
- name: init
run: ./bin/init.sh --init --lcov --setup
- name: config
run: git config --global --add safe.directory ${GITHUB_WORKSPACE}
- name: coverage
run: ./bin/coverageall.sh --all --clean
- name: sonarscanner
run: ./bin/sonarscanner.sh --coverage
env:
SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
- name: codacy coverage
run: bash bin/codacy.sh --coverage
run: ./bin/codacy.sh --coverage
env:
CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }}
- name: Coveralls GitHub Action
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -103,3 +103,4 @@ dist/
.PVS-Studio/
./vscode/settings.json
.tmp
videos/
13 changes: 8 additions & 5 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,11 @@ RUN ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" > /etc/timezo
apt -y install --no-install-recommends -y \
build-essential \
ca-certificates \
nodejs \
npm \
python3 \
python3-venv \
python3-virtualenv \
clangd \
cmake \
curl \
Expand Down Expand Up @@ -38,10 +43,8 @@ RUN ln -snf /usr/share/zoneinfo/"$TZ" /etc/localtime && echo "$TZ" > /etc/timezo
# Set the working directory
WORKDIR /workspace

# Copy the contents of the current directory to /workspace
COPY . .
# Copy all source files needed to run the initialization
COPY bin /workspace/bin

# Run the initialization script
RUN /workspace/bin/init.sh --init --lcov --setup

RUN rm -rf /workspace
RUN ./bin/init.sh --init --lcov --setup
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@ int main(void) {
./bin/cleanup.sh --clean
./bin/init.sh --clangd
./bin/init.sh --init --setup
./bin/init.sh --env
./bin/coverageall.sh --all --clean
./bin/target.sh --target=main-tests-vm1 --release
./bin/cmake.sh --target=main-tests-vm1 --verbose --tty
Expand Down
8 changes: 3 additions & 5 deletions bin/codacy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -50,11 +50,9 @@ if [[ "${install}" == "" ]]; then
fi

if [[ "${coverage}" == "--coverage" ]]; then

"${pwd}/bin/coverageall.sh" --all --clean

gcovr -r . --txt-metric branch --sonarqube coverage/sonarqube.xml --gcov-exclude="rexo.h"

if [[ ! -f "${pwd}/coverage/lcov.info" ]]; then
"${pwd}/bin/coverageall.sh" --all --clean
fi
if [[ -f "${pwd}/coverage/lcov.info" ]]; then
bash <(curl -Ls https://coverage.codacy.com/get.sh) report -r "${pwd}/coverage/lcov.info"
fi
Expand Down
72 changes: 72 additions & 0 deletions bin/docker.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
#!/usr/bin/env bash
if [[ "${BASHOPTS}" != *extdebug* ]]; then
set -e
fi

err_report() {
cd ${source}
echo "ERROR: $0:$*"
exit 8
}

if [[ "${BASHOPTS}" != *extdebug* ]]; then
trap 'err_report $LINENO' ERR
fi

source=$(pwd)

pwd=$(cd "$(dirname "$(dirname "${BASH_SOURCE[0]}")")" &> /dev/null && pwd)

cd "${pwd}"

install="$1"

opts=( "${@:2}" )

. "${pwd}/bin/scripts/load.sh"

## Builds docker image
## Usage: ${script} <option> [optional]
## ${commands}

while (($#)); do
case "$1" in

"--build") # [optional] builds docker image and pushes it into repository
build="--build"
;;

"--help") # [optional] shows command description
help
;;

*)
help
;;

esac
shift
done

if [[ "${install}" == "" ]]; then
help
exit
fi

if [[ "${build}" == "--build" ]]; then
if [[ -z "$CR_PAT" ]]; then
echo "ERROR: The CR_PAT environment variable is not set. Please set it to your Personal Access Token."
exit 1
fi

echo "$CR_PAT" | docker login docker.io -u defaultwriter --password-stdin
IMAGE_NAME="defaultwriter/c-image-repo"
GIT_TAG=$(git rev-parse --short HEAD)
docker build . -t "${IMAGE_NAME}:${GIT_TAG}"
docker tag "${IMAGE_NAME}:${GIT_TAG}" "${IMAGE_NAME}:latest"
docker push "${IMAGE_NAME}:latest"
fi

[[ $SHLVL -eq 2 ]] && echo OK

cd "${pwd}"
11 changes: 6 additions & 5 deletions bin/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ while (($#)); do
"${pwd}/bin/utils/install.sh" --cmake
;;

"--pyton") # installs python .venv
"--python") # installs python .venv
"${pwd}/bin/utils/install.sh" --python
;;

Expand Down Expand Up @@ -108,6 +108,11 @@ if [[ "${setup}" == "--setup" ]]; then
sudo "${pwd}/bin/setup.sh" ${updateflags} ${updgradeflags} ${optional}
fi

if [[ "${env}" == "--env" ]]; then
${pwd}/bin/utils/env.sh --python
source ${pwd}/bin/env.sh
fi

if [[ "${hooks}" == "--hooks" ]]; then
"${pwd}/bin/utils/install.sh" --hooks
fi
Expand All @@ -125,11 +130,7 @@ if [[ "${cmake}" == "--cmake" ]]; then
fi

if [[ "${init}" == "--init" ]]; then
"${pwd}/bin/utils/install.sh" --submodule-rexo
"${pwd}/bin/utils/install.sh" --python
"${pwd}/bin/utils/init.sh" --init ${updateflags} ${updgradeflags} ${optional}
${pwd}/bin/utils/env.sh --python
source ${pwd}/bin/env.sh
fi

[[ $SHLVL -eq 2 ]] && echo OK
Expand Down
5 changes: 3 additions & 2 deletions bin/library/git.sh
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,11 @@ function submodule-install() {
git submodule deinit -f "${pwd}/${2}"
rm -rf "${pwd}/${2}"
rm -rf "${pwd}/.git/modules/${2}"
git submodule add -f "$1" "$2"
git submodule update --init --recursive --remote
fi

git submodule add -f "$1" "$2"
git submodule update --init --recursive --remote

# Navigate to the submodule directory
cd "${pwd}/$2"

Expand Down
21 changes: 10 additions & 11 deletions bin/sonarscanner.sh
Original file line number Diff line number Diff line change
Expand Up @@ -59,17 +59,16 @@ if [[ "${install}" == "--install" ]]; then
fi

if [[ "${coverage}" == "--coverage" ]]; then

"${pwd}/bin/coverageall.sh" --all --clean

gcovr -r . --txt-metric branch --sonarqube coverage/sonarqube.xml --gcov-exclude="rexo.h"

. "${pwd}/bin/utils/install.sh" --sonar-scanner

export PATH=$SONAR_SCANNER_HOME/bin:$PATH

if [[ ! "${SONAR_TOKEN}" == "" ]]; then
sonar-scanner
if [[ ! -f "${pwd}/coverage/lcov.info" ]]; then
"${pwd}/bin/coverageall.sh" --all --clean
fi
if [[ -f "${pwd}/coverage/lcov.info" ]]; then
gcovr -r . --txt-metric branch --sonarqube coverage/sonarqube.xml --gcov-exclude="rexo.h"
. "${pwd}/bin/utils/install.sh" --sonar-scanner
export PATH=$SONAR_SCANNER_HOME/bin:$PATH
if [[ ! "${SONAR_TOKEN}" == "" ]]; then
sonar-scanner
fi
fi
fi

Expand Down
2 changes: 1 addition & 1 deletion bin/utils/init.sh
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ while (($#)); do
"${pwd}/bin/utils/install.sh" --cmake
;;

"--pyton") # installs python .venv
"--python") # installs python .venv
"${pwd}/bin/utils/install.sh" --python
;;

Expand Down
7 changes: 4 additions & 3 deletions bin/utils/install.sh
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,10 @@ while (($#)); do
;;

"--python") # installs python .venv
python3 -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt
python3 -m virtualenv "${pwd}/.venv"
. "${pwd}/.venv/bin/activate"
export PATH="${pwd}/.venv/bin":$PATH
"${pwd}/.venv/bin/pip" install -r "${pwd}/requirements.txt"
;;

"--pyenv") # downloads and installs pyenv
Expand Down