mirror of
https://github.com/tgstation/tgstation-server.git
synced 2026-08-31 09:02:41 +01:00
Improve integration test working branch detection
This commit is contained in:
@@ -191,6 +191,9 @@ jobs:
|
||||
- name: Set TGS4_TEST_CONNECTION_STRING
|
||||
run: echo "::set-env name=TGS4_TEST_CONNECTION_STRING::Server=(localdb)\MSSQLLocalDB;Integrated Security=true;Initial Catalog=TGS_${{ matrix.watchdog-type }}_${{ matrix.configuration }};Application Name=tgstation-server"
|
||||
|
||||
- name: Inject slug/short variables
|
||||
uses: rlespinasse/github-slug-action@v2.x
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
@@ -325,6 +328,9 @@ jobs:
|
||||
if: ${{ matrix.watchdog-type == 'Basic' }}
|
||||
run: echo "::set-env name=General__UseBasicWatchdog::true"
|
||||
|
||||
- name: Inject slug/short variables
|
||||
uses: rlespinasse/github-slug-action@v2.x
|
||||
|
||||
- name: Checkout
|
||||
uses: actions/checkout@v1
|
||||
|
||||
|
||||
@@ -22,14 +22,31 @@ namespace Tgstation.Server.Tests.Instance
|
||||
|
||||
public async Task RunPreWatchdog(CancellationToken cancellationToken)
|
||||
{
|
||||
// Clone ourselves
|
||||
var workingBranch = Environment.GetEnvironmentVariable("TGS4_TEST_BRANCH");
|
||||
if (String.IsNullOrWhiteSpace(workingBranch))
|
||||
workingBranch = Environment.GetEnvironmentVariable("APPVEYOR_REPO_BRANCH");
|
||||
if (String.IsNullOrWhiteSpace(workingBranch))
|
||||
workingBranch = Environment.GetEnvironmentVariable("TRAVIS_BRANCH");
|
||||
if (String.IsNullOrWhiteSpace(workingBranch))
|
||||
var branchSourceEnvVars = new List<string>
|
||||
{
|
||||
"TGS4_TEST_BRANCH",
|
||||
"APPVEYOR_REPO_BRANCH",
|
||||
"TRAVIS_BRANCH",
|
||||
"GITHUB_BASE_REF_SLUG"
|
||||
};
|
||||
|
||||
string workingBranch = null;
|
||||
foreach (var envVarName in branchSourceEnvVars)
|
||||
{
|
||||
var envVar = Environment.GetEnvironmentVariable(envVarName);
|
||||
if (!String.IsNullOrWhiteSpace(envVar))
|
||||
{
|
||||
workingBranch = envVar;
|
||||
Console.WriteLine($"TEST: Set working branch to '{workingBranch}' from env var '{envVarName}'");
|
||||
break;
|
||||
}
|
||||
}
|
||||
|
||||
if (workingBranch == null)
|
||||
{
|
||||
workingBranch = "master";
|
||||
Console.WriteLine($"TEST: Set working branch to default '{workingBranch}'");
|
||||
}
|
||||
|
||||
var initalRepo = await repositoryClient.Read(cancellationToken);
|
||||
Assert.IsNotNull(initalRepo);
|
||||
|
||||
Reference in New Issue
Block a user