Skip to content

Commit

Permalink
fixup! Add support for NetBSD ARM64
Browse files Browse the repository at this point in the history
  • Loading branch information
jacob-carlborg committed Jan 28, 2024
1 parent d3392f1 commit c9c7aa2
Show file tree
Hide file tree
Showing 7 changed files with 24 additions and 87 deletions.
14 changes: 14 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -124,20 +124,34 @@ jobs:
fail-fast: false
matrix:
version:
- '10.0_RC2'
- '9.3'
- '9.2'

architecture:
- name: x86-64
uname: amd64

- name: arm64
uname: aarch64

host:
- name: ubuntu-latest
work_directory: /home/runner/work/action/action

- name: macos-latest
work_directory: /Users/runner/work/action/action

exclude:
- version: '9.3'
architecture: { name: arm64 }

- version: '9.2'
architecture: { name: arm64 }

- architecture: { name: arm64 }
host: { name: macos-latest }

steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/support/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,12 +34,14 @@ runs:
shutdown_vm: false
run: |
uname -a
uname -m
uname -p
echo $SHELL
pwd
ls -lah
whoami
env | sort
[ "`uname -s`" = '${{ inputs.name }}' ]
[ "`uname -r`" = '${{ inputs.uname_release || inputs.version }}' ]
[ "`uname -m`" = '${{ inputs.uname_hardware }}' ]
[ "`uname -m`" = '${{ inputs.uname_hardware }}' ] || [ "`uname -p`" = '${{ inputs.uname_hardware }}' ]
[ "`pwd`" = '${{ inputs.work_directory }}' ]
53 changes: 3 additions & 50 deletions dist/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion dist/index.js.map

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion src/architecture.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ export abstract class Architecture {
}

override get hypervisor(): hypervisor.Hypervisor {
return new hypervisor.Qemu()
return this.host.efiHypervisor
}

override get efiHypervisor(): hypervisor.Hypervisor {
Expand Down
8 changes: 0 additions & 8 deletions src/operating_systems/freebsd/arm64.ts

This file was deleted.

28 changes: 2 additions & 26 deletions src/operating_systems/freebsd/factory.ts
Original file line number Diff line number Diff line change
@@ -1,35 +1,11 @@
import * as architecture from '../../architecture'
import Arm64 from './arm64'
import {Hypervisor, Kind as HypervisorKind} from '../../hypervisor'
import {OperatingSystem} from '../../operating_system'
import {factory, Factory as BaseFactory} from '../factory'
import FreeBsd from './freebsd'

@factory
//@ts-ignore
class FreeBsdFactory extends BaseFactory {
override createImpl(
version: string,
hypervisor: Hypervisor
): OperatingSystem {
return new FreeBsd(this.resolveArchitecture(hypervisor), version)
}

override validateHypervisor(kind: HypervisorKind): void {
this.architecture.validateHypervisor(kind)
}

private resolveArchitecture(
hypervisor: Hypervisor
): architecture.Architecture {
if (this.architecture.kind == architecture.Kind.arm64) {
return new Arm64(
this.architecture.kind,
this.architecture.host,
hypervisor
)
}

return this.architecture
override createImpl(version: string): OperatingSystem {
return new FreeBsd(this.architecture, version)
}
}

0 comments on commit c9c7aa2

Please sign in to comment.