Skip to content

Commit

Permalink
refactor(ci): refactors GH actions with composite base action
Browse files Browse the repository at this point in the history
  • Loading branch information
dgrebb committed Jan 29, 2024
1 parent ef21991 commit 717cc8f
Show file tree
Hide file tree
Showing 9 changed files with 73 additions and 109 deletions.
53 changes: 41 additions & 12 deletions .github/actions/install-cache-deps/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,45 +5,74 @@ author: dgrebb
inputs:
WORKSPACE_ROOT:
description: Working Directory
BROWSER_BINARIES:
description: If the workflow needs BackstopJS testing, install and cache browser binaries.
default: "false"

runs:
using: composite
steps:
- name: ⚄ Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8
# - name: ⚄ Setup pnpm
# uses: pnpm/action-setup@v2
# with:
# version: 8

# - name: ⬢ Setup Node & pnpm Cache
# uses: actions/setup-node@v4
# with:
# node-version: ${{ env.NODE_VERSION }}
# cache: pnpm
# cache-dependency-path: |
# ${{ inputs.WORKSPACE_ROOT }}/package.json
# ${{ inputs.WORKSPACE_ROOT }}/pnpm-lock.yaml
# ${{ inputs.WORKSPACE_ROOT }}/node_modules

- name: ⬢ Setup Node & pnpm Cache
- name: Install Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: pnpm
cache-dependency-path: |
${{ inputs.WORKSPACE_ROOT }}/package.json
${{ inputs.WORKSPACE_ROOT }}/pnpm-lock.yaml
${{ inputs.WORKSPACE_ROOT }}/node_modules

- uses: pnpm/action-setup@v2
name: Install pnpm
with:
version: 8
run_install: false

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
- name: 🎭 Install & Cache Playwright Binaries
if: ${{ inputs.BROWSER_BINARIES }}
shell: bash
working-directory: ${{ inputs.WORKSPACE_ROOT }}
id: playwright-version
run: echo 'PLAYWRIGHT_VERSION=$(cat package.json | jq -r '.dependencies.playwright' || 'latest')' >> $GITHUB_ENV

- uses: actions/cache@v3
if: ${{ inputs.BROWSER_BINARIES }}
id: playwright-cache
with:
path: |
~/.cache/ms-playwright
key: ${{ runner.os }}-playwright-${{ env.PLAYWRIGHT_VERSION }}

- shell: bash
if: steps.playwright-cache.outputs.cache-hit != 'true'
if: ${{ inputs.BROWSER_BINARIES && steps.playwright-cache.outputs.cache-hit != 'true' }}
working-directory: ${{ inputs.WORKSPACE_ROOT }}
run: npx playwright install --with-deps

- shell: bash
if: steps.playwright-cache.outputs.cache-hit != 'true'
if: ${{ inputs.BROWSER_BINARIES && steps.playwright-cache.outputs.cache-hit != 'true' }}
working-directory: ${{ inputs.WORKSPACE_ROOT }}
run: npx playwright install-deps

Expand Down
22 changes: 5 additions & 17 deletions .github/workflows/backstop-remote.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,25 +32,13 @@ jobs:
token: ${{ github.token }}
fetch-depth: 1
sparse-checkout: |
_ci/backstop
.github/actions
_ci
- name: ⚄ Setup pnpm
uses: pnpm/action-setup@v2
- name: 🛢 Install Dependencies
uses: ./.github/actions/install-cache-deps
with:
version: 8

- name: ⬢ Setup Node & Cache
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: |
_ci/backstop/package.json
_ci/backstop/pnpm-lock.yaml
_ci/backstop/node_modules
- name: ↧ Install Dependencies
run: cd _ci/backstop && pnpm install && npx playwright install --with-deps
WORKSPACE_ROOT: _ci

- name: "Running Remote {ಠʖಠ}"
id: backstop
Expand Down
26 changes: 8 additions & 18 deletions .github/workflows/bd-fe.yml
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,14 @@ jobs:
ref: ${{ github.ref }}
token: ${{ github.token }}
fetch-depth: 1
sparse-checkout: |
.github/actions
front
- name: 🛢 Install Dependencies
uses: ./.github/actions/install-cache-deps
with:
WORKSPACE_ROOT: front

