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

chore(workflows): add macOS, Windows, node v13 and linting #1356

Merged
merged 64 commits into from
Mar 31, 2020

Conversation

ryanclark
Copy link
Member

@ryanclark ryanclark commented Mar 20, 2020

What kind of change does this PR introduce?
GitHub workflow changes

  • Add macOS
  • Add Windows
  • Add Node 13
  • Run linting tests
  • Rename steps to be clearer

next - #1355

run: |
yarn
yarn bootstrap
- name: Run test for webpack version ${{ matrix.webpack-version }}
- name: Linting
run: yarn lint
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 move it to own step, we don't need run link on every platform and node version

Copy link
Member

@rishabh3112 rishabh3112 left a comment

Choose a reason for hiding this comment

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

We need to integrate GitHub actions with webpack-bot if we are removing travis.

@webpack-bot
Copy link

@evilebottnawi Thanks for your update.

I labeled the Pull Request so reviewers will review it again.

@rishabh3112 Please review the new changes.

@alexander-akait
Copy link
Member

@rishabh3112

From slack:

evilebottnawi:stuck_out_tongue:  5:35 PM
@sokra Can we integrate webpack-bot with github actions https://github.com/webpack/webpack-cli/pull/1356/?

sokra  5:49 PM
Yes, that would be the plan, but I need to find the time for that.

evilebottnawi:stuck_out_tongue:  5:50 PM
@sokra It’s normal that for now we will ignore it and fully integrate github actions for webpack-cli?

sokra  5:51 PM
yeah integrate with github actions.

So let's merge, I don’t think that the bot helps us so much, we see everything that comes from without a bot

rishabh3112
rishabh3112 previously approved these changes Mar 24, 2020
Copy link
Member

@rishabh3112 rishabh3112 left a comment

Choose a reason for hiding this comment

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

Okay, But I still insist to have it as soon as possible because the webpack-bot is the first point of interaction with the person who puts up the PR. It let's them know about they have to sign CLA, whether their PR passed the checks, etc which really help those who are new to project and don't know where are these things.
For us reviewers, I can confirm that without bot too we are fine.

@fokusferit
Copy link
Contributor

May I ask what are you trying to do exactly? I see a lot of commits trying to skip tests.

@alexander-akait
Copy link
Member

@fokusferit Investigate why execa do not kill processes on GitHub actions, but works fine locally

@webpack-bot
Copy link

@evilebottnawi The tests look fine, but there are code style issue in your Pull Request. Please review the following:

Worker information [...]
Build system information [...]
travis_fold:start:docker_mtu
travis_fold:end:docker_mtu
travis_fold:start:resolvconf
travis_fold:end:resolvconf


Setting environment variables from repository settings
$ export BUNDLESIZE_GITHUB_TOKEN=[secure]
$ export GH_TOKEN=[secure]
$ export nproc=4

Setting environment variables from .travis.yml
$ export JOB_PART=lint


Setting up build cache [...]
 [...]
$ node --version
v12.16.1
$ npm --version
6.13.4
$ nvm --version
0.35.3
$ yarn --version
1.15.2

