-
-
Notifications
You must be signed in to change notification settings - Fork 145
feat: github workflow that runs create-manifest on OSes #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
zhravan
wants to merge
6
commits into
mnfst:master
Choose a base branch
from
zhravan:feat/workflow-manifest-creation
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from 5 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
75ce4e6
feat: add github workflow for mnfst
zhravan 9fed0df
feat: script to verify the generated files and existence
zhravan 60bcad9
feat: add master branch to matrix
zhravan 6f07c95
feat: trigger run on every branch for test
zhravan 4d6f3d1
modify installation cmd
zhravan 3d6245e
Update .github/workflows/create-manifest.yml
zhravan File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,54 @@ | ||
| name: Create Manifest E2E | ||
|
|
||
| on: | ||
| push: | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| create-manifest: | ||
| name: Run on ${{ matrix.os }} | ||
| runs-on: ${{ matrix.os }} | ||
| timeout-minutes: 30 | ||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| os: [ubuntu-latest, macos-latest, windows-latest] | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v4 | ||
|
|
||
| - name: Setup Node.js | ||
| uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: 20 | ||
| cache: npm | ||
| cache-dependency-path: package-lock.json | ||
|
|
||
| - name: Install dependencies (workspaces) | ||
| run: npm i --workspaces | ||
|
|
||
| - name: Run create-manifest (with parameters) | ||
| env: | ||
| NODE_ENV: test | ||
| working-directory: packages/create-manifest | ||
| run: >- | ||
| node --loader ts-node/esm bin/dev.js | ||
| ci-test-${{ runner.os }} | ||
| --backendFile=https://raw.githubusercontent.com/mnfst/manifest/main/packages/create-manifest/assets/standalone/manifest.yml | ||
|
|
||
| - name: Verify generated files and parameters | ||
| run: node scripts/verify-create-manifest.mjs packages/create-manifest/ci-test-${{ runner.os }} | ||
|
|
||
| - name: Run create-manifest with windsurf flag | ||
| env: | ||
| NODE_ENV: test | ||
| working-directory: packages/create-manifest | ||
| run: >- | ||
| node --loader ts-node/esm bin/dev.js | ||
| ci-test-windsurf-${{ runner.os }} | ||
| --windsurf | ||
| --backendFile=https://raw.githubusercontent.com/mnfst/manifest/main/packages/create-manifest/assets/standalone/manifest.yml | ||
|
|
||
| - name: Verify windsurf flag functionality | ||
| run: node scripts/verify-create-manifest.mjs packages/create-manifest/ci-test-windsurf-${{ runner.os }} --expect-windsurf | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,103 @@ | ||
| #!/usr/bin/env node | ||
| import fs from 'node:fs' | ||
| import path from 'node:path' | ||
|
|
||
| function fail(msg) { | ||
| console.error(`FAIL: ${msg}`) | ||
| process.exitCode = 1 | ||
| } | ||
|
|
||
| function ok(msg) { | ||
| console.log(`OK: ${msg}`) | ||
| } | ||
|
|
||
| const args = process.argv.slice(2) | ||
| if (args.length < 1) { | ||
| console.error('Usage: node scripts/verify-create-manifest.mjs <projectName> [--expect-windsurf]') | ||
| process.exit(2) | ||
| } | ||
|
|
||
| const projectName = args[0] | ||
| const expectWindsurf = args.includes('--expect-windsurf') | ||
|
|
||
| const base = path.resolve(projectName) | ||
|
|
||
| // sanity existence checks | ||
| if (fs.existsSync(base)) { | ||
| ok(`project folder exists: ${base}`) | ||
| } else { | ||
| fail(`project folder missing: ${base}`) | ||
| } | ||
|
|
||
| const mustExist = [ | ||
| 'manifest.yml', | ||
| '.manifest', | ||
| '.vscode', | ||
| '.vscode/extensions.json', | ||
| '.vscode/settings.json', | ||
| '.gitignore', | ||
| 'package.json', | ||
| '.env', | ||
| 'README.md' | ||
| ] | ||
|
|
||
| for (const rel of mustExist) { | ||
| const p = path.join(base, rel) | ||
| if (fs.existsSync(p)) { | ||
| ok(`${rel} exists`) | ||
| } else { | ||
| fail(`${rel} missing`) | ||
| } | ||
| } | ||
|
|
||
| // Check manifest.yml has content and expected key from the provided backend file | ||
| try { | ||
| const manifest = fs.readFileSync(path.join(base, 'manifest.yml'), 'utf8') | ||
| if (manifest.trim().length > 0 && /entities:\s*$/m.test(manifest)) { | ||
| ok('manifest.yml seems valid (contains entities)') | ||
| } else { | ||
| fail('manifest.yml does not contain expected content') | ||
| } | ||
| } catch (e) { | ||
| fail(`cannot read manifest.yml: ${e}`) | ||
| } | ||
|
|
||
| // Ensure the dependency was added | ||
| try { | ||
| const pkg = JSON.parse(fs.readFileSync(path.join(base, 'package.json'), 'utf8')) | ||
| if (pkg?.dependencies?.manifest) { | ||
| ok('package.json includes manifest dependency') | ||
| } else { | ||
| fail('package.json missing manifest dependency') | ||
| } | ||
| } catch (e) { | ||
| fail(`cannot read/parse package.json: ${e}`) | ||
| } | ||
|
|
||
| // Verify .gitignore contains expected lines | ||
| try { | ||
| const gi = fs.readFileSync(path.join(base, '.gitignore'), 'utf8') | ||
| const required = ['node_modules', '.env', 'public', '.manifest'] | ||
| for (const entry of required) { | ||
| if (gi.includes(entry)) { | ||
| ok(`.gitignore contains ${entry}`) | ||
| } else { | ||
| fail(`.gitignore missing ${entry}`) | ||
| } | ||
| } | ||
| } catch (e) { | ||
| fail(`cannot read .gitignore: ${e}`) | ||
| } | ||
|
|
||
| // Optionally verify a flag effect (works with parameters) | ||
| if (expectWindsurf) { | ||
| const windsurfFile = path.join(base, '.windsurf', 'rules', 'manifest.md') | ||
| if (fs.existsSync(windsurfFile)) { | ||
| ok('windsurf rules created via flag') | ||
| } else { | ||
| fail('windsurf rules missing though flag was provided') | ||
| } | ||
| } | ||
|
|
||
| process.exit(process.exitCode ?? 0) | ||
|
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.