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

CI: GitHub Actions #632

Closed
azu opened this issue Oct 14, 2019 · 7 comments · Fixed by #686
Closed

CI: GitHub Actions #632

azu opened this issue Oct 14, 2019 · 7 comments · Fixed by #686
Labels
good first issue Good for newcomers Type: Testing Adding missing tests or correcting existing tests

Comments

@azu
Copy link
Member

azu commented Oct 14, 2019

We can move to GitHub Actions from Travis CI and Appveyor.

GitHub Action do 20 workflows concurrently.

You can execute up to 20 workflows concurrently per repository.
https://help.github.com/en/articles/about-github-actions

It will improve testing performance.

@azu azu added Type: Testing Adding missing tests or correcting existing tests good first issue Good for newcomers labels Oct 14, 2019
@azu
Copy link
Member Author

azu commented Oct 20, 2019

Rough Image:

  • Move Unit/E2E test to GitHub Action from Travis CI/Appveyor
    • => Drop to use Appveyor(Delete appveyor.yml and stop to use it)
  • Preserve deploy script on Travis CI

Finally, we use GitHub Action and Travis CI(deploy website)?

name: "CI"
on: [push, pull_request]

jobs:
  unit_test:
    runs-on: ubuntu-16.04
    strategy:
      matrix:
        os: [macOS-10.14, windows-2016, ubuntu-18.04]
        node: [ 8, 10, 12 ]
    name: Node ${{ matrix.node }} on ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v1
      - name: Setup node
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node }}
      - name: Bootstrap
        run: |
          npm install -g yarn
          yarn install --frozen-lockfile
          yarn run bootstrap
      - name: Run tests
        run: |
          yarn test
          yarn run test:examples
          yarn run test:integration
  documentation:
    runs-on: ubuntu-latest
    strategy:
      matrix:
        node: [ 12 ]
    name: Node ${{ matrix.node }} on ${{ matrix.os }}
    steps:
      - uses: actions/checkout@v1
      - name: Setup node
        uses: actions/setup-node@v1
        with:
          node-version: ${{ matrix.node }}
      - name: Bootstrap
        run: |
          npm install -g yarn
          yarn install --frozen-lockfile
          yarn run bootstrap --scope textlint-website
      - name: Check documents
        run: |
          yarn run test:docs
          yarn run website

It is difficult that move Deploy Script(Build Website and deploy to gh-pages) to GitHub Actions.

  • textlint/.travis.yml

    Lines 45 to 54 in e77f213

    - stage: deploy
    node_js: stable
    if: branch = master AND type != pull_request
    install:
    - yarn install --frozen-lockfile
    - yarn run bootstrap --scope textlint-website
    before_script:
    - $(npm bin)/set-up-ssh --key "$encrypted_6407ccbe9d33_key" --iv "$encrypted_6407ccbe9d33_iv" --path-encrypted-key ".travis/textlint.github.io-deploykey.enc"
    script:
    - $(npm bin)/update-branch --commands "npm run website" --commit-message "Update Website [skip ci]" --directory "website/build/textlint" --distribution-branch "master" --distribution-repository "git@github.com:textlint/textlint.github.io.git" --source-branch "master"

Because GITHUB_TOKEN of GitHub Actions does not support gh-pages yet.

@azu
Copy link
Member Author

azu commented Oct 20, 2019

  • Need to compare performance

Currently, Travis CI take 10 min.
(Mostly, Appveyor finish faster than Travis CI)

image

https://travis-ci.org/textlint/textlint/builds/600215559

@azu azu mentioned this issue Oct 20, 2019
@Kesin11
Copy link
Contributor

Kesin11 commented Oct 20, 2019

@azu
I tried it in my forked repository Kesin11#1
Some config like job/step name are different, but env matrix is same as you suggested.

Performance

Almost jobs that include macVM took about 6 to 7minutes.

Test result

Linux and macOS are OK. But windows is failed.
I also try windows server 2019 with windows-latest but there was no change.

  1. node 8 version problem.
    Run yarn install --frozen-lockfile failed only windows & node8 environment.
    actions/setup-node with windows using old node 8.10. 😥 It different from other OS.
    It looks bug of github VM environment.
    Node 8 installs different versions depending on system actions/setup-node#27

  2. prettier error
    prettier output error only windows & node 10,12 matrix like this

D:\a\textlint\textlint\packages\@textlint\fixer-formatter\test\fixtures\double.js
##[error]   1:26  error  Delete `␍`  prettier/prettier

I don't know why it is. I'm not familiar with prettier and windows.

In my opinion, split workflow that test windows from Linux and macOS.
In the Windows environment, some workarounds may be required.

@azu
Copy link
Member Author

azu commented Oct 20, 2019

Almost jobs that include macVM took about 6 to 7minutes.

Yeah! Good perf.

Test result

Nice reasearch!
Both problem is related with Windows 😢

So, I propose that we do following step.

At first step, we add GitHub Action without Windows like os: [macOS-10.14, ubuntu-18.04]
In next step, we try to add windows support.

@azu
Copy link
Member Author

azu commented Oct 20, 2019

@Kesin11 Can you submit PR without windows support?

@Kesin11
Copy link
Contributor

Kesin11 commented Oct 20, 2019

Thank you for the review.
I'll do it today.

@XhmikosR
Copy link

Just enforce LF via a gitattributes file and everything should be OK on Windows too.

https://github.com/MaxCDN/bootstrapcdn/blob/develop/.gitattributes

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
good first issue Good for newcomers Type: Testing Adding missing tests or correcting existing tests
Projects
None yet
3 participants