$ yarn travis:lint
yarn run v1.22.4
error Command "travis:lint" not found.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command "yarn travis:lint" exited with 1.
$ yarn test:ci
yarn run v1.22.4
$ yarn test:cli && yarn test:packages
$ jest test/ --reporters=default --reporters=jest-junit --forceExit
PASS test/node/node.test.js
PASS test/mode/prod/prod.test.js
PASS test/global/global.test.js
PASS test/no-mode/no-mode.test.js
PASS test/output/named-bundles/output-named-bundles.test.js
PASS test/utils/test-utils.test.js
PASS test/info/info-help.test.js
FAIL test/serve/serve-basic.test.js
  ● basic serve usage › compiles without flags

    expect(received).toContain(expected) // indexOf

    Expected substring: "main.js"
    Received string:    ""

      35 |         it('compiles without flags', async () => {
      36 |             const { stdout, stderr } = await runServe(['--port', port]);
    > 37 |             expect(stdout).toContain('main.js');
         |                            ^
      38 |             expect(stdout).not.toContain('hot/dev-server.js');
      39 |             expect(stderr).toHaveLength(0);
      40 |         });

      at Object.<anonymous> (test/serve/serve-basic.test.js:37:28)

  ● basic serve usage › uses hot flag to alter bundle

    expect(received).toContain(expected) // indexOf

    Expected substring: "main.js"
    Received string:    ""

      42 |         it('uses hot flag to alter bundle', async () => {
      43 |             const { stdout, stderr } = await runServe(['--port', port, '--hot']);
    > 44 |             expect(stdout).toContain('main.js');
         |                            ^
      45 |             expect(stdout).toContain('hot/dev-server.js');
      46 |             expect(stderr).toHaveLength(0);
      47 |         });

      at Object.<anonymous> (test/serve/serve-basic.test.js:44:28)

  ● basic serve usage › uses hot flag and progress flag

    expect(received).toContain(expected) // indexOf

    Expected substring: "main.js"
    Received string:    ""

      49 |         it('uses hot flag and progress flag', async () => {
      50 |             const { stdout, stderr } = await runServe(['--port', port, '--hot', '--progress']);
    > 51 |             expect(stdout).toContain('main.js');
         |                            ^
      52 |             expect(stdout).toContain('hot/dev-server.js');
      53 |             // progress flag makes use of stderr
      54 |             expect(stderr).not.toHaveLength(0);

      at Object.<anonymous> (test/serve/serve-basic.test.js:51:28)

  ● basic serve usage › throws error on unknown flag

    expect(received).toContain(expected) // indexOf

    Expected substring: "Unknown option: --unknown-flag"
    Received string:    "[webpack-cli] Promise rejection: Error: Cannot find module '/home/travis/build/webpack/webpack-cli/node_modules/@webpack-cli/package-utils/lib/index.js'. Please verify that the package.json has a valid \"main\" entry
    [webpack-cli] Error: Cannot find module '/home/travis/build/webpack/webpack-cli/node_modules/@webpack-cli/package-utils/lib/index.js'. Please verify that the package.json has a valid \"main\" entry

      2 | const logger = require('../utils/logger');
      3 | const execa = require('execa');
    > 4 | const { packageExists, promptInstallation } = require('@webpack-cli/package-utils');
        |                                               ^
      5 | 
      6 | const packagePrefix = '@webpack-cli';
      7 | 

      at Object.<anonymous> (packages/webpack-cli/lib/commands/ExternalCommand.js:4:47)
      at Module.load (internal/modules/cjs/loader.js:1002:32)"
      at Object.<anonymous> (test/serve/serve-basic.test.js:60:28)

PASS test/stats/stats.test.js (9.591s)
PASS test/mode/dev/dev.test.js
PASS test/version/version-multi-args.test.js
PASS test/help/help-single-arg.test.js
PASS test/defaults/output-defaults.test.js
FAIL test/info/info-output.test.js
  ● basic info usage › gets info without flags

    expect(received).toContain(expected) // indexOf

    Expected substring: "System:"
    Received string:    ""

      14 |         // stdout should include many details which will be
      15 |         // unique for each computer
    > 16 |         expect(stdout).toContain('System:');
         |                        ^
      17 |         expect(stderr).toHaveLength(0);
      18 |     });
      19 | 

      at Object.<anonymous> (test/info/info-output.test.js:16:24)

  ● basic info usage › gets info as json

    expect(received).toContain(expected) // indexOf

    Expected substring: "\"System\":"
    Received string:    ""

      20 |     it('gets info as json', async () => {
      21 |         const { stdout, stderr } = await runInfo(['--output-json']);
    > 22 |         expect(stdout).toContain('"System":');
         |                        ^
      23 |         expect(stderr).toHaveLength(0);
      24 | 
      25 |         const parse = () => {

      at Object.<anonymous> (test/info/info-output.test.js:22:24)

  ● basic info usage › gets info as markdown

    expect(received).toContain(expected) // indexOf

    Expected substring: "## System:"
    Received string:    ""

      32 |     it('gets info as markdown', async () => {
      33 |         const { stdout, stderr } = await runInfo(['--output-markdown']);
    > 34 |         expect(stdout).toContain('## System:');
         |                        ^
      35 |         expect(stderr).toHaveLength(0);
      36 |     });
      37 | 

      at Object.<anonymous> (test/info/info-output.test.js:34:24)

  ● basic info usage › gets only specific info

    expect(received).toContain(expected) // indexOf

    Expected substring: "## Binaries:"
    Received string:    ""

      40 |         // system info is not specified as a flag
      41 |         expect(stdout).not.toContain('## System:');
    > 42 |         expect(stdout).toContain('## Binaries:');
         |                        ^
      43 |         expect(stderr).toHaveLength(0);
      44 |     });
      45 | });

      at Object.<anonymous> (test/info/info-output.test.js:42:24)

