Cleanup CI logs and run windows on node16 only (#6838)

This commit is contained in:
Bjorn Lu 2023-04-19 10:59:09 +02:00 committed by GitHub
parent 43230b2cac
commit 7544d9bd41
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
21 changed files with 62 additions and 104 deletions

View file

@ -24,6 +24,9 @@ env:
TURBO_TEAM: ${{ secrets.TURBO_TEAM }} TURBO_TEAM: ${{ secrets.TURBO_TEAM }}
FORCE_COLOR: true FORCE_COLOR: true
ASTRO_TELEMETRY_DISABLED: true ASTRO_TELEMETRY_DISABLED: true
# 7 GiB by default on GitHub, setting to 6 GiB
# https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#supported-runners-and-hardware-resources
NODE_OPTIONS: --max-old-space-size=6144
jobs: jobs:
lint: lint:
@ -112,11 +115,13 @@ jobs:
needs: build needs: build
strategy: strategy:
matrix: matrix:
OS: [ubuntu-latest, windows-latest] OS: [ubuntu-latest]
NODE_VERSION: [16, 18] NODE_VERSION: [16, 18]
include: include:
- os: macos-latest - os: macos-latest
NODE_VERSION: 16 NODE_VERSION: 16
- os: windows-latest
NODE_VERSION: 16
fail-fast: false fail-fast: false
env: env:
NODE_VERSION: ${{ matrix.NODE_VERSION }} NODE_VERSION: ${{ matrix.NODE_VERSION }}
@ -221,4 +226,3 @@ jobs:
run: pnpm run test:smoke run: pnpm run test:smoke
env: env:
SKIP_OG: 1 SKIP_OG: 1
NODE_OPTIONS: "--max-old-space-size=4096"

View file

@ -40,6 +40,7 @@ ${chosenMethod} requests are not available when building a static site. Update y
return response; return response;
} }
// TODO: Remove support for old API in Astro 3.0
if (handler.length > 1) { if (handler.length > 1) {
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.warn(` console.warn(`
@ -57,6 +58,7 @@ Update your code to remove this warning.`);
if (prop in target) { if (prop in target) {
return Reflect.get(target, prop); return Reflect.get(target, prop);
} else if (prop in params) { } else if (prop in params) {
// TODO: Remove support for old API in Astro 3.0
// eslint-disable-next-line no-console // eslint-disable-next-line no-console
console.warn(` console.warn(`
API routes no longer pass params as the first argument. Instead an object containing a params property is provided in the form of: API routes no longer pass params as the first argument. Instead an object containing a params property is provided in the form of:

View file

@ -10,38 +10,6 @@ describe('API routes', () => {
await fixture.build(); await fixture.build();
}); });
describe('Deprecated API', () => {
it('two argument supported', async () => {
const one = JSON.parse(await fixture.readFile('/old-api/twoarg/one.json'));
expect(one).to.deep.equal({
param: 'one',
pathname: '/old-api/twoarg/one.json',
});
const two = JSON.parse(await fixture.readFile('/old-api/twoarg/two.json'));
expect(two).to.deep.equal({
param: 'two',
pathname: '/old-api/twoarg/two.json',
});
});
it('param first argument is supported', async () => {
const one = JSON.parse(await fixture.readFile('/old-api/onearg/one.json'));
expect(one).to.deep.equal({
param: 'one',
});
});
});
describe('1.0 API', () => {
it('Receives a context argument', async () => {
const one = JSON.parse(await fixture.readFile('/context/data/one.json'));
expect(one).to.deep.equal({
param: 'one',
pathname: '/context/data/one.json',
});
});
});
describe('Binary data', () => { describe('Binary data', () => {
it('can be returned from a response', async () => { it('can be returned from a response', async () => {
const dat = await fixture.readFile('/binary.dat', null); const dat = await fixture.readFile('/binary.dat', null);

View file

@ -53,7 +53,6 @@ describe('Environment Variables', () => {
it('includes public env in client-side JS', async () => { it('includes public env in client-side JS', async () => {
let dirs = await fixture.readdir('/_astro'); let dirs = await fixture.readdir('/_astro');
console.log(dirs);
let found = false; let found = false;
// Look in all of the .js files to see if the public env is inlined. // Look in all of the .js files to see if the public env is inlined.

View file

@ -1,5 +1,5 @@
import { expect } from 'chai'; import { expect } from 'chai';
import { loadFixture } from './test-utils.js'; import { loadFixture, silentLogging } from './test-utils.js';
describe('Development Routing', () => { describe('Development Routing', () => {
describe('No site config', () => { describe('No site config', () => {
@ -10,7 +10,9 @@ describe('Development Routing', () => {
before(async () => { before(async () => {
fixture = await loadFixture({ root: './fixtures/without-site-config/' }); fixture = await loadFixture({ root: './fixtures/without-site-config/' });
devServer = await fixture.startDevServer(); devServer = await fixture.startDevServer({
logging: silentLogging,
});
}); });
after(async () => { after(async () => {

View file

@ -1,6 +1,6 @@
import { expect } from 'chai'; import { expect } from 'chai';
import { load as cheerioLoad } from 'cheerio'; import { load as cheerioLoad } from 'cheerio';
import { loadFixture } from './test-utils.js'; import { loadFixture, silentLogging } from './test-utils.js';
describe('Dynamic endpoint collision', () => { describe('Dynamic endpoint collision', () => {
describe('build', () => { describe('build', () => {
@ -31,7 +31,9 @@ describe('Dynamic endpoint collision', () => {
root: './fixtures/dynamic-endpoint-collision/', root: './fixtures/dynamic-endpoint-collision/',
}); });
devServer = await fixture.startDevServer(); devServer = await fixture.startDevServer({
logging: silentLogging,
});
}); });
after(async () => { after(async () => {

View file

@ -1,6 +1,6 @@
import { expect } from 'chai'; import { expect } from 'chai';
import * as cheerio from 'cheerio'; import * as cheerio from 'cheerio';
import { loadFixture } from './test-utils.js'; import { loadFixture, silentLogging } from './test-utils.js';
describe('Errors in JavaScript', () => { describe('Errors in JavaScript', () => {
/** @type {import('./test-utils').Fixture} */ /** @type {import('./test-utils').Fixture} */
@ -12,8 +12,13 @@ describe('Errors in JavaScript', () => {
before(async () => { before(async () => {
fixture = await loadFixture({ fixture = await loadFixture({
root: './fixtures/error-bad-js', root: './fixtures/error-bad-js',
vite: {
logLevel: 'silent',
},
});
devServer = await fixture.startDevServer({
logging: silentLogging,
}); });
devServer = await fixture.startDevServer();
}); });
after(async () => { after(async () => {

View file

@ -1,5 +1,5 @@
import { expect } from 'chai'; import { expect } from 'chai';
import { loadFixture } from './test-utils.js'; import { loadFixture, silentLogging } from './test-utils.js';
describe('Can handle errors that are not instanceof Error', () => { describe('Can handle errors that are not instanceof Error', () => {
/** @type {import('./test-utils').Fixture} */ /** @type {import('./test-utils').Fixture} */
@ -12,7 +12,9 @@ describe('Can handle errors that are not instanceof Error', () => {
fixture = await loadFixture({ fixture = await loadFixture({
root: './fixtures/error-non-error', root: './fixtures/error-non-error',
}); });
devServer = await fixture.startDevServer(); devServer = await fixture.startDevServer({
logging: silentLogging
});
}); });
after(async () => { after(async () => {

View file

@ -1,23 +0,0 @@
export function getStaticPaths() {
return [
{
params: {
param: 'one'
}
},
{
params: {
param: 'two'
}
},
]
}
export function get(params) {
return {
body: JSON.stringify({
param: params.param
})
};
}

View file

@ -1,24 +0,0 @@
export function getStaticPaths() {
return [
{
params: {
param: 'one'
}
},
{
params: {
param: 'two'
}
},
]
}
export function get(params, request) {
return {
body: JSON.stringify({
param: params.param,
pathname: new URL(request.url).pathname
})
};
}

View file

@ -8,7 +8,9 @@
"@astrojs/svelte": "workspace:*", "@astrojs/svelte": "workspace:*",
"@test/component-library-shared": "workspace:*", "@test/component-library-shared": "workspace:*",
"astro": "workspace:*", "astro": "workspace:*",
"preact": "^10.13.2",
"react": "^18.1.0", "react": "^18.1.0",
"react-dom": "^18.1.0" "react-dom": "^18.1.0",
"svelte": "^3.58.0"
} }
} }

View file

@ -28,7 +28,4 @@
margin-top: 2em; margin-top: 2em;
place-items: center; place-items: center;
} }
.message {
text-align: center;
}
</style> </style>

View file

@ -9,7 +9,7 @@ export function get() {
}; };
} }
export async function post(params, request) { export async function post({ params, request }) {
const body = await request.text(); const body = await request.text();
return new Response(body === `some data` ? `ok` : `not ok`, { return new Response(body === `some data` ? `ok` : `not ok`, {
status: 200, status: 200,

View file

@ -5,7 +5,7 @@ export async function getStaticPaths() {
] ]
} }
export async function get(params) { export async function get({ params }) {
return { return {
body: JSON.stringify({ body: JSON.stringify({
slug: params.slug, slug: params.slug,

View file

@ -5,7 +5,7 @@ export async function getStaticPaths() {
]; ];
} }
export async function get(params) { export async function get({ params }) {
return { return {
body: JSON.stringify({ body: JSON.stringify({
slug: params.slug, slug: params.slug,

View file

@ -5,7 +5,7 @@ export async function getStaticPaths() {
]; ];
} }
export async function get(params) { export async function get({ params }) {
return { return {
body: JSON.stringify({ body: JSON.stringify({
slug: params.slug, slug: params.slug,

View file

@ -1,6 +1,6 @@
import { expect } from 'chai'; import { expect } from 'chai';
import { load as cheerioLoad } from 'cheerio'; import { load as cheerioLoad } from 'cheerio';
import { isWindows, loadFixture } from './test-utils.js'; import { isWindows, loadFixture, silentLogging } from './test-utils.js';
let fixture; let fixture;
@ -103,7 +103,9 @@ describe('React Components', () => {
let devServer; let devServer;
before(async () => { before(async () => {
devServer = await fixture.startDevServer(); devServer = await fixture.startDevServer({
logging: silentLogging,
});
}); });
after(async () => { after(async () => {

View file

@ -18,7 +18,6 @@ describe('srcDir', () => {
const relPath = $('link').attr('href'); const relPath = $('link').attr('href');
const css = await fixture.readFile(relPath); const css = await fixture.readFile(relPath);
console.log(css);
expect(css).to.match(/body{color:green}/); expect(css).to.match(/body{color:green}/);
}); });
}); });

View file

@ -68,6 +68,12 @@ export const defaultLogging = {
level: 'error', level: 'error',
}; };
/** @type {import('../src/core/logger/core').LogOptions} */
export const silentLogging = {
dest: nodeLogDestination,
level: 'silent',
};
/** /**
* Load Astro fixture * Load Astro fixture
* @param {AstroConfig} inlineConfig Astro config partial (note: must specify `root`) * @param {AstroConfig} inlineConfig Astro config partial (note: must specify `root`)

View file

@ -13,13 +13,13 @@ describe('Fetch', () => {
it('Fetch with https', async () => { it('Fetch with https', async () => {
const { fetch } = target const { fetch } = target
const response = await fetch('https://api.openbrewerydb.org/breweries') const response = await fetch('https://astro.build')
expect(response.constructor).to.equal(target.Response) expect(response.constructor).to.equal(target.Response)
const json = await response.json() const html = await response.text()
expect(json).to.be.an('array') expect(html).to.include('<html')
}) })
it('Fetch with data', async () => { it('Fetch with data', async () => {

15
pnpm-lock.yaml generated
View file

@ -2242,12 +2242,18 @@ importers:
astro: astro:
specifier: workspace:* specifier: workspace:*
version: link:../../.. version: link:../../..
preact:
specifier: ^10.13.2
version: 10.13.2
react: react:
specifier: ^18.1.0 specifier: ^18.1.0
version: 18.2.0 version: 18.2.0
react-dom: react-dom:
specifier: ^18.1.0 specifier: ^18.1.0
version: 18.2.0(react@18.2.0) version: 18.2.0(react@18.2.0)
svelte:
specifier: ^3.58.0
version: 3.58.0
packages/astro/test/fixtures/component-library-shared: packages/astro/test/fixtures/component-library-shared:
dependencies: dependencies:
@ -15102,6 +15108,10 @@ packages:
/preact@10.11.0: /preact@10.11.0:
resolution: {integrity: sha512-Fk6+vB2kb6mSJfDgODq0YDhMfl0HNtK5+Uc9QqECO4nlyPAQwCI+BKyWO//idA7ikV7o+0Fm6LQmNuQi1wXI1w==} resolution: {integrity: sha512-Fk6+vB2kb6mSJfDgODq0YDhMfl0HNtK5+Uc9QqECO4nlyPAQwCI+BKyWO//idA7ikV7o+0Fm6LQmNuQi1wXI1w==}
/preact@10.13.2:
resolution: {integrity: sha512-q44QFLhOhty2Bd0Y46fnYW0gD/cbVM9dUVtNTDKPcdXSMA7jfY+Jpd6rk3GB0lcQss0z5s/6CmVP0Z/hV+g6pw==}
dev: false
/prebuild-install@7.1.1: /prebuild-install@7.1.1:
resolution: {integrity: sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==} resolution: {integrity: sha512-jAXscXWMcCK8GgCoHOfIr0ODh5ai8mj63L2nWrjuAgXE6tDyYGnx4/8o/rCgU+B4JSyZBKbeZqzhtwtC3ovxjw==}
engines: {node: '>=10'} engines: {node: '>=10'}
@ -16430,6 +16440,11 @@ packages:
resolution: {integrity: sha512-tdrgeJU0hob0ZWAMoKXkhcxXA7dpTg6lZGxUeko5YqvPdJBiyRspGsCwV27kIrbrqPP2WUoSV9ca0gnLlw8YzQ==} resolution: {integrity: sha512-tdrgeJU0hob0ZWAMoKXkhcxXA7dpTg6lZGxUeko5YqvPdJBiyRspGsCwV27kIrbrqPP2WUoSV9ca0gnLlw8YzQ==}
engines: {node: '>= 8'} engines: {node: '>= 8'}
/svelte@3.58.0:
resolution: {integrity: sha512-brIBNNB76mXFmU/Kerm4wFnkskBbluBDCjx/8TcpYRb298Yh2dztS2kQ6bhtjMcvUhd5ynClfwpz5h2gnzdQ1A==}
engines: {node: '>= 8'}
dev: false
/svg-tags@1.0.0: /svg-tags@1.0.0:
resolution: {integrity: sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==} resolution: {integrity: sha512-ovssysQTa+luh7A5Weu3Rta6FJlFBBbInjOh722LIt6klpU2/HtdUbszju/G4devcvk8PGt7FCLv5wftu3THUA==}
dev: false dev: false