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 5 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
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: '👀 Integration Test: (OS: "${{ inputs.os }}" Node: "${{ matrix.node }}" Browser: "${{ 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

- 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: (OS: ${{ 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: 🧪 Test

# 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

test-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"]'

test-integration-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"]'

test-integration-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: '["edge"]'

test-integration-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: 🧪 Test (PR) (Ubuntu)

# 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

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

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

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

on:
pull_request:
paths-ignore:
- "packages/remix/**"
- "packages/remix-architect/**"
- "packages/remix-cloudflare/**"
- "packages/remix-cloudflare-pages/**"
- "packages/remix-cloudflare-workers/**"
- "packages/remix-css-bundle/**"
- "packages/remix-deno/**"
- "packages/remix-eslint-config/**"
- "packages/remix-express/**"
- "packages/remix-node/**"
- "packages/remix-react/**"
- "packages/remix-serve/**"
- "packages/remix-server-runtime/**"
- "packages/remix-testing/**"
- "docs/**"
- "scripts/**"
- "contributors.yml"
- "**/*.md"
brophdawg11 marked this conversation as resolved.
Show resolved Hide resolved

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

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

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

test-integration-macos:
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: 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