Skip to content

Commit 427d78e

Browse files
authored
Merge pull request #3314 from AkihiroSuda/docs
docs/examples/gha: use lima-actions
2 parents bb73d5f + eaddc6e commit 427d78e

File tree

2 files changed

+11
-26
lines changed

2 files changed

+11
-26
lines changed

website/content/en/docs/community/subprojects.md

+2
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,9 @@ weight: 90
55

66
Some portions of Lima are useful for other projects too and split out to separate repos:
77

8+
<!-- sorted by importance to end users -->
89
- <https://github.com/lima-vm/socket_vmnet>: vmnet.framework support for unmodified rootless QEMU
10+
- <https://github.com/lima-vm/lima-actions>: run Lima on GitHub Actions
911
- <https://github.com/lima-vm/go-qcow2reader>: qcow2 reader for Go
1012
- <https://github.com/lima-vm/sshocker>: ssh + reverse sshfs + port forwarder, in Docker-like CLI (predecessor of Lima)
1113
- <https://github.com/lima-vm/alpine-lima>: Create an alpine based image for lima

website/content/en/docs/examples/gha.md

+9-26
Original file line numberDiff line numberDiff line change
@@ -30,34 +30,15 @@ jobs:
3030
- name: Check out code
3131
uses: actions/checkout@v4
3232

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
5536

5637
- name: "Cache ~/.cache/lima"
5738
uses: actions/cache@v4
5839
with:
5940
path: ~/.cache/lima
60-
key: lima-${{ env.LIMA_VERSION }}
41+
key: lima-${{ steps.lima-actions-setup.outputs.version }}
6142

6243
- name: "Start an instance of Fedora"
6344
run: |
@@ -73,6 +54,8 @@ jobs:
7354
limactl shell another curl http://lima-default.internal
7455
```
7556
57+
See also <https://github.com/lima-vm/lima-actions>.
58+
7659
### Plain mode
7760
7861
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
8265
# --plain is set to disable file sharing, port forwarding, built-in containerd, etc.
8366
run: limactl start --plain --name=default --cpus=1 --memory=1 --network=lima:user-v2 template://fedora
8467
68+
- name: "Set up SSH"
69+
uses: lima-vm/lima-actions/ssh@v1
70+
8571
- name: "Initialize Fedora"
8672
# plain old rsync and ssh are used for the initialization of the guest,
8773
# so that people who are not familiar with Lima can understand the initialization steps.
8874
run: |
8975
set -eux -o pipefail
90-
# Initialize SSH
91-
mkdir -p -m 0700 ~/.ssh
92-
cat ~/.lima/default/ssh.config >> ~/.ssh/config
9376
# Sync the current directory to /tmp/repo in the guest
9477
rsync -a -e ssh . lima-default:/tmp/repo
9578
# Install packages

0 commit comments

Comments
 (0)