From b66904eb8b39132ecc996b779a5225c9c27a9f2b Mon Sep 17 00:00:00 2001 From: Ray Oei <10501445+RayOei@users.noreply.github.com> Date: Mon, 3 Mar 2025 22:16:28 +0100 Subject: [PATCH] Skip build test for non essentials #690 --- .github/workflows/build-and-test.yml | 24 +++++++++++++++++++++--- 1 file changed, 21 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-test.yml b/.github/workflows/build-and-test.yml index 4ab3d8c8..51aec1d6 100644 --- a/.github/workflows/build-and-test.yml +++ b/.github/workflows/build-and-test.yml @@ -14,28 +14,46 @@ jobs: RM_TS_DIR: "/tmp/rmlint-unit-testdir" steps: - uses: actions/checkout@v4 + with: + fetch-depth: 0 + + - name: "Check changes" + # TODO also include skipping build but allow docs to be processed + run: | + if git diff --exit-code --name-only origin/master . ':!.gitignore' ':!docs' ':!*.md' ':!*.txt' ':!*.yml'; then + echo "SKIP_CHANGES=false" >> "$GITHUB_ENV" + else + echo "SKIP_CHANGES=true" >> "$GITHUB_ENV" + fi + - name: "Prepare build environment" run: | - sudo apt update - sudo apt install -y --no-install-recommends \ + sudo apt-get update + sudo apt-get install -y --no-install-recommends \ scons python3-sphinx gettext python3-setuptools \ libblkid-dev libelf-dev libglib2.0-dev libjson-glib-dev \ clang python3-pip python3-cffi python3-dev libffi-dev pip3 install -r tests/requirements.txt + - name: "Build" # Todo: eventually run tests with valgrind (RM_TS_USE_VALGRIND) # Todo enable slow tests in pytest run: | scons config scons VERBOSE=1 DEBUG=1 O=release + - name: "Prepare test environment" + # TODO Ignore linter warning. See https://github.com/github/vscode-github-actions/issues/222 + if: ${{ env.SKIP_CHANGES == 'true' }} # The test suite is seriously disk-intensive. Given that linux # instances hosted in GitHub have 16G of RAM available we will # use it to speed up the run. run: | sudo mkdir "${RM_TS_DIR}" sudo mount -o size=12G,nr_inodes=0 -t tmpfs tmpfs "${RM_TS_DIR}" - - name: "Test" + + - name: "Test it" + if: ${{ env.SKIP_CHANGES == 'true' }} run: | RM_TS_PRINT_CMD=1 RM_TS_PEDANTIC=0 python -m pytest -s -v - name: CoW tests