Skip to content
This repository has been archived by the owner on Aug 31, 2023. It is now read-only.

Commit

Permalink
chore(ci): add conditions to workflow runs (#2459)
Browse files Browse the repository at this point in the history
Some PRs make changes to only specific parts of the repo and do not require all checks to run on unmodified parts.
This PR adds conditions to workflow runs to save time and resources.

Example: #2457 only modified `.md` files but the ci still reformatted all files and tried to deploy playground (and failed without reasons).

Reference used for this PR: https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-including-paths.

Also renamed jobs with clearer titles to avoid confusion (cherry pick if not wanted).
  • Loading branch information
jer3m01 authored Apr 20, 2022
1 parent cfedad8 commit 1efa003
Show file tree
Hide file tree
Showing 6 changed files with 55 additions and 31 deletions.
9 changes: 5 additions & 4 deletions .github/workflows/deploy_playground.yml
Original file line number Diff line number Diff line change
@@ -1,17 +1,18 @@
# This is a basic workflow to help you get started with Actions

name: Deploy Playground
name: Deploy Playground (Preview)

on:
pull_request:
branches:
- main
paths: # Only deploy when changes are made to the crates or playground code
- 'crates/**'
- 'website/playground/**'

jobs:
deploy:
runs-on: ubuntu-latest
environment: aws
name: Deploy
name: Deploy Playground (Preview)
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v3
Expand Down
9 changes: 5 additions & 4 deletions .github/workflows/deploy_playground_on_main.yml
Original file line number Diff line number Diff line change
@@ -1,18 +1,19 @@
# This is a basic workflow to help you get started with Actions

name: Deploy Playground on Main
name: Deploy Playground

on:
workflow_dispatch:
push:
branches:
- main
paths: # Only deploy when changes are made to the crates or playground code
- 'crates/**'
- 'website/playground/**'

jobs:
deploy:
runs-on: ubuntu-latest
environment: aws
name: Deploy
name: Deploy Playground
steps:
- uses: actions/checkout@master
- uses: actions/setup-node@v3
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ env:

jobs:
format:
name: format
name: Format Rust Files
runs-on: ubuntu-latest
steps:
- name: Checkout PR Branch
Expand All @@ -37,7 +37,7 @@ jobs:
args: --all --verbose -- --check

lint:
name: lint
name: Lint Rust Files
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand Down Expand Up @@ -65,7 +65,7 @@ jobs:
- os: ubuntu-20.04
- os: macos-11

name: test
name: Test
runs-on: ${{ matrix.os }}
steps:
- name: Checkout repository
Expand All @@ -90,7 +90,7 @@ jobs:
run: cargo install cargo-cache --no-default-features --features ci-autoclean && cargo-cache

coverage:
name: Test262 coverage
name: Test262 Coverage
runs-on: ${{ matrix.os }}

strategy:
Expand Down
28 changes: 10 additions & 18 deletions .github/workflows/pull_request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,14 +5,21 @@ on:
pull_request:
branches:
- main
paths: # Only run when changes are made to rust code or root Cargo
- 'crates/**'
- 'xtask/**'
- 'Cargo.toml'
- 'Cargo.lock'
- 'rust-toolchain.toml'
- 'rustfmt.toml'

env:
RUST_LOG: info
RUST_BACKTRACE: 1

jobs:
format:
name: format
name: Format Rust Files
runs-on: ubuntu-latest
steps:
- name: Checkout repository
Expand All @@ -26,24 +33,9 @@ jobs:
with:
command: fmt
args: --all --verbose -- --check
format-js:
name: Format JS Files
runs-on: ubuntu-latest
steps:
- name: Install Rome
uses: rome/[email protected]
with:
version: preview

- name: Checkout repository
uses: actions/checkout@v3

- name: Run Rome Format
run: rome format --ci editors website


lint:
name: lint
name: Lint Rust Files
runs-on: ubuntu-latest
steps:
- name: Checkout PR Branch
Expand All @@ -66,7 +58,7 @@ jobs:
args: --workspace --all-targets --verbose -- --deny warnings

test:
name: test
name: Test
runs-on: ubuntu-latest

steps:
Expand Down
30 changes: 30 additions & 0 deletions .github/workflows/pull_request_js.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@

# Jobs run on pull request in js folders
name: Pull request JS
on:
pull_request:
branches:
- main
paths: # Only run when changes are made to js code
- 'website/**'
- 'editors/**'

env:
RUST_LOG: info
RUST_BACKTRACE: 1

jobs:
format-js:
name: Format JS Files
runs-on: ubuntu-latest
steps:
- name: Install Rome
uses: rome/[email protected]
with:
version: preview

- name: Checkout repository
uses: actions/checkout@v2

- name: Run Rome Format
run: rome format --ci editors website
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ The following commit prefixes are supported:
- `feat:`, a new feature
- `fix:`, a bugfix
- `docs:`, a documentation update
- `test`, a test update
- `test:`, a test update
- `chore:`, project housekeeping
- `perf:`, project performance
- `refactor:`, refactor of the code without change in functionality
Expand Down

0 comments on commit 1efa003

Please sign in to comment.