Skip to content
Open
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
18 changes: 18 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: Set up
description: Node 22 with the npm cache, the locked dependencies (npm ci) and, on request, Playwright's Chromium.
inputs:
chromium:
description: Install Chromium for the headless-browser checks.
default: 'false'
runs:
using: composite
steps:
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
cache: npm
- run: npm ci
shell: bash
- if: ${{ inputs.chromium == 'true' }}
run: npx playwright install --with-deps chromium
shell: bash
25 changes: 13 additions & 12 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,9 +1,12 @@
name: CI

# The one list of what gates a change: pull requests and main run it, and the release workflow calls it before it
# publishes. Not here: test:checktour and test:podcast (screenshot drivers to look at), test:grader (needs a model).
on:
push:
branches: [main]
pull_request:
workflow_call:

# One run per branch or pull request; a newer push cancels the older run.
concurrency:
Expand All @@ -15,22 +18,23 @@ permissions:

jobs:
test:
name: Build, unit tests, VS Code tests
name: Build, lint, unit tests, VS Code tests
runs-on: ubuntu-latest
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
cache: npm
- run: npm ci
- uses: ./.github/actions/setup
- run: npm run build
- name: Generated files are up to date (cli/understanding.mjs)
run: git diff --exit-code
- name: Lint (ESLint, layers and import cycles)
run: npm run lint
- name: Unit tests
run: npm test
- name: Skill scripts
- name: Skill scripts, and the example journey still matches the example code
run: |
python3 skills/code-journey/scripts/journey.py help all > /dev/null
python3 skills/code-journey/scripts/journey.py check examples/shop place-order quiet
node skills/understanding-check/scripts/questions.mjs > /dev/null
- name: Tests in a real VS Code
run: npm run test:integration
Expand All @@ -49,12 +53,9 @@ jobs:
timeout-minutes: 30
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
- uses: ./.github/actions/setup
with:
node-version: 22
cache: npm
- run: npm ci
- run: npx playwright install --with-deps chromium
chromium: 'true'
- run: npm run build
- name: Panel layout and clicks
run: npm run test:panel
Expand Down
59 changes: 23 additions & 36 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: Release

# Push a tag v<version> that matches package.json to publish that version:
# npm version minor (edits package.json and CHANGELOG is yours to write) → git push --follow-tags
# The tag runs the whole CI (ci.yml) and publishes the package that CI built.
on:
push:
tags: ['v[0-9]+.[0-9]+.[0-9]+']
Expand All @@ -14,73 +15,59 @@ permissions:
contents: read

jobs:
build:
name: Test and package
version:
name: The tag is the version, and the changelog has it
runs-on: ubuntu-latest
timeout-minutes: 30
timeout-minutes: 5
outputs:
version: ${{ steps.version.outputs.version }}
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
cache: npm
- name: The tag is the version in package.json
id: version
- id: version
run: |
version=$(node -p "require('./package.json').version")
if [ "v$version" != "$GITHUB_REF_NAME" ]; then
echo "::error::tag $GITHUB_REF_NAME does not match package.json version $version"; exit 1
fi
if ! grep -q "^## $version" CHANGELOG.md; then
echo "::error::CHANGELOG.md has no section for $version"; exit 1
fi
node scripts/release-notes.mjs "$version" > /dev/null || { echo "::error::CHANGELOG.md has no section for $version"; exit 1; }
echo "version=$version" >> "$GITHUB_OUTPUT"
- run: npm ci
- run: npm run build
- run: npm test
- run: npm run test:integration
- run: npm run package -- --out "code-notes-${{ steps.version.outputs.version }}.vsix"
- name: Release notes from the changelog
run: awk -v v="${{ steps.version.outputs.version }}" '$0 ~ "^## "v {on=1; next} on && /^## / {exit} on' CHANGELOG.md > notes.md
- uses: actions/upload-artifact@cf430e030ddbb5b0abf93d22962f4752f3646cd9 # v7.0.2
with:
name: release
path: |
code-notes-*.vsix
notes.md
if-no-files-found: error

ci:
name: CI
needs: version
uses: ./.github/workflows/ci.yml

publish:
name: Publish
needs: build
needs: [version, ci]
runs-on: ubuntu-latest
timeout-minutes: 15
# The secrets live in this environment; add required reviewers to it to approve each release by hand.
environment: marketplace
permissions:
contents: write # the GitHub release
env:
VSIX: code-notes-${{ needs.version.outputs.version }}.vsix
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
- uses: actions/setup-node@949feb2413d6458794dcd2491c4babbbce0c15c1 # v7.1.0
with:
node-version: 22
cache: npm
- run: npm ci
- uses: ./.github/actions/setup
- uses: actions/download-artifact@9000827ccba6bdab643e8b6fd33ac0654aef8333 # v8.0.2
with:
name: release
name: code-notes-vsix
- name: The package CI built, named for the version, and its notes from the changelog
run: |
mv code-notes.vsix "$VSIX"
node scripts/release-notes.mjs "${{ needs.version.outputs.version }}" > notes.md
- name: Visual Studio Marketplace
env:
VSCE_PAT: ${{ secrets.VSCE_PAT }}
run: npx vsce publish --packagePath "code-notes-${{ needs.build.outputs.version }}.vsix"
run: npx vsce publish --packagePath "$VSIX"
- name: Open VSX (only when its token is set)
env:
OVSX_PAT: ${{ secrets.OVSX_PAT }}
if: ${{ env.OVSX_PAT != '' }}
run: npx --yes ovsx publish "code-notes-${{ needs.build.outputs.version }}.vsix"
run: npx --yes ovsx@1.4.0 publish "$VSIX"
- name: GitHub release
env:
GH_TOKEN: ${{ github.token }}
run: gh release create "$GITHUB_REF_NAME" "code-notes-${{ needs.build.outputs.version }}.vsix" --title "$GITHUB_REF_NAME" --notes-file notes.md --verify-tag
run: gh release create "$GITHUB_REF_NAME" "$VSIX" --title "$GITHUB_REF_NAME" --notes-file notes.md --verify-tag
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
// Press F5: a second window (the "Extension Development Host") opens on the example workspace (examples/shop),
// running Code Notes straight from this folder: nothing is installed. While it runs, the extension is rebuilt on
// every save and that window reloads itself (src/devReload.ts).
// every save and that window reloads itself (src/platform/devReload.ts).
"version": "0.2.0",
"configurations": [
{
Expand Down
2 changes: 1 addition & 1 deletion .vscode/tasks.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
{
"label": "code-notes: watch",
"type": "shell",
"command": "npm run -s vendor && npm run -s pages && npx tsc -w -p .",
"command": "npm run -s watch",
"isBackground": true,
"problemMatcher": "$tsc-watch",
"presentation": { "reveal": "never" }
Expand Down
Loading
Loading