diff --git a/.github/workflows/scripts/setup-dependencies.sh b/.github/workflows/scripts/setup-dependencies.sh index c788f0afab9f..440d5e8e5ac9 100755 --- a/.github/workflows/scripts/setup-dependencies.sh +++ b/.github/workflows/scripts/setup-dependencies.sh @@ -1,93 +1,93 @@ #!/usr/bin/env bash set -eu function prerun() { echo "::group::Install build dependencies" # remove snap things, update+upgrade will be faster then for x in lxd core20 snapd; do sudo snap remove $x; done sudo apt-get purge snapd google-chrome-stable firefox # https://github.com/orgs/community/discussions/47863 sudo apt-get remove grub-efi-amd64-bin grub-efi-amd64-signed shim-signed --allow-remove-essential sudo apt-get update sudo apt upgrade sudo xargs --arg-file=.github/workflows/build-dependencies.txt apt-get install -qq sudo apt-get clean sudo dmesg -c > /var/tmp/dmesg-prerun echo "::endgroup::" } function mod_build() { echo "::group::Generate debian packages" ./autogen.sh ./configure --enable-debug --enable-debuginfo --enable-asan --enable-ubsan make --no-print-directory --silent native-deb-utils native-deb-kmod mv ../*.deb . rm ./openzfs-zfs-dracut*.deb ./openzfs-zfs-dkms*.deb echo "$ImageOS-$ImageVersion" > tests/ImageOS.txt echo "::endgroup::" } function mod_install() { # install the pre-built module only on the same runner image MOD=`cat tests/ImageOS.txt` if [ "$MOD" != "$ImageOS-$ImageVersion" ]; then rm -f *.deb mod_build fi echo "::group::Install and load modules" - # delete kernel-shipped zfs modules, be sure about correct modules + # don't use kernel-shipped zfs modules sudo sed -i.bak 's/updates/extra updates/' /etc/depmod.d/ubuntu.conf sudo apt-get install --fix-missing ./*.deb # Native Debian packages enable and start the services # Stop zfs-zed daemon, as it may interfere with some ZTS test cases sudo systemctl stop zfs-zed sudo depmod -a sudo modprobe zfs sudo dmesg sudo dmesg -c > /var/tmp/dmesg-module-load echo "::endgroup::" echo "::group::Report CPU information" lscpu cat /proc/spl/kstat/zfs/chksum_bench echo "::endgroup::" echo "::group::Reclaim and report disk space" # remove 4GiB of images sudo systemd-run docker system prune --force --all --volumes # remove unused software sudo systemd-run --wait rm -rf \ "$AGENT_TOOLSDIRECTORY" \ /opt/* \ /usr/local/* \ /usr/share/az* \ /usr/share/dotnet \ /usr/share/gradle* \ /usr/share/miniconda \ /usr/share/swift \ /var/lib/gems \ /var/lib/mysql \ /var/lib/snapd # trim the cleaned space sudo fstrim / # disk usage afterwards df -h / echo "::endgroup::" } case "$1" in build) prerun mod_build ;; tests) prerun mod_install ;; esac diff --git a/.github/workflows/zfs-linux-tests.yml b/.github/workflows/zfs-linux-tests.yml index f72ff7f5a73f..c4fe930d092c 100644 --- a/.github/workflows/zfs-linux-tests.yml +++ b/.github/workflows/zfs-linux-tests.yml @@ -1,122 +1,124 @@ name: zfs-linux-tests on: workflow_call: inputs: os: description: 'The ubuntu version: 20.02 or 22.04' required: true type: string jobs: zloop: runs-on: ubuntu-${{ inputs.os }} steps: - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} - uses: actions/download-artifact@v3 with: name: modules-${{ inputs.os }} - name: Install modules run: | tar xzf modules-${{ inputs.os }}.tgz .github/workflows/scripts/setup-dependencies.sh tests - name: Tests timeout-minutes: 30 run: | sudo mkdir -p /var/tmp/zloop # run for 10 minutes or at most 2 iterations for a maximum runner # time of 20 minutes. sudo /usr/share/zfs/zloop.sh -t 600 -I 2 -l -m1 -- -T 120 -P 60 - name: Prepare artifacts if: failure() run: | sudo chmod +r -R /var/tmp/zloop/ - uses: actions/upload-artifact@v3 if: failure() with: name: Zpool-logs-${{ inputs.os }} path: | /var/tmp/zloop/*/ !/var/tmp/zloop/*/vdev/ + retention-days: 14 if-no-files-found: ignore - uses: actions/upload-artifact@v3 if: failure() with: name: Zpool-files-${{ inputs.os }} path: | /var/tmp/zloop/*/vdev/ + retention-days: 14 if-no-files-found: ignore sanity: runs-on: ubuntu-${{ inputs.os }} steps: - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} - uses: actions/download-artifact@v3 with: name: modules-${{ inputs.os }} - name: Install modules run: | tar xzf modules-${{ inputs.os }}.tgz .github/workflows/scripts/setup-dependencies.sh tests - name: Tests timeout-minutes: 60 shell: bash run: | set -o pipefail /usr/share/zfs/zfs-tests.sh -vKR -s 3G -r sanity | scripts/zfs-tests-color.sh - name: Prepare artifacts if: success() || failure() run: | RESPATH="/var/tmp/test_results" mv -f $RESPATH/current $RESPATH/testfiles tar cf $RESPATH/sanity.tar -h -C $RESPATH testfiles - uses: actions/upload-artifact@v3 if: success() || failure() with: name: Logs-${{ inputs.os }}-sanity path: /var/tmp/test_results/sanity.tar if-no-files-found: ignore functional: runs-on: ubuntu-${{ inputs.os }} strategy: fail-fast: false matrix: tests: [ part1, part2, part3, part4 ] steps: - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} - uses: actions/download-artifact@v3 with: name: modules-${{ inputs.os }} - name: Install modules run: | tar xzf modules-${{ inputs.os }}.tgz .github/workflows/scripts/setup-dependencies.sh tests - name: Setup tests run: | .github/workflows/scripts/setup-functional.sh ${{ matrix.tests }} >> $GITHUB_ENV - name: Tests timeout-minutes: 120 shell: bash run: | set -o pipefail /usr/share/zfs/zfs-tests.sh -vKR -s 3G -T ${{ env.TODO }} | scripts/zfs-tests-color.sh - name: Prepare artifacts if: success() || failure() run: | RESPATH="/var/tmp/test_results" mv -f $RESPATH/current $RESPATH/testfiles tar cf $RESPATH/${{ matrix.tests }}.tar -h -C $RESPATH testfiles - uses: actions/upload-artifact@v3 if: success() || failure() with: name: Logs-${{ inputs.os }}-functional path: /var/tmp/test_results/${{ matrix.tests }}.tar if-no-files-found: ignore diff --git a/.github/workflows/zfs-linux.yml b/.github/workflows/zfs-linux.yml index 4681bea50210..be3908deb948 100644 --- a/.github/workflows/zfs-linux.yml +++ b/.github/workflows/zfs-linux.yml @@ -1,71 +1,64 @@ name: zfs-linux on: push: pull_request: jobs: build: name: Build strategy: fail-fast: false matrix: os: [20.04, 22.04] runs-on: ubuntu-${{ matrix.os }} steps: - uses: actions/checkout@v3 with: ref: ${{ github.event.pull_request.head.sha }} - name: Build modules run: .github/workflows/scripts/setup-dependencies.sh build - name: Prepare modules upload - run: tar czf modules-${{ matrix.os }}.tgz *.deb .github scripts/zfs-tests-color.sh tests/test-runner tests/ImageOS.txt + run: tar czf modules-${{ matrix.os }}.tgz *.deb .github tests/test-runner tests/ImageOS.txt - uses: actions/upload-artifact@v3 with: name: modules-${{ matrix.os }} path: modules-${{ matrix.os }}.tgz - - name: Prepare scripts upload - run: tar czf scripts.tgz .github tests/test-runner - - uses: actions/upload-artifact@v3 - with: - name: scripts - path: scripts.tgz + retention-days: 14 testings: name: Testing strategy: fail-fast: false matrix: os: [20.04, 22.04] needs: build uses: ./.github/workflows/zfs-linux-tests.yml with: os: ${{ matrix.os }} cleanup: if: always() name: Cleanup runs-on: ubuntu-22.04 needs: testings steps: - uses: actions/download-artifact@v3 - name: Generating summary run: | - tar xzf scripts/scripts.tgz .github tests + tar xzf modules-22.04/modules-22.04.tgz .github tests .github/workflows/scripts/generate-summary.sh # up to 4 steps, each can have 1 MiB output (for debugging log files) - - run: .github/workflows/scripts/generate-summary.sh 1 - - run: .github/workflows/scripts/generate-summary.sh 2 - - run: .github/workflows/scripts/generate-summary.sh 3 - - run: .github/workflows/scripts/generate-summary.sh 4 + - name: Summary for errors #1 + run: .github/workflows/scripts/generate-summary.sh 1 + - name: Summary for errors #2 + run: .github/workflows/scripts/generate-summary.sh 2 + - name: Summary for errors #3 + run: .github/workflows/scripts/generate-summary.sh 3 + - name: Summary for errors #4 + run: .github/workflows/scripts/generate-summary.sh 4 - uses: actions/upload-artifact@v3 with: name: Summary Files path: Summary/ - - uses: geekyeggo/delete-artifact@v2 - with: - name: modules-20.04 - - uses: geekyeggo/delete-artifact@v2 - with: - name: modules-22.04