Skip to content

Commit

Permalink
trying a complex new workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
HowardBraham committed Dec 11, 2024
1 parent 0930dbc commit c314e01
Show file tree
Hide file tree
Showing 3 changed files with 70 additions and 16 deletions.
10 changes: 10 additions & 0 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,18 @@ jobs:
run: ${{ steps.download-actionlint.outputs.executable }} -color
shell: bash

prep-deps:
runs-on: ubuntu-latest
steps:
- name: Setup environment
uses: MetaMask/metamask-extension/.github/workflows/setup-environment.yml@self-hosted-temp
with:
should-checkout: true
should-cache: true

run-tests:
name: Run tests
needs: prep-deps
uses: ./.github/workflows/run-tests.yml

all-jobs-completed:
Expand Down
32 changes: 16 additions & 16 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ jobs:
matrix:
shard: [1, 2, 3, 4, 5, 6]
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup environment
uses: metamask/github-tools/.github/actions/setup-environment@main
uses: MetaMask/metamask-extension/.github/workflows/setup-environment.yml@self-hosted-temp
with:
should-checkout: false
should-cache: false

- name: test:unit:coverage
run: yarn test:unit:coverage --shard=${{ matrix.shard }}/${{ strategy.job-total }}
Expand All @@ -39,11 +39,11 @@ jobs:
name: Webpack tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup environment
uses: metamask/github-tools/.github/actions/setup-environment@main
uses: MetaMask/metamask-extension/.github/workflows/setup-environment.yml@self-hosted-temp
with:
should-checkout: false
should-cache: false

- name: test:unit:webpack:coverage
run: yarn test:unit:webpack:coverage
Expand All @@ -60,11 +60,11 @@ jobs:
name: Integration tests
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup environment
uses: metamask/github-tools/.github/actions/setup-environment@main
uses: MetaMask/metamask-extension/.github/workflows/setup-environment.yml@self-hosted-temp
with:
should-checkout: false
should-cache: false

- name: test:integration:coverage
run: yarn test:integration:coverage
Expand All @@ -88,11 +88,11 @@ jobs:
current-coverage: ${{ steps.get-current-coverage.outputs.CURRENT_COVERAGE }}
stored-coverage: ${{ steps.get-stored-coverage.outputs.STORED_COVERAGE }}
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Setup environment
uses: metamask/github-tools/.github/actions/setup-environment@main
uses: MetaMask/metamask-extension/.github/workflows/setup-environment.yml@self-hosted-temp
with:
should-checkout: false
should-cache: false

- name: Download artifacts
uses: actions/download-artifact@v4
Expand Down
44 changes: 44 additions & 0 deletions .github/workflows/setup-environment.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: Setup environment
description: Setup environment
inputs:
should-checkout:
required: false
default: true
should-cache:
required: false
default: true
runs:
using: composite
steps:
- name: Checkout repository
if: ${{ inputs.should-checkout }}
uses: actions/checkout@v4

- name: Download workspace
if: ${{ !inputs.should-checkout }}
uses: actions/cache/restore@v4
with:
path: ./
key: workspace-${{ github.sha }}

- run: corepack enable
shell: bash

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version-file: .nvmrc
cache: yarn
cache-dependency-path: yarn.lock

- name: Install dependencies
if: ${{ inputs.should-checkout }}
run: yarn --immutable
shell: bash

- name: Cache workspace
if: ${{ inputs.should-cache }}
uses: actions/cache/save@v4
with:
path: ./
key: workspace-${{ github.sha }}

0 comments on commit c314e01

Please sign in to comment.