|
| 1 | +name: job-test-in-lima-freebsd |
| 2 | + |
| 3 | +on: |
| 4 | + workflow_call: |
| 5 | + inputs: |
| 6 | + timeout: |
| 7 | + required: true |
| 8 | + type: number |
| 9 | + runner: |
| 10 | + required: true |
| 11 | + type: string |
| 12 | + |
| 13 | +jobs: |
| 14 | + test: |
| 15 | + name: "FreeBSD" |
| 16 | + timeout-minutes: ${{ inputs.timeout }} |
| 17 | + runs-on: "${{ inputs.runner }}" |
| 18 | + steps: |
| 19 | + - name: "Init: checkout" |
| 20 | + uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6.0.3 |
| 21 | + with: |
| 22 | + fetch-depth: 1 |
| 23 | + persist-credentials: false |
| 24 | + |
| 25 | + - name: "Init: lima" |
| 26 | + uses: lima-vm/lima-actions/setup@55627e31b78637bf254a8b2a14da8ea7d12564e5 # v1.1.0 |
| 27 | + id: lima-actions-setup |
| 28 | + |
| 29 | + - name: "Init: Cache" |
| 30 | + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5.0.5 |
| 31 | + with: |
| 32 | + path: ~/.cache/lima |
| 33 | + key: lima-${{ steps.lima-actions-setup.outputs.version }}-freebsd |
| 34 | + |
| 35 | + - name: "Init: Install xorriso (required by Lima for running FreeBSD)" |
| 36 | + run: | |
| 37 | + set -eux |
| 38 | + sudo apt-get update |
| 39 | + sudo apt-get install -y xorriso |
| 40 | +
|
| 41 | + - name: "Init: start the guest VM" |
| 42 | + run: | |
| 43 | + set -eux |
| 44 | + limactl start --plain --name=default template://freebsd |
| 45 | + lima freebsd-version -kru |
| 46 | + lima sudo pkg install -y bash go containerd runj |
| 47 | +
|
| 48 | + - name: "Init: copy source into the guest VM" |
| 49 | + run: | |
| 50 | + set -eux |
| 51 | + limactl copy -r . default:/tmp/nerdctl |
| 52 | +
|
| 53 | + - name: "Init: build nerdctl" |
| 54 | + run: lima --workdir /tmp/nerdctl sudo go build -o /usr/local/bin/nerdctl ./cmd/nerdctl |
| 55 | + |
| 56 | + - name: "Run: test-unit" |
| 57 | + run: lima --workdir /tmp/nerdctl go test -v ./pkg/... |
| 58 | + |
| 59 | + - name: "Run: test-integration" |
| 60 | + timeout-minutes: 3 |
| 61 | + run: | |
| 62 | + set -eux |
| 63 | + lima sudo containerd >containerd.log 2>&1 & |
| 64 | + sleep 3 |
| 65 | + lima sudo /usr/local/bin/nerdctl run --rm --net=none dougrabson/freebsd-minimal:13 echo 'Nerdctl is up and running.' |
0 commit comments