diff --git a/.dockerignore b/.dockerignore new file mode 100644 index 00000000..fe58705e --- /dev/null +++ b/.dockerignore @@ -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/ diff --git a/.github/workflows/c-cpp.yml b/.github/workflows/c-cpp.yml index 52f3af3d..f293a825 100644 --- a/.github/workflows/c-cpp.yml +++ b/.github/workflows/c-cpp.yml @@ -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 diff --git a/.gitignore b/.gitignore index 6365f932..fe58705e 100644 --- a/.gitignore +++ b/.gitignore @@ -103,3 +103,4 @@ dist/ .PVS-Studio/ ./vscode/settings.json .tmp +videos/ diff --git a/Dockerfile b/Dockerfile index 81b6df60..db63febd 100644 --- a/Dockerfile +++ b/Dockerfile @@ -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 \ @@ -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 diff --git a/README.md b/README.md index 8d290a29..015202a7 100644 --- a/README.md +++ b/README.md @@ -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 diff --git a/bin/codacy.sh b/bin/codacy.sh index 43246014..98cda1a0 100755 --- a/bin/codacy.sh +++ b/bin/codacy.sh @@ -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 diff --git a/bin/docker.sh b/bin/docker.sh new file mode 100755 index 00000000..5c600168 --- /dev/null +++ b/bin/docker.sh @@ -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}