Skip to content

Commit

Permalink
Update workflows and test runners to use .net 8 (#14702)
Browse files Browse the repository at this point in the history
  • Loading branch information
MikeAlhayek authored Nov 15, 2023
1 parent b156376 commit 24e379b
Show file tree
Hide file tree
Showing 7 changed files with 159 additions and 159 deletions.
10 changes: 5 additions & 5 deletions .github/workflows/functional_all_db.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100-rc.2.23502.2'
dotnet-version: '8.0.x'
- uses: actions/setup-node@v3
with:
node-version: "15"
Expand All @@ -43,7 +43,7 @@ jobs:
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100-rc.2.23502.2'
dotnet-version: '8.0.x'
- name: Functional Tests
run: |
cd test/OrchardCore.Tests.Functional
Expand Down Expand Up @@ -84,7 +84,7 @@ jobs:
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100-rc.2.23502.2'
dotnet-version: '8.0.x'
- name: Functional Tests
run: |
cd test/OrchardCore.Tests.Functional
Expand Down Expand Up @@ -121,7 +121,7 @@ jobs:
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100-rc.2.23502.2'
dotnet-version: '8.0.x'
- name: Functional Tests
run: |
cd test/OrchardCore.Tests.Functional
Expand Down Expand Up @@ -157,7 +157,7 @@ jobs:
# We need to install dotnet in the docker container.
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100-rc.2.23502.2'
dotnet-version: '8.0.x'
- name: Functional Tests
run: |
cd test/OrchardCore.Tests.Functional
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/pr_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ jobs:
node-version: "15"
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100-rc.2.23502.2'
dotnet-version: '8.0.x'
- name: Build
run: |
dotnet build -c Release -f net8.0
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/preview_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ jobs:
node-version: "15"
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100-rc.2.23502.2'
dotnet-version: '8.0.x'
- name: Set build number
if: matrix.os == 'ubuntu-latest'
run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 16368 ))" >> $GITHUB_ENV
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ jobs:
node-version: "15"
- uses: actions/setup-dotnet@v3
with:
dotnet-version: '8.0.100-rc.2.23502.2'
dotnet-version: '8.0.x'
- name: Set build number
if: matrix.os == 'ubuntu-latest'
run: echo "BuildNumber=$(( $GITHUB_RUN_NUMBER + 15471 ))" >> $GITHUB_ENV
Expand Down
110 changes: 55 additions & 55 deletions test/OrchardCore.Tests.Functional/cypress-commands/dist/test-runner.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,21 +7,21 @@ const child_process = require("child_process");
const fs = require("fs-extra");
const path = require("path");

