Skip to content

Commit

Permalink
fix(ci): add reusable env setup action
Browse files Browse the repository at this point in the history
  • Loading branch information
mrcnk committed Jun 22, 2023
1 parent 6365866 commit d50b225
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 22 deletions.
33 changes: 33 additions & 0 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Setup Dependencies
description: Sets up Node.js, cache and installs dependencies
inputs:
GITHUB_TOKEN:
description: GitHub token to set up remote caching
required: true
runs:
using: 'composite'
steps:
- uses: actions/checkout@v3
- name: Turborepo Caching Server
uses: felixmosh/turborepo-gh-artifacts@v2
with:
repo-token: ${{ inputs.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: yarn
- name: Get yarn cache directory path
shell: bash
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install dependencies
shell: bash
run: yarn install --frozen-lockfile
16 changes: 4 additions & 12 deletions .github/workflows/extension-ci.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Browser extension's integration
name: Extension CI
on:
push:
branches: [main]
Expand All @@ -11,18 +11,10 @@ jobs:
VITE_APP_MODE: web
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Turborepo Caching Server
uses: felixmosh/turborepo-gh-artifacts@v2
- name: Setup env
uses: ./.github/actions/setup
with:
repo-token: ${{ secrets.GITHUB_TOKEN }}
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version-file: .nvmrc
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build extension
env:
TURBO_API: 'http://127.0.0.1:9080'
Expand Down
14 changes: 4 additions & 10 deletions .github/workflows/extension-e2e.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Browser extension's integration
name: Extension E2E
on:
push:
branches: [main]
Expand All @@ -10,16 +10,10 @@ jobs:
VITE_APP_MODE: web
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Turborepo Caching Server
uses: felixmosh/turborepo-gh-artifacts@v2
- name: Setup Node.js
uses: actions/setup-node@v3
- name: Setup env
uses: ./.github/actions/setup
with:
node-version-file: .nvmrc
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build extension
env:
TURBO_API: 'http://127.0.0.1:9080'
Expand Down

0 comments on commit d50b225

Please sign in to comment.