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

use go 1.23 #181

Merged
merged 21 commits into from
Oct 24, 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
11 changes: 11 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
name: CI

on:
workflow_dispatch:
pull_request:
branches: [main]
push:
Expand Down Expand Up @@ -33,6 +34,16 @@ jobs:
needs: check-changes
if: ${{ needs.check-changes.outputs.go == 'true' }}
runs-on: ubuntu-latest
services:
obs:
image: ghcr.io/andreykaipov/goobs:latest
ports: [4455:1234]
obs-record:
image: ghcr.io/andreykaipov/goobs:latest
ports: [4456:1234]
obs-stream:
image: ghcr.io/andreykaipov/goobs:latest
ports: [4457:1234]
steps:
- uses: actions/checkout@v4
- uses: magnetikonline/action-golang-cache@v5
Expand Down
2 changes: 1 addition & 1 deletion go.mod
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
module github.com/andreykaipov/goobs

go 1.20
go 1.23

require (
github.com/buger/jsonparser v1.1.1
Expand Down
6 changes: 5 additions & 1 deletion internal/generate/tests/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,8 @@ var (
// I am just too lazy to get them to not error.
//
requestsTestsAssertingErrors = []string{
"config.CreateProfile", // docker profile already exists in image configs
"config.RemoveProfile", // can't remove the only profile
"config.CreateSceneCollection", // we start with a `SceneCollectionName` collection already
"filters.SetSourceFilterName", // not idempotent
"general.CallVendorRequest", // no other third party plugins in my obs image
Expand Down Expand Up @@ -121,6 +123,8 @@ func generateRequestTest(subclient, category string, structs map[string]StructFi
case "*string":
lit := ""
switch field {
case "ProfileName":
lit = "docker"
case "Realm":
lit = "OBS_WEBSOCKET_DATA_REALM_GLOBAL"
case "MediaAction":
Expand Down Expand Up @@ -225,7 +229,7 @@ func generateRequestTest(subclient, category string, structs map[string]StructFi
})),
),
Qual(assert, "NoError").Call(Id("t"), Id("err")),
//Defer().Id("client").Dot("Disconnect").Call(),
// Defer().Id("client").Dot("Disconnect").Call(),

Id("t").Dot("Cleanup").Call(Func().Call().Block(
Id("client").Dot("Disconnect").Call(),
Expand Down
12 changes: 9 additions & 3 deletions script/test.sh
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
#!/bin/sh

cleanup() { docker stop obs-record obs-stream; }
cleanup() {
if [ -n "$CI" ]; then return; fi
docker stop obs-record obs-stream
}

setup() {
setup_docker() {
echo "Setting up OBS instances for functional tests..."

obs="$(docker container inspect -f '{{.State.Status}}' obs || true)"
Expand All @@ -20,7 +23,10 @@ setup() {
echo "Spinning up OBS instances for 'record' and 'stream' tests"
docker run --rm --detach --name obs-record -p 4456:1234 ghcr.io/andreykaipov/goobs:latest
docker run --rm --detach --name obs-stream -p 4457:1234 ghcr.io/andreykaipov/goobs:latest
}

setup() {
if [ -z "$CI" ]; then setup_docker; fi
covermode=count
echo "mode: $covermode" >coverall.out
}
Expand All @@ -33,10 +39,10 @@ gotest() {
}

main() {
: "${CI=}"
set -eu
trap cleanup EXIT
setup
sleep 10
export OBS_PORT

# note: `scenes` and `transitions` must be ran after `ui`
Expand Down
10 changes: 5 additions & 5 deletions zz_generated._test.go
Original file line number Diff line number Diff line change
Expand Up @@ -36,11 +36,11 @@ func Test_config(t *testing.T) {
client.Disconnect()
})

_, err = client.Config.CreateProfile(&config.CreateProfileParams{ProfileName: &[]string{"test"}[0]})
_, err = client.Config.CreateProfile(&config.CreateProfileParams{ProfileName: &[]string{"docker"}[0]})
if err != nil {
t.Logf("%s", err)
}
assert.NoError(t, err)
assert.Error(t, err)
_, err = client.Config.CreateSceneCollection(
&config.CreateSceneCollectionParams{SceneCollectionName: &[]string{"test"}[0]},
)
Expand Down Expand Up @@ -89,7 +89,7 @@ func Test_config(t *testing.T) {
t.Logf("%s", err)
}
assert.NoError(t, err)
_, err = client.Config.SetCurrentProfile(&config.SetCurrentProfileParams{ProfileName: &[]string{"test"}[0]})
_, err = client.Config.SetCurrentProfile(&config.SetCurrentProfileParams{ProfileName: &[]string{"docker"}[0]})
if err != nil {
t.Logf("%s", err)
}
Expand Down Expand Up @@ -144,11 +144,11 @@ func Test_config(t *testing.T) {
t.Logf("%s", err)
}
assert.NoError(t, err)
_, err = client.Config.RemoveProfile(&config.RemoveProfileParams{ProfileName: &[]string{"test"}[0]})
_, err = client.Config.RemoveProfile(&config.RemoveProfileParams{ProfileName: &[]string{"docker"}[0]})
if err != nil {
t.Logf("%s", err)
}
assert.NoError(t, err)
assert.Error(t, err)
}

func Test_filters(t *testing.T) {
Expand Down
Loading