global.log = function(msg) {
let now = new Date().toLocaleTimeString();
console.log(`[${now}] ${msg}\n`);
global.log = function (msg) {
let now = new Date().toLocaleTimeString();
console.log(`[${now}] ${msg}\n`);
};

// Build the dotnet application in release mode
function build(dir, dotnetVersion) {
global.log("Building ...");
child_process.spawnSync("dotnet", ["build", "-c", "Release", "-f", dotnetVersion], { cwd: dir });
global.log("Building ...");
child_process.spawnSync("dotnet", ["build", "-c", "Release", "-f", dotnetVersion], { cwd: dir });
}

// destructive action that deletes the App_Data folder
function deleteDirectory(dir) {
fs.removeSync(dir);
global.log(`${dir} deleted`);
fs.removeSync(dir);
global.log(`${dir} deleted`);
}

// Copy the migrations recipe.
Expand All @@ -42,57 +42,57 @@ function copyMigrationsRecipeFile(dir) {
}

// Host the dotnet application, does not rebuild
function host(dir, assembly, { appDataLocation='./App_Data', dotnetVersion='net7.0' }={}) {
if (fs.existsSync(path.join(dir, `bin/Release/${dotnetVersion}/`, assembly))) {
global.log("Application already built, skipping build");
} else {
build(dir, dotnetVersion);
}
global.log("Starting application ...");

const ocEnv = {};
ocEnv["ORCHARD_APP_DATA"] = appDataLocation;

let server = child_process.spawn(
"dotnet",
[`bin/Release/${dotnetVersion}/` + assembly],
{ cwd: dir, env: {...process.env, ...ocEnv} }
);

server.stdout.on("data", data => {
global.log(data);
});

server.stderr.on("data", data => {
global.log(`stderr: ${data}`);
});

server.on("close", code => {
global.log(`Server process exited with code ${code}`);
});
return server;
function host(dir, assembly, { appDataLocation = './App_Data', dotnetVersion = 'net8.0' } = {}) {
if (fs.existsSync(path.join(dir, `bin/Release/${dotnetVersion}/`, assembly))) {
global.log("Application already built, skipping build");
} else {
build(dir, dotnetVersion);
}
global.log("Starting application ...");

const ocEnv = {};
ocEnv["ORCHARD_APP_DATA"] = appDataLocation;

let server = child_process.spawn(
"dotnet",
[`bin/Release/${dotnetVersion}/` + assembly],
{ cwd: dir, env: { ...process.env, ...ocEnv } }
);

server.stdout.on("data", data => {
global.log(data);
});

server.stderr.on("data", data => {
global.log(`stderr: ${data}`);
});

server.on("close", code => {
global.log(`Server process exited with code ${code}`);
});
return server;
}

// combines the functions above, useful when triggering tests from CI
function e2e(dir, assembly, { dotnetVersion='net7.0' }={}) {
copyMigrationsRecipeFile(dir);
deleteDirectory(path.join(dir, "App_Data_Tests"));
var server = host(dir, assembly, { appDataLocation: "./App_Data_Tests", dotnetVersion });

let test = child_process.exec("npx cypress run");
test.stdout.on("data", data => {
console.log(data);
});

test.stderr.on("data", data => {
console.log(`stderr: ${data}`);
});

test.on("close", code => {
console.log(`Cypress process exited with code ${code}`);
server.kill("SIGINT");
process.exit(code);
});
function e2e(dir, assembly, { dotnetVersion = 'net8.0' } = {}) {
copyMigrationsRecipeFile(dir);
deleteDirectory(path.join(dir, "App_Data_Tests"));
var server = host(dir, assembly, { appDataLocation: "./App_Data_Tests", dotnetVersion });

let test = child_process.exec("npx cypress run");
test.stdout.on("data", data => {
console.log(data);
});

test.stderr.on("data", data => {
console.log(`stderr: ${data}`);
});

test.on("close", code => {
console.log(`Cypress process exited with code ${code}`);
server.kill("SIGINT");
process.exit(code);
});
}

exports.build = build;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,74 +3,74 @@ const child_process = require("child_process");
const fs = require("fs-extra");
const path = require("path");

global.log = function(msg) {
let now = new Date().toLocaleTimeString();
console.log(`[${now}] ${msg}\n`);
global.log = function (msg) {
let now = new Date().toLocaleTimeString();
console.log(`[${now}] ${msg}\n`);
};

// Build the dotnet application in release mode
function build(dir) {
global.log("Building ...");
child_process.spawnSync("dotnet", ["build", "-c", "Release"], { cwd: dir });
global.log("Building ...");
child_process.spawnSync("dotnet", ["build", "-c", "Release"], { cwd: dir });
}

// destructive action that deletes the App_Data folder
function deleteDirectory(dir) {
fs.removeSync(dir);
global.log(`${dir} deleted`);
fs.removeSync(dir);
global.log(`${dir} deleted`);
}

// Host the dotnet application, does not rebuild
function host(dir, assembly, { appDataLocation='./App_Data', dotnetVersion='net7.0' }={}) {
if (fs.existsSync(path.join(dir, `bin/Release/${dotnetVersion}/`, assembly))) {
global.log("Application already built, skipping build");
} else {
build(dir);
}
global.log("Starting application ...");

const ocEnv = {};
ocEnv["ORCHARD_APP_DATA"] = appDataLocation;

let server = child_process.spawn(
"dotnet",
[`bin/Release/${dotnetVersion}/` + assembly],
{ cwd: dir, env: {...process.env, ...ocEnv} }
);
function host(dir, assembly, { appDataLocation = './App_Data', dotnetVersion = 'net8.0' } = {}) {
if (fs.existsSync(path.join(dir, `bin/Release/${dotnetVersion}/`, assembly))) {
global.log("Application already built, skipping build");
} else {
build(dir);
}
global.log("Starting application ...");

server.stdout.on("data", data => {
global.log(data);
});
const ocEnv = {};
ocEnv["ORCHARD_APP_DATA"] = appDataLocation;

server.stderr.on("data", data => {
global.log(`stderr: ${data}`);
});
let server = child_process.spawn(
"dotnet",
[`bin/Release/${dotnetVersion}/` + assembly],
{ cwd: dir, env: { ...process.env, ...ocEnv } }
);

server.on("close", code => {
global.log(`Server process exited with code ${code}`);
});
return server;
server.stdout.on("data", data => {
global.log(data);
});

server.stderr.on("data", data => {
global.log(`stderr: ${data}`);
});

server.on("close", code => {
global.log(`Server process exited with code ${code}`);
});
return server;
}

// combines the functions above, useful when triggering tests from CI
function e2e(dir, assembly, { dotnetVersion='net7.0' }={}) {
deleteDirectory(path.join(dir, "App_Data_Tests"));
var server = host(dir, assembly, { appDataLocation: "./App_Data_Tests", dotnetVersion });
function e2e(dir, assembly, { dotnetVersion = 'net8.0' } = {}) {
deleteDirectory(path.join(dir, "App_Data_Tests"));
var server = host(dir, assembly, { appDataLocation: "./App_Data_Tests", dotnetVersion });

let test = child_process.exec("npx cypress run");
test.stdout.on("data", data => {
console.log(data);
});
let test = child_process.exec("npx cypress run");
test.stdout.on("data", data => {
console.log(data);
});

test.stderr.on("data", data => {
console.log(`stderr: ${data}`);
});
test.stderr.on("data", data => {
console.log(`stderr: ${data}`);
});

test.on("close", code => {
console.log(`Cypress process exited with code ${code}`);
server.kill("SIGINT");
process.exit(code);
});
test.on("close", code => {
console.log(`Cypress process exited with code ${code}`);
server.kill("SIGINT");
process.exit(code);
});
}

export { build, deleteDirectory, e2e, host };
Loading

0 comments on commit 24e379b

Please sign in to comment.