- name: 🤿 Set Vars
id: vars
Expand Down Expand Up @@ -135,24 +143,6 @@ jobs:
echo PUBLIC_ENV=${{ secrets.PUBLIC_ENV }} >> front/.env
cat front/.env
- name: ⚄ Setup pnpm
uses: pnpm/action-setup@v2
with:
version: 8

- name: ⬢ Setup Node & Cache
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: |
front/package.json
front/pnpm-lock.yaml
front/node_modules
- name: ↧ Install Dependencies
run: cd front && pnpm install

- name: ↻ Build
run: |
cd front
Expand Down
22 changes: 5 additions & 17 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,26 +31,14 @@ jobs:
token: ${{ github.token }}
fetch-depth: 1
sparse-checkout: |
.github/actions
front
- name: ⚄ Setup pnpm
uses: pnpm/action-setup@v2
- name: 🛢 Install Dependencies
uses: ./.github/actions/install-cache-deps
with:
version: 8

- name: ⬢ Setup Node & Cache
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: |
front/package.json
front/pnpm-lock.yaml
front/node_modules
- name: ↧ Install Dependencies
run: cd front && pnpm install
WORKSPACE_ROOT: front

- name: 👓 Check
run: |
cd front && npm run lint
cd front && pnpm check && pnpm lint
1 change: 1 addition & 0 deletions .github/workflows/test-backstop.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@ jobs:
uses: ./.github/actions/install-cache-deps
with:
WORKSPACE_ROOT: _ci/backstop
BROWSER_BINARIES: true

- name: 🔥 Warmup Cache
run: ./_ci/_utils/warmup.sh ${{ inputs.env }}
Expand Down
28 changes: 5 additions & 23 deletions .github/workflows/test-lighthouse.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,31 +43,13 @@ jobs:
token: ${{ github.token }}
fetch-depth: 1
sparse-checkout: |
_ci/_utils
_ci/perf
.github/actions
_ci
- name: ⚄ Setup pnpm
uses: pnpm/action-setup@v2
- name: 🛢 Install Dependencies
uses: ./.github/actions/install-cache-deps
with:
version: 8

- name: ⬢ Setup Node & Cache
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: |
_ci/perf/package.json
_ci/perf/pnpm-lock.yaml
_ci/perf/node_modules
- name: ↧ Install & Patch
run: |
cd _ci/perf && pnpm i
- name: 🌤️ Warmup CloudFront Cache
run: |
_ci/_utils/warmup.sh ${{ inputs.env }}
WORKSPACE_ROOT: _ci/perf

- name: 🔦 Lighthouse
id: lighthouse
Expand Down
24 changes: 5 additions & 19 deletions .github/workflows/test-psi.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,27 +40,13 @@ jobs:
token: ${{ github.token }}
fetch-depth: 1
sparse-checkout: |
_ci/_utils
_ci/perf
.github/actions
_ci
- name: ⚄ Setup pnpm
uses: pnpm/action-setup@v2
- name: 🛢 Install Dependencies
uses: ./.github/actions/install-cache-deps
with:
version: 8

- name: ⬢ Setup Node & Cache
uses: actions/setup-node@v4
with:
node-version: ${{ env.NODE_VERSION }}
cache: "pnpm"
cache-dependency-path: |
_ci/perf/package.json
_ci/perf/pnpm-lock.yaml
_ci/perf/node_modules
- name: ↧ Install & Patch
run: |
cd _ci/perf && pnpm i
WORKSPACE_ROOT: _ci

- name: 🌤️ Warmup CloudFront Cache
run: |
Expand Down
4 changes: 2 additions & 2 deletions front/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
"version": "3.16.1",
"private": true,
"scripts": {
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch",
"check": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --compiler-warnings \"css-unused-selector:ignore\"",
"check:watch": "svelte-kit sync && svelte-check --tsconfig ./jsconfig.json --watch --compiler-warnings \"css-unused-selector:ignore\"",
"prettier": "prettier",
"baseline": "mv -f ./.report/bundle/current/* ./.report/bundle/previous",
"bundle-stats": "bundle-stats",
Expand Down
2 changes: 1 addition & 1 deletion front/src/lib/components/cv/SkillBreakdown.svelte
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@
align-items: center;
}
&__term {
& .skill-icon__svg & {
& .skill-icon__svg {
padding: 2.5rem 0 0.25rem 0;
}
}
Expand Down

0 comments on commit 717cc8f

Please sign in to comment.