FAIL test/info/info-multi-args.test.js
  ● info with multiple flags › gets info about system and browser

    expect(received).toContain(expected) // indexOf

    Expected substring: "System:"
    Received string:    ""

      12 |     it('gets info about system and browser', async () => {
      13 |         const { stdout, stderr } = await runInfo(['--system', '--binaries']);
    > 14 |         expect(stdout).toContain('System:');
         |                        ^
      15 |         expect(stdout).toContain('Binaries:');
      16 |         expect(stderr).toHaveLength(0);
      17 |     });

      at Object.<anonymous> (test/info/info-multi-args.test.js:14:24)

  ● info with multiple flags › gets only system info as json

    expect(received).toContain(expected) // indexOf

    Expected substring: "\"System\":"
    Received string:    ""

      19 |     it('gets only system info as json', async () => {
      20 |         const { stdout, stderr } = await runInfo(['-s', '--output-json']);
    > 21 |         expect(stdout).toContain('"System":');
         |                        ^
      22 |         expect(stderr).toHaveLength(0);
      23 |         const parse = () => {
      24 |             JSON.parse(stdout);

      at Object.<anonymous> (test/info/info-multi-args.test.js:21:24)

  ● info with multiple flags › gets only binary info in markdown

    expect(received).toContain(expected) // indexOf

    Expected substring: "## Binaries:"
    Received string:    ""

      30 |     it('gets only binary info in markdown', async () => {
      31 |         const { stdout, stderr } = await runInfo(['-b', '--output-markdown']);
    > 32 |         expect(stdout).toContain('## Binaries:');
         |                        ^
      33 |         expect(stdout).not.toContain('## System:');
      34 |         expect(stderr).toHaveLength(0);
      35 |     });

      at Object.<anonymous> (test/info/info-multi-args.test.js:32:24)

  ● info with multiple flags › gets npm packages

    expect(received).toHaveLength(expected)

    Expected length: 0
    Received length: 1135
    Received string: "[webpack-cli] Promise rejection: Error: Cannot find module '/home/travis/build/webpack/webpack-cli/node_modules/@webpack-cli/package-utils/lib/index.js'. Please verify that the package.json has a valid \"main\" entry
    [webpack-cli] Error: Cannot find module '/home/travis/build/webpack/webpack-cli/node_modules/@webpack-cli/package-utils/lib/index.js'. Please verify that the package.json has a valid \"main\" entry

      2 | const logger = require('../utils/logger');
      3 | const execa = require('execa');
    > 4 | const { packageExists, promptInstallation } = require('@webpack-cli/package-utils');
        |                                               ^
      5 | 
      6 | const packagePrefix = '@webpack-cli';
      7 | 

      at Object.<anonymous> (packages/webpack-cli/lib/commands/ExternalCommand.js:4:47)
      at Module.load (internal/modules/cjs/loader.js:1002:32)"
      at Object.<anonymous> (test/info/info-multi-args.test.js:39:24)

PASS test/source-map/object/source-map-object.test.js
PASS test/help/help-flags.test.js
PASS test/help/help-commands.test.js
PASS test/merge/defaults/merge-defaults.test.js
PASS test/help/help-multi-args.test.js
PASS test/env/prod/prod.test.js
PASS test/entry/defaults-index/entry-multi-args.test.js
PASS test/env/array/array-env.test.js
PASS test/source-map/array/source-map-array.test.js
PASS test/typescript/typescript.test.js
PASS test/env/object/object-env.test.js
PASS test/config-lookup/dotfolder-array/dotfolder-array.test.js
PASS test/config/basic/basic-config.test.js
PASS test/config/type/array/array-config.test.js
PASS test/config-lookup/dotfolder-single/dotfolder-single.test.js
PASS test/merge/config/merge-config.test.js
PASS test/entry/config-entry/entry-with-command/entry-with-command.test.js
PASS test/version/version-single-arg.test.js
PASS test/defaults/without-config-and-entry/default-without-config.test.js
PASS test/entry/config-entry/entry-with-config/entry-with-config.test.js
PASS test/config/type/function/function-config.test.js
PASS test/target/node/node-test.test.js
PASS test/entry/scss/scss.test.js
PASS test/standard/standard.test.js
PASS test/config/empty/empty-config.test.js
PASS test/entry/defaults-empty/entry-single-arg.test.js
PASS test/unknown/unknown.test.js

Summary of all failing tests
FAIL test/serve/serve-basic.test.js
  ● basic serve usage › compiles without flags

    expect(received).toContain(expected) // indexOf

    Expected substring: "main.js"
    Received string:    ""

      35 |         it('compiles without flags', async () => {
      36 |             const { stdout, stderr } = await runServe(['--port', port]);
    > 37 |             expect(stdout).toContain('main.js');
         |                            ^
      38 |             expect(stdout).not.toContain('hot/dev-server.js');
      39 |             expect(stderr).toHaveLength(0);
      40 |         });

      at Object.<anonymous> (test/serve/serve-basic.test.js:37:28)

  ● basic serve usage › uses hot flag to alter bundle

    expect(received).toContain(expected) // indexOf

    Expected substring: "main.js"
    Received string:    ""

      42 |         it('uses hot flag to alter bundle', async () => {
      43 |             const { stdout, stderr } = await runServe(['--port', port, '--hot']);
    > 44 |             expect(stdout).toContain('main.js');
         |                            ^
      45 |             expect(stdout).toContain('hot/dev-server.js');
      46 |             expect(stderr).toHaveLength(0);
      47 |         });

      at Object.<anonymous> (test/serve/serve-basic.test.js:44:28)

  ● basic serve usage › uses hot flag and progress flag

    expect(received).toContain(expected) // indexOf

    Expected substring: "main.js"
    Received string:    ""

      49 |         it('uses hot flag and progress flag', async () => {
      50 |             const { stdout, stderr } = await runServe(['--port', port, '--hot', '--progress']);
    > 51 |             expect(stdout).toContain('main.js');
         |                            ^
      52 |             expect(stdout).toContain('hot/dev-server.js');
      53 |             // progress flag makes use of stderr
      54 |             expect(stderr).not.toHaveLength(0);

      at Object.<anonymous> (test/serve/serve-basic.test.js:51:28)

  ● basic serve usage › throws error on unknown flag

    expect(received).toContain(expected) // indexOf

    Expected substring: "Unknown option: --unknown-flag"
    Received string:    "[webpack-cli] Promise rejection: Error: Cannot find module '/home/travis/build/webpack/webpack-cli/node_modules/@webpack-cli/package-utils/lib/index.js'. Please verify that the package.json has a valid \"main\" entry
    [webpack-cli] Error: Cannot find module '/home/travis/build/webpack/webpack-cli/node_modules/@webpack-cli/package-utils/lib/index.js'. Please verify that the package.json has a valid \"main\" entry

      2 | const logger = require('../utils/logger');
      3 | const execa = require('execa');
    > 4 | const { packageExists, promptInstallation } = require('@webpack-cli/package-utils');
        |                                               ^
      5 | 
      6 | const packagePrefix = '@webpack-cli';
      7 | 

      at Object.<anonymous> (packages/webpack-cli/lib/commands/ExternalCommand.js:4:47)
      at Module.load (internal/modules/cjs/loader.js:1002:32)"
      at Object.<anonymous> (test/serve/serve-basic.test.js:60:28)

FAIL test/info/info-output.test.js
  ● basic info usage › gets info without flags

    expect(received).toContain(expected) // indexOf

    Expected substring: "System:"
    Received string:    ""

      14 |         // stdout should include many details which will be
      15 |         // unique for each computer
    > 16 |         expect(stdout).toContain('System:');
         |                        ^
      17 |         expect(stderr).toHaveLength(0);
      18 |     });
      19 | 

      at Object.<anonymous> (test/info/info-output.test.js:16:24)

  ● basic info usage › gets info as json

    expect(received).toContain(expected) // indexOf

    Expected substring: "\"System\":"
    Received string:    ""

      20 |     it('gets info as json', async () => {
      21 |         const { stdout, stderr } = await runInfo(['--output-json']);
    > 22 |         expect(stdout).toContain('"System":');
         |                        ^
      23 |         expect(stderr).toHaveLength(0);
      24 | 
      25 |         const parse = () => {

      at Object.<anonymous> (test/info/info-output.test.js:22:24)

  ● basic info usage › gets info as markdown

    expect(received).toContain(expected) // indexOf

    Expected substring: "## System:"
    Received string:    ""

      32 |     it('gets info as markdown', async () => {
      33 |         const { stdout, stderr } = await runInfo(['--output-markdown']);
    > 34 |         expect(stdout).toContain('## System:');
         |                        ^
      35 |         expect(stderr).toHaveLength(0);
      36 |     });
      37 | 

      at Object.<anonymous> (test/info/info-output.test.js:34:24)

  ● basic info usage › gets only specific info

    expect(received).toContain(expected) // indexOf

    Expected substring: "## Binaries:"
    Received string:    ""

      40 |         // system info is not specified as a flag
      41 |         expect(stdout).not.toContain('## System:');
    > 42 |         expect(stdout).toContain('## Binaries:');
         |                        ^
      43 |         expect(stderr).toHaveLength(0);
      44 |     });
      45 | });

      at Object.<anonymous> (test/info/info-output.test.js:42:24)

FAIL test/info/info-multi-args.test.js
  ● info with multiple flags › gets info about system and browser

    expect(received).toContain(expected) // indexOf

    Expected substring: "System:"
    Received string:    ""

      12 |     it('gets info about system and browser', async () => {
      13 |         const { stdout, stderr } = await runInfo(['--system', '--binaries']);
    > 14 |         expect(stdout).toContain('System:');
         |                        ^
      15 |         expect(stdout).toContain('Binaries:');
      16 |         expect(stderr).toHaveLength(0);
      17 |     });

      at Object.<anonymous> (test/info/info-multi-args.test.js:14:24)

  ● info with multiple flags › gets only system info as json

    expect(received).toContain(expected) // indexOf

    Expected substring: "\"System\":"
    Received string:    ""

      19 |     it('gets only system info as json', async () => {
      20 |         const { stdout, stderr } = await runInfo(['-s', '--output-json']);
    > 21 |         expect(stdout).toContain('"System":');
         |                        ^
      22 |         expect(stderr).toHaveLength(0);
      23 |         const parse = () => {
      24 |             JSON.parse(stdout);

      at Object.<anonymous> (test/info/info-multi-args.test.js:21:24)

  ● info with multiple flags › gets only binary info in markdown

    expect(received).toContain(expected) // indexOf

    Expected substring: "## Binaries:"
    Received string:    ""

      30 |     it('gets only binary info in markdown', async () => {
      31 |         const { stdout, stderr } = await runInfo(['-b', '--output-markdown']);
    > 32 |         expect(stdout).toContain('## Binaries:');
         |                        ^
      33 |         expect(stdout).not.toContain('## System:');
      34 |         expect(stderr).toHaveLength(0);
      35 |     });

      at Object.<anonymous> (test/info/info-multi-args.test.js:32:24)

  ● info with multiple flags › gets npm packages

    expect(received).toHaveLength(expected)

    Expected length: 0
    Received length: 1135
    Received string: "[webpack-cli] Promise rejection: Error: Cannot find module '/home/travis/build/webpack/webpack-cli/node_modules/@webpack-cli/package-utils/lib/index.js'. Please verify that the package.json has a valid \"main\" entry
    [webpack-cli] Error: Cannot find module '/home/travis/build/webpack/webpack-cli/node_modules/@webpack-cli/package-utils/lib/index.js'. Please verify that the package.json has a valid \"main\" entry

      2 | const logger = require('../utils/logger');
      3 | const execa = require('execa');
    > 4 | const { packageExists, promptInstallation } = require('@webpack-cli/package-utils');
        |                                               ^
      5 | 
      6 | const packagePrefix = '@webpack-cli';
      7 | 

      at Object.<anonymous> (packages/webpack-cli/lib/commands/ExternalCommand.js:4:47)
      at Module.load (internal/modules/cjs/loader.js:1002:32)"
      at Object.<anonymous> (test/info/info-multi-args.test.js:39:24)


Test Suites: 3 failed, 3 skipped, 39 passed, 42 of 45 total
Tests:       12 failed, 3 skipped, 101 passed, 116 total
Snapshots:   0 total
Time:        70.112s
Ran all test suites matching /test\//i.
Force exiting Jest: Have you considered using `--detectOpenHandles` to detect async operations that kept running after all tests finished?
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
error Command failed with exit code 1.
info Visit https://yarnpkg.com/en/docs/cli/run for documentation about this command.
The command "yarn test:ci" exited with 1.
store build cache [...]

Done. Your build exited with 1.

See complete report here.

@alexander-akait
Copy link
Member

Merging, feel free to feedback, in the next PRs, I will setup coverage normally

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants