Skip to content
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

Fix: reintroduce smoke tests across example projects #3669

Merged
merged 20 commits into from
Jul 12, 2022
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
6 changes: 6 additions & 0 deletions .changeset/famous-moons-kick.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'astro': patch
'@astrojs/markdown-remark': patch
---

Tooling: reintroduce smoke test across example projects
17 changes: 11 additions & 6 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -180,16 +180,21 @@ jobs:
needs: build
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
Copy link
Contributor

Choose a reason for hiding this comment

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

Smoke tests are mysteriously failing on windows-latest. We'll need to investigate separately

os: [ubuntu-latest]
node_version: [14]
steps:
- name: Checkout
- name: Checkout docs
uses: actions/checkout@v3
with:
submodules: 'recursive'
repository: withastro/docs

- name: Update submodules
run: git submodule update --remote
- name: Checkout astro.build
uses: actions/checkout@v3
with:
repository: withastro/astro.build

- name: Checkout
uses: actions/checkout@v3

- name: Setup PNPM
uses: pnpm/action-setup@v2.2.1
Expand All @@ -201,7 +206,7 @@ jobs:
cache: 'pnpm'

- name: Install dependencies
run: pnpm install --no-frozen-lockfile
run: pnpm install

- name: Build Packages
run: pnpm run build
Expand Down
8 changes: 0 additions & 8 deletions .gitmodules

This file was deleted.

2 changes: 1 addition & 1 deletion examples/with-mdx/src/pages/index.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ Written by: {new Intl.ListFormat('en').format(authors.map(d => d.name))}.

Published on: {new Intl.DateTimeFormat('en', {dateStyle: 'long'}).format(published)}.

<Counter client:idle>## This is a counter!</Counter>
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove client: directive. This is causing an infinite build loop that our smoke test (thankfully!) picked up

<Counter>## This is a counter!</Counter>
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"test": "turbo run test --output-logs=new-only --concurrency=1",
"test:match": "cd packages/astro && pnpm run test:match",
"test:templates": "turbo run test --filter=create-astro --concurrency=1",
"test:smoke": "node scripts/smoke/index.js",
"test:smoke": "turbo run build --filter=\"@example/*\" --output-logs=new-only",
"test:vite-ci": "turbo run test --output-logs=new-only --no-deps --scope=astro --concurrency=1",
"test:e2e": "cd packages/astro && pnpm playwright install && pnpm run test:e2e",
"test:e2e:match": "cd packages/astro && pnpm playwright install && pnpm run test:e2e:match",
Expand Down
1 change: 1 addition & 0 deletions packages/astro/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -108,6 +108,7 @@
"estree-walker": "^3.0.1",
"execa": "^6.1.0",
"fast-glob": "^3.2.11",
"github-slugger": "^1.4.0",
"gray-matter": "^4.0.3",
"html-entities": "^2.3.3",
"html-escaper": "^3.0.3",
Expand Down
7 changes: 6 additions & 1 deletion packages/astro/src/vite-plugin-markdown/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -161,12 +161,17 @@ export default function markdown({ config }: AstroPluginOptions): Plugin {
const { layout = '', components = '', setup = '', ...content } = frontmatter;
content.astro = metadata;
const prelude = `---
import { slug as $$slug } from '@astrojs/markdown-remark/ssr-utils';
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove direct import from @astrojs/markdown-remark sub-dependency. Since this isn't explicitly installed, astro build will fail from our monorepo

import Slugger from 'github-slugger';
${layout ? `import Layout from '${layout}';` : ''}
${components ? `import * from '${components}';` : ''}
${hasInjectedScript ? `import '${PAGE_SSR_SCRIPT_ID}';` : ''}
${setup}

const slugger = new Slugger();
function $$slug(value) {
return slugger.slug(value);
}

const $$content = ${JSON.stringify(content)}
---`;
const imports = `${layout ? `import Layout from '${layout}';` : ''}
Expand Down
3 changes: 1 addition & 2 deletions packages/markdown/remark/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,7 @@
"homepage": "https://astro.build",
"main": "./dist/index.js",
"exports": {
".": "./dist/index.js",
"./ssr-utils": "./dist/ssr-utils.js"
".": "./dist/index.js"
},
"scripts": {
"prepublish": "pnpm build",
Expand Down
8 changes: 0 additions & 8 deletions packages/markdown/remark/src/ssr-utils.ts

This file was deleted.

2 changes: 2 additions & 0 deletions pnpm-lock.yaml

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