Skip to content

Commit

Permalink
Merge pull request #9 from prometheus/superq/bugfix_action
Browse files Browse the repository at this point in the history
Fixup action
  • Loading branch information
SuperQ authored Sep 9, 2024
2 parents 1074bbd + cd55a5f commit 652a2ae
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions actions/setup_environment/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,17 +37,20 @@ runs:
restore-keys: |
${{ runner.os }}-npm-
- name: Set GOMEMLIMIT
shell: bash
run: |
ratio="${{ inputs.memlimit_ratio }}"
# Get the memory limit from cgroups v2.
ratio=${{ inputs.memlimit_ratio }}
cgroup=$(awk -F':' '{print $3}' /proc/self/cgroup)
cgroup_mem_limit=$(< "/sys/fs/cgroup/${cgroup}/memory.max")
if [[ "${cgroup_mem_limit}" != "max" ]] ; then
echo "${cgroup_mem_limit}" | awk -v "ratio=${ratio}" '{printf "GOMEMLIMIT=%.0fKiB\n", $1 / 1024 * ratio}' >> "$GITHUB_ENV"
exit 0
fi
# Fallback to the system memory limit.
awk -v "ratio=${ratio}" '$1 == "MemTotal:" {printf "GOMEMLIMIT=%.0fKiB\n", $2 * ratio}' /proc/meminfo >> "$GITHUB_ENV"
if: inputs.enable_go == 'true'
- run: echo "GOMEMLIMIT=${GOMEMLIMIT}"
shell: bash
if: inputs.enable_go == 'true'
- run: make promu
shell: bash
if: inputs.enable_go == 'true'
Expand Down

0 comments on commit 652a2ae

Please sign in to comment.