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

Speed up github actions for PRs #7250

Merged
merged 20 commits into from
Aug 25, 2023
Merged
Show file tree
Hide file tree
Changes from 12 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
2 changes: 1 addition & 1 deletion .github/workflows/reusable-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ jobs:
fail-fast: false
matrix:
node: ${{ fromJSON(inputs.node_version) }}
browser: ["edge"]
browser: ["msedge"]

runs-on: windows-latest
steps:
Expand Down
37 changes: 37 additions & 0 deletions .github/workflows/shared-build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: 🛠️ Build

on:
workflow_call:

env:
CI: true
CYPRESS_INSTALL_BINARY: 0

jobs:
build:
name: ⚙️ Build
runs-on: ubuntu-latest
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]

- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: ⎔ Setup node
uses: actions/setup-node@v3
with:
node-version-file: ".nvmrc"
cache: "yarn"

- name: Disable GitHub Actions Annotations
run: |
echo "::remove-matcher owner=tsc::"
echo "::remove-matcher owner=eslint-compact::"
echo "::remove-matcher owner=eslint-stylish::"

- name: 📥 Install deps
run: yarn --frozen-lockfile

- name: 🏗 Build
run: yarn build
62 changes: 62 additions & 0 deletions .github/workflows/shared-test-integration.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: 🧪 Test (Integration)

on:
workflow_call:
inputs:
os:
required: true
type: string
node_version:
required: true
# this is limited to string | boolean | number (https://github.community/t/can-action-inputs-be-arrays/16457)
# but we want to pass an array (node_version: "[18, 20]"),
# so we'll need to manually stringify it for now
type: string
browser:
required: true
# this is limited to string | boolean | number (https://github.community/t/can-action-inputs-be-arrays/16457)
# but we want to pass an array (browser: "['chromium', 'firefox']"),
# so we'll need to manually stringify it for now
type: string

env:
CI: true
CYPRESS_INSTALL_BINARY: 0

jobs:
integration:
name: '👀 Test (${{ inputs.os }}/node@${{ matrix.node }}/${{ matrix.browser }})'
strategy:
fail-fast: false
matrix:
node: ${{ fromJSON(inputs.node_version) }}
browser: ${{ fromJSON(inputs.browser) }}

runs-on: ${{ inputs.os }}
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]

- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: ⎔ Setup node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: "yarn"

- name: Disable GitHub Actions Annotations
run: |
echo "::remove-matcher owner=tsc::"
echo "::remove-matcher owner=eslint-compact::"
echo "::remove-matcher owner=eslint-stylish::"

- name: 📥 Install deps
run: yarn --frozen-lockfile

- name: 📥 Install Playwright
run: npx playwright install --with-deps ${{ matrix.browser }}

- name: 👀 Run Integration Tests ${{ matrix.browser }}
run: "yarn test:integration --project=${{ matrix.browser }}"
55 changes: 55 additions & 0 deletions .github/workflows/shared-test-unit.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: 🧪 Test (Unit)

on:
workflow_call:
inputs:
os:
required: true
type: string
node_version:
required: true
# this is limited to string | boolean | number (https://github.community/t/can-action-inputs-be-arrays/16457)
# but we want to pass an array (node_version: "[18, 20]"),
# so we'll need to manually stringify it for now
type: string

env:
CI: true
CYPRESS_INSTALL_BINARY: 0

jobs:
test:
name: '🧪 Test (${{ inputs.os }}/node@${{ matrix.node }})'
strategy:
fail-fast: false
matrix:
node: ${{ fromJSON(inputs.node_version) }}
runs-on: ${{ inputs.os }}
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]

- name: ⬇️ Checkout repo
uses: actions/checkout@v3

- name: ⎔ Setup node ${{ matrix.node }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node }}
cache: "yarn"

- name: Disable GitHub Actions Annotations
run: |
echo "::remove-matcher owner=tsc::"
echo "::remove-matcher owner=eslint-compact::"
echo "::remove-matcher owner=eslint-stylish::"

- name: 📥 Install deps
run: yarn --frozen-lockfile

# It's faster to use the built `cli.js` in tests if its available and up-to-date
- name: 🏗 Build
run: yarn build

- name: 🧪 Run Primary Tests
run: "yarn test:primary"
50 changes: 50 additions & 0 deletions .github/workflows/test-full.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Branch

# main/dev branches will get the full run across all OS/browsers

on:
push:
branches:
- main
- dev
paths-ignore:
- "docs/**"
- "scripts/**"
- "contributors.yml"
- "**/*.md"

jobs:
build:
if: github.repository == 'remix-run/remix'
uses: ./.github/workflows/shared-build.yml

unit:
if: github.repository == 'remix-run/remix'
uses: ./.github/workflows/shared-test-unit.yml
with:
os: '["ubuntu-latest", "windows-latest"]'
brophdawg11 marked this conversation as resolved.
Show resolved Hide resolved
node_version: '["latest"]'

