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

Fixed triple-reporting lint issues #1345

Merged
merged 4 commits into from
Nov 29, 2020
Merged

Fixed triple-reporting lint issues #1345

merged 4 commits into from
Nov 29, 2020

Conversation

yzwdroid
Copy link
Contributor

@yzwdroid yzwdroid commented Nov 13, 2020

Issue This PR Addresses

Fixes #1336

Type of Change

  • Bugfix: Change which fixes an issue
  • New Feature: Change which adds functionality
  • Documentation Update: Change which improves documentation
  • UI: Change which improves UI

Description

only run test-ci when the os is ubuntu

Checklist

  • Quality: This PR builds and passes our npm test and works locally
  • Tests: This PR includes thorough tests or an explanation of why it does not
  • Screenshots: This PR includes screenshots or GIFs of the changes made or an explanation of why it does not (if applicable)
  • Documentation: This PR includes updated/added documentation to user exposed functionality or configuration variables are added/changed or an explanation of why it does not(if applicable)

@yzwdroid yzwdroid changed the title solved triple-reporting lint issues Fixed triple-reporting lint issues Nov 13, 2020
Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

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

The problem I see with this approach is that we no longer run tests on the other platforms, in which case there is no point having them listed in the matrix.

@raygervais do you have any insight into other ways to reduce the lint spam without shutting off the build matrix?

@manekenpix manekenpix added the area: CI/CD Continuous integration / Continuous delivery label Nov 14, 2020
@humphd
Copy link
Contributor

humphd commented Nov 18, 2020

@yzwdroid this needs a rebase, and an update on where we stand. Are you hoping to get this done in time for 0.3? If so, we need to finalize and merge this today.

@yzwdroid
Copy link
Contributor Author

I am thinking if we have a better solution for this. I already have a PR merged for release 0.3. Thanks.
I'll do the rebase now.

Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

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

Alright, I did some research and here's a better way, let's separate the lint and test scripts, and do something like Svelte is doing. Here is their workflow file:

name: CI
on: [push, pull_request]
jobs:
  Tests:
    runs-on: ${{ matrix.os }}
    timeout-minutes: 10
    strategy:
      matrix:
        node-version: [8, 10, 12, 14]
        os: [ubuntu-latest, windows-latest, macOS-latest]
    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-node@v1
      with:
        node-version: ${{ matrix.node-version }}
    - run: npm install
    - run: npm test
      env:
        CI: true
  Lint:
    runs-on: ubuntu-latest
    timeout-minutes: 2
    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-node@v1
    - run: 'npm i && npm run lint'
  Unit:
    runs-on: ${{ matrix.os }}
    timeout-minutes: 5
    strategy:
      matrix:
        os: [ubuntu-latest, windows-latest, macOS-latest]
    steps:
    - uses: actions/checkout@v1
    - uses: actions/setup-node@v1
    - run: 'npm i && npm run test:unit'

To do this, we'll need to get rid of test-ci and do these three things separately:

  1. npm run prettier-check to make sure the PR has proper formatting. Do this only on linux
  2. npm run eslint to make sure the PR passes lint. Do this only on linux
  3. npm run test to make sure the PR passes tests. Do this on all OSes

@yzwdroid
Copy link
Contributor Author

Thanks for the help @humphd . I changed the condition as you mentioned.

Copy link
Contributor

@humphd humphd left a comment

Choose a reason for hiding this comment

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

You haven't done what I asked. Can you split up the jobs so that we have separate prettier, eslint, and test phases that can run in parallel?

@yzwdroid
Copy link
Contributor Author

I am a little confused about this approach. If we run all the jobs async, then we need to do npm install three times in the ubuntu server. Is that slow down a little bit?

@humphd
Copy link
Contributor

humphd commented Nov 22, 2020

Not if we also add caching, see https://docs.github.com/en/free-pro-team@latest/actions/guides/caching-dependencies-to-speed-up-workflows.

@yzwdroid
Copy link
Contributor Author

I'll add the cache, and commit it later.

@@ -28,4 +28,16 @@ jobs:
- run: npm install
- run: cp env.example .env
- run: npm run build
Copy link
Contributor

Choose a reason for hiding this comment

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

Let's get rid of this build step too, since we aren't using the build in CI.

Copy link
Contributor

Choose a reason for hiding this comment

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

See b615e5c, where I'm doing that for another PR too.

@yzwdroid
Copy link
Contributor Author

After I add the cache, the build time reduced from 3m 30 s to 2m 54s on Ubuntu from my repo https://github.com/yzwdroid/telescope/runs/1449300001?check_suite_focus=true. I'm not sure if I have done it right.

.github/workflows/node-js-ci.yml Outdated Show resolved Hide resolved
.github/workflows/node-js-ci.yml Outdated Show resolved Hide resolved
@humphd
Copy link
Contributor

humphd commented Nov 29, 2020

Let's get this rebased for the conflict that's in node-js-ci.yml.

@yzwdroid
Copy link
Contributor Author

I rebased the current commit, Is there any code to be changed?

@yzwdroid yzwdroid merged commit 38be67c into Seneca-CDOT:master Nov 29, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area: CI/CD Continuous integration / Continuous delivery
Projects
None yet
Development

Successfully merging this pull request may close these issues.

GitHub Actions is triple-reporting lint issues
3 participants