Skip to content

Commit

Permalink
Add category runner
Browse files Browse the repository at this point in the history
  • Loading branch information
hugoalh committed Mar 22, 2024
1 parent e1fb887 commit 87637d8
Show file tree
Hide file tree
Showing 7 changed files with 469 additions and 251 deletions.
12 changes: 10 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ This is a partial refactor of [the official toolkit][official-toolkit], not all
- `enableProcessStdOutCommand`
- `endLogGroup`
- `getGitHubAPIURL`
- `getGitHubGraphQLURL`
- `getGitHubGraphQLAPIURL`
- `getGitHubServerURL`
- `getInput`
- `getInputBigInt`
Expand All @@ -148,10 +148,17 @@ This is a partial refactor of [the official toolkit][official-toolkit], not all
- `getRunnerDebugStatus`
- `getRunnerName`
- `getRunnerOS`
- `getRunnerTempPath`
- `getRunnerToolCachePath`
- `getRunnerWorkspacePath`
- `getState`
- `getStateRaw`
- `getWorkflowName`
- `getWorkflowReferencePath`
- `getWorkflowRepository`
- `getWorkflowRepositoryID`
- `getWorkflowRepositoryOwner`
- `getWorkflowRepositoryOwnerID`
- `getWorkflowRunActionID`
- `getWorkflowRunActorID`
- `getWorkflowRunActorName`
Expand All @@ -161,6 +168,7 @@ This is a partial refactor of [the official toolkit][official-toolkit], not all
- `getWorkflowRunJobID`
- `getWorkflowRunNumber`
- `getWorkflowRunReference`
- `getWorkflowRunRetentionDays`
- `getWorkflowRunRunAttempt`
- `getWorkflowRunURL`
- `getWorkflowRunWebhookEventPayload`
Expand Down Expand Up @@ -190,8 +198,8 @@ This is a partial refactor of [the official toolkit][official-toolkit], not all
- `GitHubActionsFileCommandOptions`
- `GitHubActionsInputOptions`
- `GitHubActionsRunnerArchitecture`
- `GitHubActionsRunnerMachineTestOptions`
- `GitHubActionsRunnerOS`
- `GitHubActionsRunnerTestOptions`
- `GitHubReferenceMeta`
- `GitHubReferenceType`

