refactor: make use of parent cgroups for finding limits (#22) #76
This file contains hidden or 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
| name: ci | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| jobs: | |
| test: | |
| strategy: | |
| matrix: | |
| runs-on: | |
| - windows-latest | |
| - depot-ubuntu-24.04-arm | |
| - depot-ubuntu-24.04 | |
| - depot-macos-latest | |
| runs-on: ${{ matrix.runs-on }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "~1.22" | |
| - name: Download Go modules | |
| run: go mod download | |
| - name: Test | |
| run: make test | |
| env: | |
| CLISTAT_IS_CGROUPV2: ${{ startsWith(matrix.runs-on, 'depot-ubuntu') && 'yes' || '' }} | |
| test-race: | |
| strategy: | |
| matrix: | |
| runs-on: | |
| - windows-latest | |
| - depot-ubuntu-24.04-arm | |
| - depot-ubuntu-24.04 | |
| - depot-macos-latest | |
| runs-on: ${{ matrix.runs-on }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "~1.22" | |
| - name: Download Go modules | |
| run: go mod download | |
| - name: Test race | |
| run: make test-race | |
| env: | |
| CLISTAT_IS_CGROUPV2: ${{ startsWith(matrix.runs-on, 'depot-ubuntu') && 'yes' || '' }} | |
| test-container: | |
| strategy: | |
| matrix: | |
| runs-on: | |
| - depot-ubuntu-22.04-arm | |
| - depot-ubuntu-24.04-arm | |
| - depot-ubuntu-22.04 | |
| - depot-ubuntu-24.04 | |
| runtime: | |
| - runc | |
| options: | |
| - "--memory=1024MB" | |
| - "--cpus=1" | |
| - "--cpuset-cpus=0" | |
| runs-on: ${{ matrix.runs-on }} | |
| container: | |
| image: golang:1.23 | |
| options: "--runtime=${{ matrix.runtime }} ${{ matrix.options }}" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download Go modules | |
| run: go mod download | |
| - name: Test | |
| run: make test | |
| env: | |
| CLISTAT_IS_CONTAINERIZED: "yes" | |
| CLISTAT_IS_CGROUPV2: "yes" | |
| CLISTAT_HAS_MEMORY_LIMIT: ${{ contains(matrix.options, '--memory=') && 'yes' || '' }} | |
| CLISTAT_HAS_CPU_LIMIT: ${{ contains(matrix.options, '--cpus=') && 'yes' || '' }} | |
| CLISTAT_CPU_COUNT: ${{ contains(matrix.options, '--cpuset-cpus=') && '2' || '' }} | |
| test-container-race: | |
| strategy: | |
| matrix: | |
| runs-on: | |
| - depot-ubuntu-22.04-arm | |
| - depot-ubuntu-24.04-arm | |
| - depot-ubuntu-22.04 | |
| - depot-ubuntu-24.04 | |
| runtime: | |
| - runc | |
| options: | |
| - "--memory=1024MB" | |
| - "--cpus=1" | |
| runs-on: ${{ matrix.runs-on }} | |
| container: | |
| image: golang:1.23 | |
| options: "--runtime=${{ matrix.runtime }} ${{ matrix.options }}" | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Download Go modules | |
| run: go mod download | |
| - name: Test race | |
| run: make test-race | |
| env: | |
| CLISTAT_IS_CONTAINERIZED: "yes" | |
| CLISTAT_IS_CGROUPV2: "yes" | |
| CLISTAT_HAS_MEMORY_LIMIT: ${{ contains(matrix.options, '--memory=') && 'yes' || '' }} | |
| CLISTAT_HAS_CPU_LIMIT: ${{ contains(matrix.options, '--cpus=') && 'yes' || '' }} | |
| fmt: | |
| runs-on: depot-ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "~1.22" | |
| - name: Format | |
| run: make -B fmt | |
| - name: Check for unstaged | |
| run: ./scripts/check_unstaged.sh | |
| lint: | |
| runs-on: depot-ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| - name: Setup Go | |
| uses: actions/setup-go@v5 | |
| with: | |
| go-version: "~1.22" | |
| - name: Lint | |
| run: make lint |