|
| 1 | +name: litevm test |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: |
| 6 | + - main |
| 7 | + pull_request: |
| 8 | + |
| 9 | +jobs: |
| 10 | + test: |
| 11 | + runs-on: ubuntu-20.04 |
| 12 | + strategy: |
| 13 | + matrix: |
| 14 | + # OL7 and OL8 use 3.6. OL9 uses 3.9. Also test on the latest. |
| 15 | + python-version: ["3.6", "3.9", "3.12"] |
| 16 | + fail-fast: false |
| 17 | + env: |
| 18 | + TOX_OVERRIDE: "tox.envlist=python${{ matrix.python-version }};tox.skip_missing_interpreters=false" |
| 19 | + steps: |
| 20 | + - uses: actions/checkout@v4 |
| 21 | + # If we rely on using the same Python version for tox as we do for the |
| 22 | + # testing version of Python, we end up getting different versions of tox |
| 23 | + # with different behavior. Let's setup a well-defined python version for |
| 24 | + # tox and use that. We need to place this one before the regular python |
| 25 | + # setup so that the regular python takes precedence. |
| 26 | + - name: Set up Python for Tox |
| 27 | + uses: actions/setup-python@v4 |
| 28 | + with: |
| 29 | + python-version: 3.12 |
| 30 | + - name: Set up Python |
| 31 | + uses: actions/setup-python@v4 |
| 32 | + with: |
| 33 | + python-version: ${{ matrix.python-version }} |
| 34 | + - name: Install dependencies |
| 35 | + run: | |
| 36 | + sudo apt-get update |
| 37 | + sudo apt-get install qemu-kvm zstd gzip bzip2 cpio busybox-static fio |
| 38 | + sudo wget -O /usr/bin/rpm2cpio https://github.com/rpm-software-management/rpm/raw/rpm-4.19.0-release/scripts/rpm2cpio.sh |
| 39 | + echo '0403da24a797ccfa0cfd37bd4a6d6049370b9773e558da6173ae6ad25f97a428 /usr/bin/rpm2cpio' | sha256sum -c - |
| 40 | + sudo chmod 755 /usr/bin/rpm2cpio |
| 41 | + - name: Setup test environment |
| 42 | + run: | |
| 43 | + python3.12 -m pip install --user --break-system-packages tox |
| 44 | + tox list |
| 45 | + tox --notest |
| 46 | + tox -e runner --notest |
| 47 | +
|
| 48 | + # Use Github Actions to cache RPMs by date. This can save a couple minutes |
| 49 | + # in the run, which is nice. The cache contains the Yum sqlite database, |
| 50 | + # and the downloaded RPMs. |
| 51 | + # |
| 52 | + # A cache miss results in getting the most recent cached data (e.g. from |
| 53 | + # yesterday). The runner will check the repo metadata and get the updated |
| 54 | + # data, and delete any stale data, so after the run completes, the |
| 55 | + # testdata can be cached for future runs. |
| 56 | + # |
| 57 | + # On a cache hit, the test runner will still check the yum repo metadata, |
| 58 | + # and if it differs from the cached data, it will clear and download it. |
| 59 | + # So a cache hit isn't guaranteed to speed things up, but kernel packages |
| 60 | + # aren't usually updated _that_ frequently. |
| 61 | + - name: Get Date |
| 62 | + id: get-date |
| 63 | + run: | |
| 64 | + echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT |
| 65 | + shell: bash |
| 66 | + - name: Cache RPMs |
| 67 | + uses: actions/cache@v3 |
| 68 | + with: |
| 69 | + path: testdata/yumcache |
| 70 | + key: ${{ runner.os }}-rpms-${{ steps.get-date.outputs.date }} |
| 71 | + restore-keys: | |
| 72 | + ${{ runner.os }}-rpms- |
| 73 | + - name: Fetch RPMs |
| 74 | + run: | |
| 75 | + tox -e runner -- python -m testing.litevm.rpm |
| 76 | +
|
| 77 | + - name: Run tests |
| 78 | + run: | |
| 79 | + tox -e runner -- python -m testing.litevm.vm --python-version ${{ matrix.python-version }} |
0 commit comments