Expand Down
1 change: 1 addition & 0 deletions jsr.jsonc
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
"./log": "./log.ts",
"./parameter": "./parameter.ts",
"./problem-matcher": "./problem_matcher.ts",
"./runner": "./runner.ts",
"./state": "./state.ts",
"./summary": "./summary.ts",
"./utility": "./utility.ts",
Expand Down
3 changes: 2 additions & 1 deletion mod.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ export { addPATH, GitHubActionsEnvironmentVariableExportation, GitHubActionsPATH
export { addMask, addSecret, addSecretMask, endLogGroup, enterLogGroup, exitLogGroup, GitHubActionsAnnotationType, startLogGroup, writeAnnotation, writeDebug, writeError, writeNote, writeNotice, writeWarn, writeWarning, type GitHubActionsAnnotationProperties } from "./log.ts";
export { getInput, getInputBigInt, getInputBoolean, getInputNumber, getInputRaw, getInputRegExp, GitHubActionsOutput, setOutput, setOutputs, type GitHubActionsInputOptions } from "./parameter.ts";
export { addProblemMatcher, removeProblemMatcher } from "./problem_matcher.ts";
export { getRunnerArch, getRunnerArchitecture, getRunnerDebugStatus, getRunnerName, getRunnerOS, getRunnerTempPath, getRunnerToolCachePath, getRunnerWorkspacePath, isInRunner, isRunnerDebug, validateInRunner, type GitHubActionsRunnerArchitecture, type GitHubActionsRunnerOS, type GitHubActionsRunnerTestOptions } from "./runner.ts";
export { getState, getStateRaw, GitHubActionsStateExportation, setState, setStates } from "./state.ts";
export { GitHubActionsSummary } from "./summary.ts";
export { getGitHubAPIURL, getGitHubGraphQLURL, getGitHubServerURL, getRunnerArch, getRunnerArchitecture, getRunnerDebugStatus, getRunnerName, getRunnerOS, getWorkflowName, getWorkflowReferencePath, getWorkflowRunActionID, getWorkflowRunActorID, getWorkflowRunActorName, getWorkflowRunCommitSHA, getWorkflowRunEventName, getWorkflowRunID, getWorkflowRunJobID, getWorkflowRunNumber, getWorkflowRunReference, getWorkflowRunRunAttempt, getWorkflowRunURL, getWorkflowRunWebhookEventPayload, getWorkflowSHA, isInRunner, isRunnerDebug, validateInRunner, type GitHubActionsEventName, type GitHubActionsRunnerArchitecture, type GitHubActionsRunnerMachineTestOptions, type GitHubActionsRunnerOS, type GitHubReferenceMeta, type GitHubReferenceType } from "./utility.ts";
export { getGitHubAPIURL, getGitHubGraphQLAPIURL, getGitHubServerURL, getWorkflowName, getWorkflowReferencePath, getWorkflowRunActionID, getWorkflowRunActorID, getWorkflowRunActorName, getWorkflowRunCommitSHA, getWorkflowRunEventName, getWorkflowRunID, getWorkflowRunJobID, getWorkflowRunNumber, getWorkflowRunReference, getWorkflowRunRunAttempt, getWorkflowRunURL, getWorkflowRunWebhookEventPayload, getWorkflowSHA, type GitHubActionsEventName, type GitHubReferenceMeta, type GitHubReferenceType } from "./utility.ts";
73 changes: 73 additions & 0 deletions runner.test.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
import { assert } from "TEST/assert.ts";
import { getRunnerArchitecture, getRunnerDebugStatus, getRunnerName, getRunnerOS, getRunnerTempPath, getRunnerToolCachePath, getRunnerWorkspacePath, validateInRunner } from "./runner.ts";
const isInGitHubActionsRunner = Deno.env.get("GITHUB_ACTIONS") === "true";
Deno.test("Architecture", {
ignore: !isInGitHubActionsRunner,
permissions: {
env: ["RUNNER_ARCH"]
}
}, () => {
console.log(getRunnerArchitecture());
});
Deno.test("Debug Status", {
ignore: !isInGitHubActionsRunner,
permissions: {
env: ["RUNNER_DEBUG"]
}
}, () => {
console.log(getRunnerDebugStatus());
});
Deno.test("Name", {
ignore: !isInGitHubActionsRunner,
permissions: {
env: ["RUNNER_NAME"]
}
}, () => {
console.log(getRunnerName());
});
Deno.test("OS", {
ignore: !isInGitHubActionsRunner,
permissions: {
env: ["RUNNER_OS"]
}
}, () => {
const current = Deno.build.os;
const result = getRunnerOS();
assert(
(current === "darwin" && result === "macOS") ||
(current === "linux" && result === "Linux") ||
(current === "windows" && result === "Windows")
);
});
Deno.test("TEMP Path", {
ignore: !isInGitHubActionsRunner,
permissions: {
env: ["RUNNER_TEMP"]
}
}, () => {
console.log(getRunnerTempPath());
});
Deno.test("Tool Cache Path", {
ignore: !isInGitHubActionsRunner,
permissions: {
env: ["RUNNER_TOOL_CACHE"]
}
}, () => {
console.log(getRunnerToolCachePath());
});
Deno.test("Workspace Path", {
ignore: !isInGitHubActionsRunner,
permissions: {
env: ["GITHUB_WORKSPACE"]
}
}, () => {
console.log(getRunnerWorkspacePath());
});
Deno.test("Validate In Runner", {
ignore: !isInGitHubActionsRunner,
permissions: {
env: true
}
}, () => {
console.log(validateInRunner());
});
Loading

0 comments on commit 87637d8

Please sign in to comment.