-
Notifications
You must be signed in to change notification settings - Fork 1
50 lines (44 loc) · 1.73 KB
/
Copy pathtest.yml
File metadata and controls
50 lines (44 loc) · 1.73 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
name: Test
on:
push:
branches-ignore:
- "dependabot/**"
# See https://securitylab.github.com/research/github-actions-preventing-pwn-requests/ for more details.
# Using pull_request_target in order to grant dependabot access to run the test action.
pull_request_target:
types: [labeled]
jobs:
test:
name: Test
if: contains(github.event.pull_request.labels.*.name, 'dependencies') || github.event_name == 'push'
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os:
- ubuntu-latest
steps:
- name: Determine swap space before
run: |
echo "SWAP_SPACE_BEFORE=$(if $(free -m | sed -n '3{p;q}' | grep -i swap &> /dev/null); then echo $(free -m | sed -n '3{p;q}' | awk '{print $2}'); else echo 0; fi;)" >> $GITHUB_ENV
- name: Check out swap-space
uses: actions/checkout@v4.1.1
with:
repository: get-bridge/swap-space
token: ${{ secrets.GITHUB_TOKEN }}
path: .github/actions/swap-space
ref: ${{ github.sha }}
- name: Use swap-space
uses: ./.github/actions/swap-space
with:
swap-size-mb: 10240 # 10G
- name: Determine swap space after
run: |
echo "SWAP_SPACE_AFTER=$(if $(free -m | sed -n '3{p;q}' | grep -i swap &> /dev/null); then echo $(free -m | sed -n '3{p;q}' | awk '{print $2}'); else echo 0; fi;)" >> $GITHUB_ENV
- name: Print before and after swap space
run: |
echo "The swap space before action: $SWAP_SPACE_BEFORE"
echo "The swap space after action: $SWAP_SPACE_AFTER"
- name: Assert swap space is within range
run: |
test $SWAP_SPACE_AFTER -ge 10230 -a $SWAP_SPACE_AFTER -le 10240