Skip to content

Commit 3cf67de

Browse files
authored
Merge pull request #1 from RayOei/gh_workflow_skip_build
Gh workflow skip build #690
2 parents d328a41 + 2b96a0e commit 3cf67de

File tree

1 file changed

+21
-3
lines changed

1 file changed

+21
-3
lines changed

.github/workflows/build-and-test.yml

+21-3
Original file line numberDiff line numberDiff line change
@@ -14,27 +14,45 @@ jobs:
1414
RM_TS_DIR: "/tmp/rmlint-unit-testdir"
1515
steps:
1616
- uses: actions/checkout@v4
17+
with:
18+
fetch-depth: 0
19+
20+
- name: "Check changes"
21+
# TODO also include skipping build but allow docs to be processed
22+
run: |
23+
if git diff --exit-code --name-only origin/master . ':!.gitignore' ':!docs' ':!*.md' ':!*.txt' ':!*.yml'; then
24+
echo "SKIP_CHANGES=false" >> "$GITHUB_ENV"
25+
else
26+
echo "SKIP_CHANGES=true" >> "$GITHUB_ENV"
27+
fi
28+
1729
- name: "Prepare build environment"
1830
run: |
19-
sudo apt update
20-
sudo apt install -y --no-install-recommends \
31+
sudo apt-get update
32+
sudo apt-get install -y --no-install-recommends \
2133
scons python3-sphinx gettext python3-setuptools \
2234
libblkid-dev libelf-dev libglib2.0-dev libjson-glib-dev \
2335
clang python3-pip python3-cffi python3-dev libffi-dev
2436
pip3 install -r tests/requirements.txt
37+
2538
- name: "Build"
2639
# Todo: eventually run tests with valgrind (RM_TS_USE_VALGRIND)
2740
# Todo enable slow tests in pytest
2841
run: |
2942
scons config
3043
scons VERBOSE=1 DEBUG=1 O=release
44+
3145
- name: "Prepare test environment"
46+
# TODO Ignore linter warning. See https://github.com/github/vscode-github-actions/issues/222
47+
if: ${{ env.SKIP_CHANGES == 'true' }}
3248
# The test suite is seriously disk-intensive. Given that linux
3349
# instances hosted in GitHub have 16G of RAM available we will
3450
# use it to speed up the run.
3551
run: |
3652
sudo mkdir "${RM_TS_DIR}"
3753
sudo mount -o size=12G,nr_inodes=0 -t tmpfs tmpfs "${RM_TS_DIR}"
38-
- name: "Test"
54+
55+
- name: "Test it"
56+
if: ${{ env.SKIP_CHANGES == 'true' }}
3957
run: |
4058
RM_TS_PRINT_CMD=1 RM_TS_PEDANTIC=0 python -m pytest -s -v

0 commit comments

Comments
 (0)