Skip to content

Commit

Permalink
fix: CI pipeline working dir
Browse files Browse the repository at this point in the history
  • Loading branch information
BigJk committed Dec 25, 2023
1 parent 445a02f commit 4720e98
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 1 deletion.
2 changes: 1 addition & 1 deletion .github/workflows/test.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
exit 0
else
echo "Changes found in .go or .lua files. Running tests."
go test ./cmd/internal/tester -json > TestResults-${{ matrix.go-version }}.json
EOE_TESTER_WORKING_DIR=$(pwd) go test ./cmd/internal/tester -json > TestResults-${{ matrix.go-version }}.json
fi
'
- name: Upload Go test results
Expand Down
11 changes: 11 additions & 0 deletions cmd/internal/tester/main_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,17 @@ func TestGame(t *testing.T) {
return len(item) > 0
})

// Change working dir if EOE_TESTER_WORKING_DIR is set. This is needed for the CI pipeline,
// because the working dir is not the root of the project but we need to load the resources
// from the root of the project.
if len(os.Getenv("EOE_TESTER_WORKING_DIR")) > 0 {
err := os.Chdir(os.Getenv("EOE_TESTER_WORKING_DIR"))
if err != nil {
t.Errorf("Error while changing working dir: %s", err.Error())
return
}
}

session := game.NewSession(game.WithMods(mods))
resources := session.GetResources()

Expand Down

0 comments on commit 4720e98

Please sign in to comment.