Skip to content
25 changes: 21 additions & 4 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,22 +47,39 @@ on:
jobs:
# `permissions: {}` above grants the jobs nothing, and a called workflow may
# not request more than its caller was granted -- asking for more is rejected
# before any job runs, with no check run produced to say so. Both callees
# declare `contents: read`, so both callers have to grant it.
lint:
permissions:
contents: read
uses: reqstool/.github/.github/workflows/typescript-lint.yml@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1
uses: reqstool/.github/.github/workflows/typescript-lint.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2

build:
needs: lint
permissions:
contents: read
uses: reqstool/.github/.github/workflows/typescript-build.yml@6fc8d3e3d4c3fdf7a83cb7b7a274e4761486ca71 # 1.2.1
uses: reqstool/.github/.github/workflows/typescript-build.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2
with:
use-xvfb: true
ref: ${{ inputs.ref }}
version: ${{ inputs.version }}
artifact-name: ${{ inputs.artifact-name || 'dist' }}
dependency-version: ${{ inputs.reqstool_version || 'latest' }}
dependency-install-command: ${{ inputs.reqstool_version != '' && 'pipx install reqstool=={version}' || 'pipx install reqstool' }}

smoke:
needs: build
permissions:
contents: read
uses: reqstool/.github/.github/workflows/typescript-smoke.yml@91cd368066d5458b5d46bdf34c4d8ca483f6633f # 1.2.2
with:
command: npm test || { grep -E -B2 -A12 '<failure' test-results.xml; exit 1; }

ci:
if: ${{ always() }}
needs: [lint, build, smoke]
runs-on: ubuntu-latest
steps:
- name: Fail unless every needed job succeeded
env:
NEEDS: ${{ toJSON(needs) }}
run: |
echo "$NEEDS" | python3 -c 'import json,sys; r={k:v["result"] for k,v in json.load(sys.stdin).items()}; print(r); sys.exit(0 if all(v=="success" for v in r.values()) else 1)'
12 changes: 9 additions & 3 deletions src/extension.ts
Original file line number Diff line number Diff line change
Expand Up @@ -151,9 +151,15 @@ export async function activate(context: vscode.ExtensionContext) {
options: { env: { ...process.env, PYTHONUNBUFFERED: "1" } },
};

const outputChannel = vscode.window.createOutputChannel("reqstool");
const traceOutputChannel =
vscode.window.createOutputChannel("reqstool Trace");
const outputChannel = vscode.window.createOutputChannel("reqstool", {
log: true,
});
const traceOutputChannel = vscode.window.createOutputChannel(
"reqstool Trace",
{
log: true,
},
);

logServerInfo(outputChannel, activeVersion, activeSource, executable);

Expand Down
19 changes: 13 additions & 6 deletions src/test/extension.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,12 +10,19 @@ describe("Extension smoke tests", () => {
assert.ok(ext, "Extension reqstool.reqstool not found");
});

it("reqstool.selectServerSource command is registered", async () => {
const commands = await vscode.commands.getCommands(true);
assert.ok(
commands.includes("reqstool.selectServerSource"),
"reqstool.selectServerSource command not registered",
);
it("reqstool.selectServerSource command is registered", async function () {
this.timeout(60000);
const deadline = Date.now() + 55000;
let registered = false;
while (!registered && Date.now() < deadline) {
registered = (await vscode.commands.getCommands(true)).includes(
"reqstool.selectServerSource",
);
if (!registered) {
await new Promise((resolve) => setTimeout(resolve, 500));
}
}
assert.ok(registered, "reqstool.selectServerSource command not registered");
});
});

Expand Down
Loading