@@ -30,34 +30,15 @@ jobs:
30
30
- name : Check out code
31
31
uses : actions/checkout@v4
32
32
33
- - name : " Install QEMU"
34
- run : |
35
- set -eux
36
- sudo apt-get update
37
- sudo apt-get install -y --no-install-recommends ovmf qemu-system-x86 qemu-utils
38
- sudo modprobe kvm
39
- # `sudo usermod -aG kvm $(whoami)` does not take an effect on GHA
40
- sudo chown $(whoami) /dev/kvm
41
-
42
- - name : " Install Lima"
43
- env :
44
- GITHUB_TOKEN : ${{ github.token }} # required by `gh attestation verify`
45
- run : |
46
- set -eux
47
- LIMA_VERSION=$(curl -fsSL https://api.github.com/repos/lima-vm/lima/releases/latest | jq -r .tag_name)
48
- FILE="lima-${LIMA_VERSION:1}-Linux-x86_64.tar.gz"
49
- curl -fOSL https://github.com/lima-vm/lima/releases/download/${LIMA_VERSION}/${FILE}
50
- gh attestation verify --owner=lima-vm "${FILE}"
51
- sudo tar Cxzvf /usr/local "${FILE}"
52
- rm -f "${FILE}"
53
- # Export LIMA_VERSION For the GHA cache key
54
- echo "LIMA_VERSION=${LIMA_VERSION}" >>$GITHUB_ENV
33
+ - name : " Set up Lima"
34
+ uses : lima-vm/lima-actions/setup@v1
35
+ id : lima-actions-setup
55
36
56
37
- name : " Cache ~/.cache/lima"
57
38
uses : actions/cache@v4
58
39
with :
59
40
path : ~/.cache/lima
60
- key : lima-${{ env.LIMA_VERSION }}
41
+ key : lima-${{ steps.lima-actions-setup.outputs.version }}
61
42
62
43
- name : " Start an instance of Fedora"
63
44
run : |
73
54
limactl shell another curl http://lima-default.internal
74
55
` ` `
75
56
57
+ See also <https://github.com/lima-vm/lima-actions>.
58
+
76
59
### Plain mode
77
60
78
61
The ` --plain` mode is useful when you want the VM instance to be as close as possible to a physical host:
@@ -82,14 +65,14 @@ The `--plain` mode is useful when you want the VM instance to be as close as pos
82
65
# --plain is set to disable file sharing, port forwarding, built-in containerd, etc.
83
66
run: limactl start --plain --name=default --cpus=1 --memory=1 --network=lima:user-v2 template://fedora
84
67
68
+ - name: "Set up SSH"
69
+ uses: lima-vm/lima-actions/ssh@v1
70
+
85
71
- name: "Initialize Fedora"
86
72
# plain old rsync and ssh are used for the initialization of the guest,
87
73
# so that people who are not familiar with Lima can understand the initialization steps.
88
74
run: |
89
75
set -eux -o pipefail
90
- # Initialize SSH
91
- mkdir -p -m 0700 ~/.ssh
92
- cat ~/.lima/default/ssh.config >> ~/.ssh/config
93
76
# Sync the current directory to /tmp/repo in the guest
94
77
rsync -a -e ssh . lima-default:/tmp/repo
95
78
# Install packages
0 commit comments