Skip to content

Commit

Permalink
🧪 Test matrix jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
polRk committed Oct 23, 2024
1 parent 8432fa2 commit b17f818
Show file tree
Hide file tree
Showing 5 changed files with 39 additions and 64 deletions.
5 changes: 4 additions & 1 deletion .github/workflows/ydb-slo-action-test-init.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
test-ydb-slo-action-init:
name: Test YDB SLO Action Init
runs-on: ubuntu-latest
strategy:
matrix:
sdk: ['gorm', 'xorm']
steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -19,7 +22,7 @@ jobs:
uses: ydb-platform/ydb-slo-action/init@main
with:
github_pull_request_number: ${{ github.event.inputs.github_pull_request_number }}
sdk_name: test
sdk_name: ${{ matrix.sdk }}

- name: Run chaos testing
run: |
Expand Down
13 changes: 7 additions & 6 deletions init/post.js

Large diffs are not rendered by default.

9 changes: 5 additions & 4 deletions init/src/jobs/post.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ import { renderReport } from '../report/default'

(async function post() {
let cwd = getState("CWD")
let sdk = getInput("sdk_name", { required: true })

let end = new Date()
let start = new Date(getState("YDB_START_TIME"))
Expand All @@ -22,17 +23,17 @@ import { renderReport } from '../report/default'
debug(`Metrics: ${Object.keys(metrics)}`)

debug("Rendering report...")
let report = renderReport(getInput("sdk_name") || "Unknown", metrics)
let report = renderReport(sdk, metrics)
debug(`Report: ${report}`)

debug("Writing report...")
let reportPath = path.join(cwd, "report.md")
let reportPath = path.join(cwd, `report.md`)
fs.writeFileSync(reportPath, report, { encoding: "utf-8" })
debug(`Report written to ${reportPath}`)

{
debug("Upload report as an artifact...")
let { id } = await artifactClient.uploadArtifact("report.md", [reportPath], cwd, { retentionDays: 1 })
let { id } = await artifactClient.uploadArtifact(`${sdk}-report.md`, [reportPath], cwd, { retentionDays: 1 })
debug(`Report uploaded as an artifact ${id}`)
}

Expand All @@ -47,7 +48,7 @@ import { renderReport } from '../report/default'
debug(`Pull number written to ${pullPath}`)

debug("Upload pull number as an artifact...")
let { id } = await artifactClient.uploadArtifact("pull.txt", [pullPath], cwd, { retentionDays: 1 })
let { id } = await artifactClient.uploadArtifact(`${sdk}-pull.txt`, [pullPath], cwd, { retentionDays: 1 })
debug(`Pull number uploaded as an artifact ${id}`)
}

Expand Down
37 changes: 12 additions & 25 deletions report/main.js

Large diffs are not rendered by default.

39 changes: 11 additions & 28 deletions report/src/jobs/main.ts
Original file line number Diff line number Diff line change
@@ -1,36 +1,19 @@
import { DefaultArtifactClient } from '@actions/artifact';
import { debug, getInput } from '@actions/core'
import { debug, getInput, info } from '@actions/core'
import { context } from '@actions/github';

(async function main() {
debug(JSON.stringify(context, null, 4))
let artifact = new DefaultArtifactClient();
let artifactClient = new DefaultArtifactClient();

{
let { artifacts } = await artifactClient.listArtifacts({
findBy: {
token: getInput("token", { required: true }),
workflowRunId: parseInt(getInput("run_id", { required: true })),
repositoryOwner: context.repo.owner,
repositoryName: context.repo.repo,
}
});

let response = await artifact.getArtifact(`report.md`, {
findBy: {
token: getInput("token", { required: true }),
workflowRunId: parseInt(getInput("run_id", { required: true })),
repositoryOwner: context.repo.owner,
repositoryName: context.repo.repo,
}
});

debug(JSON.stringify(response.artifact, null, 4))
}

{

let response = await artifact.getArtifact(`pull.txt`, {
findBy: {
token: getInput("token", { required: true }),
workflowRunId: parseInt(getInput("run_id", { required: true })),
repositoryOwner: context.repo.owner,
repositoryName: context.repo.repo,
}
});

debug(JSON.stringify(response.artifact, null, 4))
}
info(`Found ${artifacts.length} artifacts: ${JSON.stringify(artifacts, null, 4)}`)
})()

0 comments on commit b17f818

Please sign in to comment.