Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update GitHub Actions workflows #34

Closed
wants to merge 5 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions .github/workflows/core.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@ on:
paths:
- "core/**"
pull_request:
paths:
- "core/**"
Comment on lines +10 to +11
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Let's not add paths filters for pull requests in this PR. These filters complicates CI setup and workflows execution, and we may need to handle them separately in the manner we did in keep-network/keep-core#2397.


defaults:
run:
Expand All @@ -18,18 +20,31 @@ jobs:
steps:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of using cd .. could we try to use working-directory setting?

  core-format:
    runs-on: ubuntu-latest
    defaults:
      run:
        working-directory: ./
    steps:
      - uses: actions/checkout@v4

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

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

      - name: Install Dependencies in root
        run: yarn install --prefer-offline --frozen-lockfile

      - name: Install Dependencies in core package
        working-directory: ./core
        run: yarn install --prefer-offline --frozen-lockfile

      - name: Format
        run: yarn format -w core

- uses: actions/checkout@v4

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

- name: Install Dependencies in root
run: cd .. && yarn install --prefer-offline --frozen-lockfile

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

- name: Install Dependencies
- name: Install Dependencies in core package
run: yarn install --prefer-offline --frozen-lockfile

- name: Make the script file executable
run: cd .. && chmod +x lint.sh
Comment on lines +43 to +44
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Instead of adding this step let's commit lint.sh as executable: git add --chmod=+x lint.sh


- name: Format
run: yarn format
run: cd .. && yarn format -w core

core-build:
runs-on: ubuntu-latest
Expand Down
47 changes: 47 additions & 0 deletions .github/workflows/website.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
name: Website

on:
push:
branches:
- main
paths:
- "website/**"
pull_request:
paths:
- "website/**"

defaults:
run:
working-directory: ./website

jobs:
core-format:
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
core-format:
website-format:

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

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

- name: Install Dependencies in root
run: cd .. && yarn install --prefer-offline --frozen-lockfile

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

- name: Install Dependencies in website package
run: yarn install --prefer-offline --frozen-lockfile

- name: Make the script file executable
run: cd .. && chmod +x lint.sh

- name: Format
run: cd .. && yarn format -w website
1 change: 1 addition & 0 deletions .nvmrc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
lts/iron
1 change: 1 addition & 0 deletions lint.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -euo pipefail

# Defaults, can be overwritten by input parameters.
Expand Down
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
"license": "MIT",
"private": true,
"scripts": {
"format": "./lint.sh",
"format:fix": "npm run format -- -f",
"lint:js": "./lint.sh -t js",
"lint:js:fix": "npm run lint:js -- -f",
"lint:config": "./lint.sh -t config",
Expand Down