Skip to content

Commit 4588b33

Browse files
jacob-carlborgjacob-carlborg-apoex
authored andcommitted
Fix #30: Add support for Haiku
1 parent 0d662bb commit 4588b33

File tree

12 files changed

+463
-3
lines changed

12 files changed

+463
-3
lines changed

.github/workflows/ci.yml

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,41 @@ jobs:
120120
uname_hardware: ${{ matrix.architecture.uname || matrix.architecture.name }}
121121
work_directory: ${{ matrix.host.work_directory }}
122122

123+
Haiku:
124+
name: Haiku ${{ matrix.architecture.name }} ${{ matrix.version.name }} on ${{ matrix.host.name }}
125+
runs-on: ${{ matrix.host.name }}
126+
timeout-minutes: 5
127+
strategy:
128+
fail-fast: false
129+
matrix:
130+
version:
131+
- name: 'r1beta5'
132+
uname: hrev57937
133+
134+
architecture:
135+
- name: x86-64
136+
uname: x86_64
137+
138+
host:
139+
- name: ubuntu-latest
140+
work_directory: /home/runner/work/action/action
141+
142+
steps:
143+
- name: Checkout
144+
uses: actions/checkout@v4
145+
with:
146+
persist-credentials: false
147+
148+
- name: test
149+
uses: ./.github/workflows/support/test
150+
with:
151+
name: Haiku
152+
architecture: ${{ matrix.architecture.name }}
153+
version: ${{ matrix.version.name }}
154+
uname_version: ${{ matrix.version.uname }}
155+
uname_hardware: ${{ matrix.architecture.uname || matrix.architecture.name }}
156+
work_directory: ${{ matrix.host.work_directory }}
157+
123158
OpenBSD:
124159
name: OpenBSD ${{ matrix.architecture.name }} ${{ matrix.version }} on ${{ matrix.host.name }}
125160
runs-on: ${{ matrix.host.name }}

