Skip to content

Commit

Permalink
chore(ci): use composite actions
Browse files Browse the repository at this point in the history
way nicer this way! see actions/runner#646 (comment)
  • Loading branch information
marcelgerber committed Nov 14, 2021
1 parent 252881a commit 1aac5db
Show file tree
Hide file tree
Showing 6 changed files with 41 additions and 101 deletions.
9 changes: 9 additions & 0 deletions .github/actions/build-tsc.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
name: Build TypeScript
description: Compiles our TypeScript code
runs:
using: composite
steps:
- name: Register Problem Matcher
run: echo "##[add-matcher].github/problemMatchers/tsc.json"
- name: Run tsc
run: yarn buildTsc
24 changes: 24 additions & 0 deletions .github/actions/setup-git-node.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Set up repo, node and dependencies
description: Runs all the setup steps required for the git repo, to have the proper Node version and all dependencies installed
runs:
using: composite
steps:
- name: Clone repository
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

# Use Node version specified in .nvmrc
# https://github.com/actions/setup-node/issues/32#issuecomment-525791142
- name: Read .nvmrc
id: nvm
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"

- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v2
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
cache: "yarn"

- name: Install dependencies
run: yarn --frozen-lockfile --network-concurrency 1
24 changes: 2 additions & 22 deletions .github/workflows/auto-deploy-gh-pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,33 +11,13 @@ jobs:
build-deploy-storybook-coverage:
runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/checkout@v2 # If you're using actions/checkout@v2 you must set persist-credentials to false in most cases for the deployment to work correctly.
with:
persist-credentials: false

# Use Node version specified in .nvmrc
# https://github.com/actions/setup-node/issues/32#issuecomment-525791142
- name: Read .nvmrc
id: nvm
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"

- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v2
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
cache: "yarn"

- name: Install dependencies
run: yarn --frozen-lockfile --network-concurrency 1
- uses: ./.github/actions/setup-git-node
- uses: ./.github/actions/build-tsc

# Note: running these two build steps subsequently means that if either `buildStorybook` or `coverage` fails,
# neither of them is deployed :(
# Let's hope this doesn't happen too often

- name: Build JS
run: yarn buildTsc

- name: Build Storybook 🔧
run: yarn buildStorybook

Expand Down
40 changes: 3 additions & 37 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v2

# Use Node version specified in .nvmrc
# https://github.com/actions/setup-node/issues/32#issuecomment-525791142
- name: Read .nvmrc
id: nvm
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"

- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v2
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
cache: "yarn"

- name: Install dependencies
run: yarn --frozen-lockfile --network-concurrency 1
- uses: ./.github/actions/setup-git-node

- name: Register Problem Matcher
run: echo "##[add-matcher].github/problemMatchers/tsc.json"
Expand All @@ -36,26 +20,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v2

# Use Node version specified in .nvmrc
# https://github.com/actions/setup-node/issues/32#issuecomment-525791142
- name: Read .nvmrc
id: nvm
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"

- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v2
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
cache: "yarn"

- name: Install dependencies
run: yarn --frozen-lockfile --network-concurrency 1

- name: Run tsc
run: yarn buildTsc
- uses: ./.github/actions/setup-git-node
- uses: ./.github/actions/build-tsc

- name: Run bundlewatch
run: yarn testBundlewatch
Expand Down
20 changes: 1 addition & 19 deletions .github/workflows/prettify.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}

# Use Node version specified in .nvmrc
# https://github.com/actions/setup-node/issues/32#issuecomment-525791142
- name: Read .nvmrc
id: nvm
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"

- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v2
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
cache: "yarn"

- name: Install dependencies
run: yarn --frozen-lockfile --network-concurrency 1
- uses: ./.github/actions/setup-git-node

- name: Run prettier
run: yarn fixPrettierAll
Expand Down
25 changes: 2 additions & 23 deletions .github/workflows/svg-compare.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,29 +6,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Clone repository
uses: actions/checkout@v2

# Use Node version specified in .nvmrc
# https://github.com/actions/setup-node/issues/32#issuecomment-525791142
- name: Read .nvmrc
id: nvm
run: echo "##[set-output name=NVMRC;]$(cat .nvmrc)"

- name: Use Node.js (.nvmrc)
uses: actions/setup-node@v2
with:
node-version: "${{ steps.nvm.outputs.NVMRC }}"
cache: "yarn"

- name: Install dependencies
run: yarn --frozen-lockfile --network-concurrency 1

- name: Register Problem Matcher
run: echo "##[add-matcher].github/problemMatchers/tsc.json"

- name: Run tests & checks
run: yarn buildTsc
- uses: ./.github/actions/setup-git-node
- uses: ./.github/actions/build-tsc

- name: Extract branch name
shell: bash
Expand Down

0 comments on commit 1aac5db

Please sign in to comment.