diff options
83 files changed, 3200 insertions, 1643 deletions
diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 541c2336..88385df1 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,10 +8,12 @@ env: DEFAULT_DOCKER_IMAGE: nicolargo/glances NODE_ENV: ${{ (contains('refs/heads/master', github.ref) || startsWith(github.ref, 'refs/tags/v')) && 'prod' || 'dev' }} PUSH_BRANCH: ${{ 'refs/heads/develop' == github.ref || 'refs/heads/master' == github.ref || startsWith(github.ref, 'refs/tags/v') }} - # Alpine image do not support linux/arm/v6 and linux/arm/v6 - See issue #2735 - DOCKER_PLATFORMS: linux/amd64,linux/arm64,linux/386 - # Ubuntu image only support linux/amd64 and linux/arm64 - See issue #2185 - DOCKER_PLATFORMS_UBUNTU: linux/amd64,linux/arm64 + # Alpine image platform: https://hub.docker.com/_/alpine + # linux/arm/v6,linux/arm/v7 do not work (timeout during the build) + DOCKER_PLATFORMS: linux/amd64,linux/arm64/v8 + # Ubuntu image platforms list: https://hub.docker.com/_/ubuntu + # linux/arm/v7 do not work (Cargo/Rust not available) + DOCKER_PLATFORMS_UBUNTU: linux/amd64,linux/arm64/v8 on: workflow_call: @@ -104,7 +106,7 @@ jobs: TAG_ARRAY="${TAG_ARRAY::-1} ]" echo "Tags to build: $TAG_ARRAY" - echo "::set-output name=tags::$TAG_ARRAY" + echo "tags=$TAG_ARRAY" >> $GITHUB_OUTPUT build_Docker_image: runs-on: ubuntu-latest @@ -128,7 +130,7 @@ jobs: org.opencontainers.image.url=https://nicolargo.github.io/glances/ - name: Cache Docker layers - uses: actions/cache@v3 + uses: actions/cache@v4 with: path: /tmp/.buildx-cache key: ${{ runner.os }}-buildx-${{ env.NODE_ENV }}-${{ matrix.os }}-${{ matrix.tag.tag }} diff --git a/.github/workflows/cyber.yml b/.github/workflows/cyber.yml index 27a2c9b7..16752ca4 100644 --- a/.github/workflows/cyber.yml +++ b/.github/workflows/cyber.yml @@ -23,6 +23,6 @@ jobs: severity: 'CRITICAL' - name: Upload Trivy scan results to GitHub Security tab - uses: github/codeql-action/upload-sarif@v2 + uses: github/codeql-action/upload-sarif@v3 with: sarif_file: 'trivy-results.sarif' diff --git a/.github/workflows/quality.yml b/.github/workflows/quality.yml index 6d0df601..2d2ea63e 100644 --- a/.github/workflows/quality.yml +++ b/.github/workflows/quality.yml @@ -26,7 +26,7 @@ jobs: # Initializes the CodeQL tools for scanning. - name: Initialize CodeQL - uses: github/codeql-action/init@v2 + uses: github/codeql-action/init@v3 with: languages: ${{ matrix.language }} # If you wish to specify custom queries, you can do so here or in a config file. @@ -37,7 +37,7 @@ jobs: # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). # If this step fails, then you should remove it and run the build manually (see below) - name: Autobuild - uses: github/codeql-action/autobuild@v2 + uses: github/codeql-action/autobuild@v3 # âšī¸ Command-line programs to run using the OS shell. # đ https://git.io/JvXDl @@ -51,4 +51,4 @@ jobs: # make release - name: Perform CodeQL Analysis - uses: github/codeql-action/analyze@v2 + uses: github/codeql-action/analyze@v3 diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 030730f8..b7836ca4 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -10,7 +10,7 @@ jobs: test-linux: # https://github.com/actions/runner-images?tab=readme-ov-file#available-images - runs-on: ubuntu-latest + runs-on: ubuntu-22.04 strategy: matrix: python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] @@ -20,9 +20,10 @@ jobs: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + cache: 'pip' - name: Install dependencies run: | @@ -47,55 +48,84 @@ jobs: run: | python ./unitest.py - test-windows: + # Error appear with h11, not related to Glances + # Should be tested if correction is done + # Installed c:\hostedtoolcache\windows\python\3.9.13\x64\lib\site-packages\exceptiongroup-1.2.1-py3.9.egg + # error: h11 0.14.0 is installed but h11<0.13,>=0.11 is required by {'httpcore'} + # Error: Process completed with exit code 1. + # test-windows: + + # # https://github.com/actions/runner-images?tab=readme-ov-file#available-images + # runs-on: windows-2022 + # strategy: + # matrix: + # # Python version "3.12" introduce this issue: + # # https://github.com/nicolargo/glances/actions/runs/6439648370/job/17487567454 + # python-version: ["3.8", "3.9", "3.10", "3.11"] + # steps: + + # - uses: actions/checkout@v4 + + # - name: Set up Python ${{ matrix.python-version }} + # uses: actions/setup-python@v5 + # with: + # python-version: ${{ matrix.python-version }} + # cache: 'pip' + + # - name: Install dependencies + # run: | + # python -m pip install --upgrade pip + # if (Test-Path -PathType Leaf "requirements.txt") { python -m pip install -r requirements.txt } + # python setup.py install + + # - name: Unitary tests + # run: | + # python ./unitest.py + + test-macos: # https://github.com/actions/runner-images?tab=readme-ov-file#available-images - runs-on: windows-latest + runs-on: macos-14 strategy: matrix: - # Python version "3.12" introduce this issue: - # https://github.com/nicolargo/glances/actions/runs/6439648370/job/17487567454 - python-version: ["3.8", "3.9", "3.10", "3.11"] + python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] + steps: - uses: actions/checkout@v4 - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 + uses: actions/setup-python@v5 with: python-version: ${{ matrix.python-version }} + cache: 'pip' - name: Install dependencies run: | python -m pip install --upgrade pip - if (Test-Path -PathType Leaf "requirements.txt") { python -m pip install -r requirements.txt } - python setup.py install + if [ -f requirements.txt ]; then pip install -r requirements.txt; fi - name: Unitary tests run: | python ./unitest.py - test-macos: - - # https://github.com/actions/runner-images?tab=readme-ov-file#available-images - runs-on: macos-latest - strategy: - matrix: - python-version: ["3.8", "3.9", "3.10", "3.11", "3.12"] - - steps: + # Error when trying to implement #2749 + # pkg: No packages available to install matching 'py-pip' have been found in the repositories + # test-freebsd: - - uses: actions/checkout@v4 + # runs-on: ubuntu-22.04 - - name: Set up Python ${{ matrix.python-version }} - uses: actions/setup-python@v4 - with: - python-version: ${{ matrix.python-version }} + # steps: - - name: Install dependencies - run: | - if [ -f requirements.txt ]; then pip install -r requirements.txt; fi + # - uses: actions/checkout@v4 - - name: Unitary tests - run: | - python ./unitest.py
\ No newline at end of file + # - name: Run tests + # uses: vmactions/freebsd-vm@v1 + # with: + # usesh: true + # prepare: | + # pkg install -y python3 py-pip + # run: | + # set -e -x + # python3 -m pip install --user -r requirements.txt + # python ./unitest.py diff --git a/.github/workflows/webui.yml b/.github/workflows/webui.yml index 077b0b81..bc75b108 100644 --- a/.github/workflows/webui.yml +++ b/.github/workflows/webui.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/checkout@v4 - name: Glances will be build with Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: node-version: ${{ matrix.node-version }} cache: 'npm' @@ -104,10 +104,25 @@ codespell: ## Run codespell to fix common misspellings in text files semgrep: ## Run semgrep to find bugs and enforce code standards ./venv-dev/bin/semgrep scan --config=auto -profiling: ## How to start the profiling of the Glances software - @echo "Start a Glances instance and get its PID" - @echo "Run: sudo ./venv-dev/bin/py-spy record -o ./docs/_static/glances-flame.svg -d 60 -s --pid <GLANCES PID>" - @echo "Open the SVG file (./docs/_static/glances-flame.svg) with a Web browser" +profiling-gprof: ## Callgraph profiling (need "apt install graphviz") + @echo "Start Glances for 30 iterations (more or less 1 mins, please do not exit !)" + sleep 3 + ./venv/bin/python -m cProfile -o ./glances.cprof ./run.py --stop-after 30 + ./venv-dev/bin/gprof2dot -f pstats ./glances.cprof | dot -Tsvg -o ./docs/_static/glances-cgraph.svg + rm -f ./glances.cprof + +profiling-pyinstrument: ## PyInstrument profiling + @echo "Start Glances for 30 iterations (more or less 1 mins, please do not exit !)" + sleep 3 + ./venv/bin/pip install pyinstrument + ./venv/bin/python -m pyinstrument -r html -o ./docs/_static/glances-pyinstrument.html -m glances --stop-after 30 + +profiling-pyspy: ## Flame profiling (currently not compatible with Python 3.12) + @echo "Start Glances for 30 iterations (more or less 1 mins, please do not exit !)" + sleep 3 + ./venv-dev/bin/py-spy record -o ./docs/_static/glances-flame.svg -d 60 -s -- ./venv/bin/python ./run.py --stop-after 30 + +profiling: profiling-gprof profiling-pyinstrument profiling-pyspy ## Profiling of the Glances software trace-malloc: ## Trace the malloc() calls @echo "Malloc test is running, please wait ~30 secondes..." @@ -184,19 +199,32 @@ snapcraft: # =================================================================== # Docker +# Need Docker Buildx package (apt install docker-buildx on Ubuntu) # =================================================================== docker: docker-alpine docker-ubuntu ## Generate local docker images -docker-alpine: ## Generate local docker images (Alpine) - docker build --target full -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-full . - docker build --target minimal -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-minimal . - docker build --target dev -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-dev . +docker-alpine: docker-alpine-full docker-alpine-minimal docker-alpine-dev ## Generate local docker images (Alpine) -docker-ubuntu: ## Generate local docker images (Ubuntu) - docker build --target full -f ./docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-full . - docker build --target minimal -f ./docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-minimal . - docker build --target dev -f ./docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-dev . +docker-alpine-full: ## Generate local docker image (Alpine full) + docker buildx build --target full -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-full . + +docker-alpine-minimal: ## Generate local docker image (Alpine minimal) + docker buildx build --target minimal -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-minimal . + +docker-alpine-dev: ## Generate local docker image (Alpine dev) + docker buildx build --target dev -f ./docker-files/alpine.Dockerfile -t glances:local-alpine-dev . + +docker-ubuntu: docker-ubuntu-full docker-ubuntu-minimal docker-ubuntu-dev ## Generate local docker images (Ubuntu) + +docker-ubuntu-full: ## Generate local docker image (Ubuntu full) + docker buildx build --target full -f ./docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-full . + +docker-ubuntu-minimal: ## Generate local docker image (Ubuntu minimal) + docker buildx build --target minimal -f ./docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-minimal . + +docker-ubuntu-dev: ## Generate local docker image (Ubuntu dev) + docker buildx build --target dev -f ./docker-files/ubuntu.Dockerfile -t glances:local-ubuntu-dev . # =================================================================== # Run @@ -211,6 +239,9 @@ run-debug: ## Start Glances in debug console mode (also called standalone) run-local-conf: ## Start Glances in co |