changelog.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
99
### Added
1010
- Add support for FreeBSD 13.5 ([#99](https://github.com/cross-platform-actions/action/issues/99))
1111
- Add support for OpenBSD 7.7 ([openbsd-builder#21](https://github.com/cross-platform-actions/openbsd-builder/pull/21))
12+
- Add support for Haiku ([#30](https://github.com/cross-platform-actions/action/issues/30))
1213

1314
## [0.27.0] - 2025-01-22
1415
### Added

dist/index.js

Lines changed: 131 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/index.js.map

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

readme.md

Lines changed: 17 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -50,8 +50,8 @@ jobs:
5050
5151
Here's a sample workflow file which will set up a matrix resulting in four
5252
jobs. One which will run on FreeBSD 14.0, one which runs OpenBSD 7.7, one which
53-
runs NetBSD 10.0, one which runs OpenBSD 7.7 on ARM64 and one which runs NetBSD
54-
10.1 on ARM64.
53+
runs NetBSD 10.0, one which runs OpenBSD 7.7 on ARM64, one which runs NetBSD
54+
10.1 on ARM64 and one which runs Haiku R1/beta5 on x86-64.
5555
5656
```yaml
5757
name: CI
@@ -84,6 +84,10 @@ jobs:
8484
architecture: arm64
8585
version: '10.1'
8686

87+
- name: haiku
88+
architecture: x86-64
89+
version: 'r1beta5'
90+
8791
steps:
8892
- uses: actions/checkout@v4
8993

@@ -208,6 +212,16 @@ operating system will list which versions are supported.
208212
| 9.3 | ✅ | ❌ |
209213
| 9.2 | ✅ | ❌ |
210214

215+
### [Haiku][haiku_builder] (`haiku`)
216+
217+
Note, Haiku is a single user system. That means the user that runs the the job
218+
is the default (and only) user, `user`, instead of `runner`, as for the other
219+
operating systems.
220+
221+
| Version | x86-64 |
222+
|---------|--------|
223+
| r1beta5 | ✅ |
224+
211225
### Architectures
212226

213227
This section lists the supported architectures and any aliases. All the names
@@ -404,4 +418,5 @@ files within the [`test/http`](test/http) are ignore by Git.
404418
[openbsd_builder]: https://github.com/cross-platform-actions/openbsd-builder
405419
[freebsd_builder]: https://github.com/cross-platform-actions/freebsd-builder
406420
[netbsd_builder]: https://github.com/cross-platform-actions/netbsd-builder
421+
[haiku_builder]: https://github.com/cross-platform-actions/haiku-builder
407422
[act]: https://github.com/nektos/act
Lines changed: 92 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,92 @@
1+
import Haiku from '../../../src/operating_systems/haiku/haiku'
2+
import * as hostModule from '../../../src/host'
3+
import * as arch from '../../../src/architecture'
4+
import * as os from '../../../src/operating_systems/kind'
5+
import HostQemu from '../../../src/host_qemu'
6+
import * as hypervisor from '../../../src/hypervisor'
7+
import * as qemu from '../../../src/qemu_vm'
8+
import * as xhyve from '../../../src/xhyve_vm'
9+
import * as haikuQemuVm from '../../../src/operating_systems/haiku/qemu_vm'
10+
import {Input} from '../../../src/action/input'
11+
12+
describe('Haiku OperatingSystem', () => {
13+
class Host extends hostModule.Host {
14+
get vmModule(): typeof xhyve | typeof qemu {
15+
return qemu
16+
}
17+
18+
override get qemu(): HostQemu {
19+
return new HostQemu.LinuxHostQemu()
20+
}
21+
22+
override get hypervisor(): hypervisor.Hypervisor {
23+
return new hypervisor.Qemu()
24+
}
25+
26+
override get efiHypervisor(): hypervisor.Hypervisor {
27+
return new hypervisor.QemuEfi()
28+
}
29+
30+
override get defaultMemory(): string {
31+
return '6G'
32+
}
33+
34+
override get defaultCpuCount(): number {
35+
return 6
36+
}
37+
38+
override validateHypervisor(_kind: hypervisor.Kind): void {}
39+
}
40+
41+
let host = new Host()
42+
let osKind = os.Kind.for('haiku')
43+
let architecture = arch.Architecture.for(
44+
arch.Kind.x86_64,
45+
host,
46+
osKind,
47+
host.hypervisor
48+
)
49+
let haiku = new Haiku(architecture, '0.0.0')
50+
51+
let hypervisorDirectory = 'hypervisor/directory'
52+
let resourcesDirectory = 'resources/directory'
53+
let firmwareDirectory = 'firmware/directory'
54+
let input = new Input()
55+
56+
let config = {
57+
memory: '4G',
58+
cpuCount: 7,
59+
diskImage: '',
60+
resourcesDiskImage: '',
61+
userboot: ''
62+
}
63+
64+
describe('createVirtualMachine', () => {
65+
it('creates a virtual machine with the correct configuration', () => {
66+
let qemuVmSpy = spyOn(haikuQemuVm, 'Vm')
67+
68+
haiku.createVirtualMachine(
69+
hypervisorDirectory,
70+
resourcesDirectory,
71+
firmwareDirectory,
72+
input,
73+
config
74+
)
75+
76+
expect(qemuVmSpy).toHaveBeenCalledOnceWith(
77+
hypervisorDirectory,
78+
resourcesDirectory,
79+
architecture,
80+
input,
81+
{
82+
...config,
83+
ssHostPort: 2847,
84+
cpu: 'max',
85+
machineType: 'q35',
86+
uuid: '864ED7F0-7876-4AA7-8511-816FABCFA87F',
87+
firmware: `${firmwareDirectory}/share/qemu/bios-256k.bin`
88+
}
89+
)
90+
})
91+
})
92+
})

0 commit comments

Comments
 (0)