Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

test: Use ubuntu runner instead of macos runner for tests #359

Merged
merged 5 commits into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 11 additions & 10 deletions .github/workflows/go.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
strategy:
fail-fast: false
matrix:
go-version: ["1.20.x", "1.21.x", "1.22.0-rc.1"]
go-version: ["1.20.x", "1.21.x", "1.22.x"]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -38,24 +38,25 @@ jobs:
path: bin/*

tests:
runs-on: macos-latest # Only Mac runners support nested virt
runs-on: ubuntu-latest # The runner must support nested virt
needs: build # Don't bother testing if cross arch build fails
timeout-minutes: 30
steps:
- uses: actions/checkout@v4

- name: Install
- name: Install qemu
run: |
brew install qemu
touch continue
sudo apt install qemu-kvm
sudo usermod -a -G kvm $USER

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.20.x
go-version-file: 'go.mod'

- name: Test
run: make test
run: |
sudo -s -u ${USER} bash -c 'make test'

- uses: actions/upload-artifact@v4
if: always()
Expand All @@ -72,12 +73,12 @@ jobs:
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.20.x
go-version-file: 'go.mod'

- name: Build
- name: Build
run: make win-sshproxy

- name: Test
- name: Test
run: go test -v .\test-win-sshproxy


5 changes: 2 additions & 3 deletions .github/workflows/golangci-lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,11 +11,10 @@ jobs:
name: lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: 1.20.x

- uses: actions/checkout@v4
praveenkumar marked this conversation as resolved.
Show resolved Hide resolved
go-version-file: 'go.mod'
- name: golangci-lint
uses: golangci/golangci-lint-action@v6
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ jobs:

- name: Set up Go
uses: actions/setup-go@v5
with:
go-version-file: 'go.mod'

- name: Build
run: |
Expand Down
16 changes: 11 additions & 5 deletions test/suite_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -150,17 +150,23 @@ outer:
})

func qemuExecutable() string {
if runtime.GOOS == "darwin" {
return "qemu-system-x86_64"
qemuBinaries := []string{"qemu-kvm", "qemu-system-x86_64"}
for _, binary := range qemuBinaries {
path, err := exec.LookPath(binary)
if err == nil && path != "" {
return path
}
}
return "qemu-kvm"

return ""
}

func qemuArgs() string {
accel := "kvm"
if runtime.GOOS == "darwin" {
return "-machine q35,accel=hvf:tcg -smp 4 -cpu host"
accel = "hvf"
}
return "-cpu host"
return fmt.Sprintf("-machine q35,accel=%s:tcg -smp 4 -cpu host", accel)
}

func createSSHKeys() (string, error) {
Expand Down