Skip to content

Conversation

@strantalis
Copy link
Contributor

This pr partially resolves #70 by adding a github action to run npm ci, npm lint and npm build on pull requests to do some basic validation that the site can be built.

Signed-off-by: Sean Trantalis <strantalis@virtru.com>
@strantalis strantalis force-pushed the pull-request-checks branch 2 times, most recently from 22eb7d3 to f0f95e9 Compare March 20, 2022 00:54
@strantalis strantalis marked this pull request as draft March 20, 2022 01:18
@strantalis
Copy link
Contributor Author

@niklasmtj @chris-short @christianh814 I am not that familiar with how github actions caching is supposed to work so looking for a second set of eyes. Maybe I am just missing something.

When testing this configuration my assumption was I thought I could basically build the cache in the install job then carry it over to the lint and build jobs but that doesn't seem to be the case.

I might have been over complicating it as well. The below action works if we are okay with a single job (tested on my own repo).

name: CI Checks

on:
  pull_request:
    branches:    
      - main

jobs:
  check:
    name: Pull Request Lint/Build
    runs-on: ubuntu-20.04
    steps:
      - uses: actions/checkout@v2
      - name: Setup Node
        uses: actions/setup-node@v2
        with:
          node-version: '14'
          cache: npm
      - name: Install dependencies
        run: npm ci
      - name: Lint
        run: npm run lint
      - name: Build
        run: npm run build

@niklasmtj
Copy link
Member

I think that your posted solution above is a good one. Since the steps are run in sequence and not in parallel (as far as I know) as done in the link you posted. For me your steps look fine. We can be sure that a successful run of the Action will give us a proper Gatsby build.

Do you know why eslint does not work in the Action? I read everywhere that it is locally preinstalled when using setup-node action.

If you need any help going further just hit me up. (Berlin timezone, fyi 😀)

@strantalis strantalis marked this pull request as ready for review March 24, 2022 02:36
Signed-off-by: Sean Trantalis <strantalis@virtru.com>
@strantalis strantalis force-pushed the pull-request-checks branch from 00bdb17 to b8fc2dd Compare March 24, 2022 02:41
Copy link
Member

@christianh814 christianh814 left a comment

Choose a reason for hiding this comment

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

This LGTM

Copy link
Member

@scottrigby scottrigby left a comment

Choose a reason for hiding this comment

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

thank you @strantalis and @niklasmtj ❤️

@scottrigby scottrigby merged commit c10502a into open-gitops:main Mar 30, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

NPM or Yarn? We must choose!

4 participants