Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/__debug-artifacts.yml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 7 additions & 1 deletion lib/analyze-action.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion lib/analyze-action.js.map

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion pr-checks/checks/debug-artifacts.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ steps:
id: analysis
- uses: actions/download-artifact@v2
with:
name: debug-artifacts
name: debug-artifacts-${{ matrix.os }}-${{ matrix.version }}
- shell: bash
run: |
LANGUAGES="cpp csharp go java javascript python"
Expand Down
8 changes: 7 additions & 1 deletion src/analyze-action.ts
Original file line number Diff line number Diff line change
Expand Up @@ -237,8 +237,14 @@ async function run() {
}

async function uploadDebugArtifacts(toUpload: string[], rootDir: string) {
let suffix = "";
const matrix = actionsUtil.getRequiredInput("matrix");
if (matrix !== undefined && matrix !== "null") {
for (const entry of Object.entries(JSON.parse(matrix)).sort())
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How does sort work if the keys are arrays? I did a little test and it seems to work. Also, we only need this functionality to ensure our tests work, so even if the sorting is not stable, if our tests pass consistently, I'm not too worried.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe the default way to compare two arrays in TypeScript is lexicographically. Since in this case the first element is the key of a JSON map, we know that all the arrays will differ in their first element (since the keys must be unique), so this is equivalent to sorting by the name of the key.

suffix += `-${entry[1]}`;
}
await artifact.create().uploadArtifact(
DEBUG_ARTIFACT_NAME,
`${DEBUG_ARTIFACT_NAME}${suffix}`,
toUpload.map((file) => path.normalize(file)),
path.normalize(rootDir)
);
Expand Down