ubuntu:
if: github.repository == 'remix-run/remix'
uses: ./.github/workflows/shared-test-integration.yml
with:
os: '["ubuntu-latest"]'
brophdawg11 marked this conversation as resolved.
Show resolved Hide resolved
node_version: '["latest"]'
browser: '["chromium", "firefox"]'

windows:
if: github.repository == 'remix-run/remix'
uses: ./.github/workflows/shared-test-integration.yml
with:
os: '["windows-latest"]'
brophdawg11 marked this conversation as resolved.
Show resolved Hide resolved
node_version: '["latest"]'
browser: '["msedge"]'

macos:
if: github.repository == 'remix-run/remix'
uses: ./.github/workflows/shared-test-integration.yml
with:
os: '["macos-latest"]'
brophdawg11 marked this conversation as resolved.
Show resolved Hide resolved
node_version: '["latest"]'
browser: '["webkit"]'
31 changes: 31 additions & 0 deletions .github/workflows/test-pr-ubuntu.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
name: PR (Base)

# All PRs touching code will run tests on ubuntu/node/chromium

on:
pull_request:
paths-ignore:
- "docs/**"
- "scripts/**"
- "contributors.yml"
- "**/*.md"

jobs:
build:
if: github.repository == 'remix-run/remix'
uses: ./.github/workflows/shared-build.yml

unit-ubuntu:
if: github.repository == 'remix-run/remix'
uses: ./.github/workflows/shared-test-unit.yml
with:
os: "ubuntu-latest"
node_version: '["latest"]'

integration-chromium:
if: github.repository == 'remix-run/remix'
uses: ./.github/workflows/shared-test-integration.yml
with:
os: "ubuntu-latest"
node_version: '["latest"]'
browser: '["chromium"]'
42 changes: 42 additions & 0 deletions .github/workflows/test-pr-windows-macos.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
name: PR (Full)

# PRs touching create-remix/remix-dev will also run on Windows and OSX

on:
pull_request:
paths:
- "packages/create-remix/**"
- "packages/remix-dev/**"
- "!**/*.md"

jobs:
unit-windows:
if: github.repository == 'remix-run/remix'
uses: ./.github/workflows/shared-test-unit.yml
with:
os: "windows-latest"
node_version: '["latest"]'

integration-firefox:
if: github.repository == 'remix-run/remix'
uses: ./.github/workflows/shared-test-integration.yml
with:
os: "ubuntu-latest"
node_version: '["latest"]'
browser: '["firefox"]'

integration-msedge:
if: github.repository == 'remix-run/remix'
uses: ./.github/workflows/shared-test-integration.yml
with:
os: "windows-latest"
node_version: '["latest"]'
browser: '["msedge"]'

integration-webkit:
if: github.repository == 'remix-run/remix'
uses: ./.github/workflows/shared-test-integration.yml
with:
os: "macos-latest"
node_version: '["latest"]'
browser: '["webkit"]'
25 changes: 0 additions & 25 deletions .github/workflows/test.yml

This file was deleted.

2 changes: 1 addition & 1 deletion integration/hmr-log-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -510,7 +510,7 @@ whatsup
// let expectedErrorCount = 0;
let expectDestructureTypeError = expectConsoleError((error) => {
let expectedMessage = new Set([
// chrome, edge
// chrome, msedge
"Cannot destructure property 'hello' of 'useLoaderData(...)' as it is null.",
// firefox
"(intermediate value)() is null",
Expand Down
2 changes: 1 addition & 1 deletion integration/hmr-test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -590,7 +590,7 @@ whatsup
// let expectedErrorCount = 0;
let expectDestructureTypeError = expectConsoleError((error) => {
let expectedMessage = new Set([
// chrome, edge
// chrome, msedge
"Cannot destructure property 'hello' of 'useLoaderData(...)' as it is null.",
// firefox
"(intermediate value)() is null",
Expand Down
2 changes: 1 addition & 1 deletion integration/playwright.config.ts
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ const config: PlaywrightTestConfig = {
use: devices["Desktop Safari"],
},
{
name: "edge",
name: "msedge",
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I changed the name of this profile to match the name of the browser (like the others) so we can use this name to only install the required browser during CI with:

npx playwright install --with-deps ${{ matrix.browser }}

That fails for edge because playwright refers to it as msedge

use: devices["Desktop Edge"],
},
{
Expand Down
2 changes: 2 additions & 0 deletions packages/create-remix/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,8 @@ import { renderLoadingIndicator } from "./loading-indicator";
import { copyTemplate, CopyTemplateError } from "./copy-template";
import { getLatestRemixVersion } from "./remix-version";

// TEST CHANGE TO TRIGGER WORKFLOWS

async function createRemix(argv: string[]) {
let ctx = await getContext(argv);
if (ctx.help) {
Expand Down
2 changes: 2 additions & 0 deletions packages/remix-react/components.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ function useDataRouterStateContext() {
return context;
}

// TEST CHANGE TO TRIGGER WORKFLOWS

////////////////////////////////////////////////////////////////////////////////
// RemixContext

Expand Down
Loading