Skip to content

Commit

Permalink
build: extract install workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
shanedg committed Apr 9, 2024
1 parent c8c0f1c commit 3c09710
Show file tree
Hide file tree
Showing 2 changed files with 84 additions and 39 deletions.
83 changes: 44 additions & 39 deletions .github/workflows/branch.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,45 @@ on:
# https://docs.github.com/en/actions/using-workflows/reusing-workflows#calling-a-reusable-workflow

jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Restore Cache
id: restore-cache
uses: actions/cache/restore@v4
with:
path: |
~/.cache/Cypress
common/temp
*/.rush/temp
*/node_modules
key: ${{ runner.os }}-${{ hashFiles('common/config/rush/repo-state.json') }}
# Only need a cache hit or miss,
# cached dependencies aren't used until following jobs
lookup-only: true

- name: Install
if: steps.restore-cache.outputs.cache-hit != 'true'
run: node common/scripts/install-run-rush.js install

- name: Save Cache
id: save-cache
uses: actions/cache/save@v4
if: steps.restore-cache.outputs.cache-hit != 'true'
with:
path: |
~/.cache/Cypress
common/temp
*/.rush/temp
*/node_modules
key: ${{ steps.restore-cache.outputs.cache-primary-key }}
# install:
# runs-on: ubuntu-latest
# steps:
# - uses: actions/checkout@v4

# - name: Restore Cache
# id: restore-cache
# uses: actions/cache/restore@v4
# with:
# path: |
# ~/.cache/Cypress
# common/temp
# */.rush/temp
# */node_modules
# key: ${{ runner.os }}-${{ hashFiles('common/config/rush/repo-state.json') }}
# # Only need a cache hit or miss,
# # cached dependencies aren't used until following jobs
# lookup-only: true

# - name: Install
# if: steps.restore-cache.outputs.cache-hit != 'true'
# run: node common/scripts/install-run-rush.js install

# - name: Save Cache
# id: save-cache
# uses: actions/cache/save@v4
# if: steps.restore-cache.outputs.cache-hit != 'true'
# with:
# path: |
# ~/.cache/Cypress
# common/temp
# */.rush/temp
# */node_modules
# key: ${{ steps.restore-cache.outputs.cache-primary-key }}

build:
runs-on: ubuntu-latest
needs: install
# needs: install
uses: ./.github/workflows/install.yml
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -102,7 +103,8 @@ jobs:
runs-on: ubuntu-latest
environment:
name: staging
needs: [install, build]
# needs: [install, build]
needs: build
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -147,7 +149,8 @@ jobs:
runs-on: ubuntu-latest
environment:
name: staging
needs: [install, build]
# needs: [install, build]
needs: build
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -189,7 +192,8 @@ jobs:
runs-on: ubuntu-latest
environment:
name: staging
needs: [install, build]
# needs: [install, build]
needs: build
steps:
- uses: actions/checkout@v4

Expand Down Expand Up @@ -233,7 +237,8 @@ jobs:
environment:
name: staging
url: https://www-stage.trshcmpctr.com
needs: [install, build, unit-test, e2e-test, lint]
# needs: [install, build, unit-test, e2e-test, lint]
needs: [build, unit-test, e2e-test, lint]
steps:
- uses: actions/checkout@v4

Expand Down
40 changes: 40 additions & 0 deletions .github/workflows/install.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
name: Install

on:
workflow_call:

jobs:
install:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Restore Cache
id: restore-cache
uses: actions/cache/restore@v4
with:
path: |
~/.cache/Cypress
common/temp
*/.rush/temp
*/node_modules
key: ${{ runner.os }}-${{ hashFiles('common/config/rush/repo-state.json') }}
# Only need a cache hit or miss,
# cached dependencies aren't used until following jobs
lookup-only: true

- name: Install
if: steps.restore-cache.outputs.cache-hit != 'true'
run: node common/scripts/install-run-rush.js install

- name: Save Cache
id: save-cache
uses: actions/cache/save@v4
if: steps.restore-cache.outputs.cache-hit != 'true'
with:
path: |
~/.cache/Cypress
common/temp
*/.rush/temp
*/node_modules
key: ${{ steps.restore-cache.outputs.cache-primary-key }}

0 comments on commit 3c09710

Please sign in to comment.