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

Speedup e2e test on github #14627

Merged
merged 5 commits into from Jun 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
24 changes: 24 additions & 0 deletions .github/workflows/e2e-tests-breaking.yml
Expand Up @@ -45,12 +45,36 @@ jobs:
- react-native
- prettier
steps:
- name: Get yarn1 cache directory path
id: yarn1-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js latest
uses: actions/setup-node@v3
with:
node-version: "*"
- name: Get yarn3 cache directory path
Copy link
Contributor

Choose a reason for hiding this comment

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

Q: Can we use cache: yarn in setup-node@v3?

Copy link
Member Author

Choose a reason for hiding this comment

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

It used to be like this, but that would use the same cache as ci, with only babel's dependencies, not what the E2E project needs.

Copy link
Contributor

Choose a reason for hiding this comment

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

the best way is to use the hash of the target project's lock file as the key

Maybe we can try cache-dependency-path?

https://github.com/actions/setup-node/blob/main/docs/advanced-usage.md#caching-packages-data

Copy link
Member Author

Choose a reason for hiding this comment

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

#14627 (comment)
As mentioned here, that's certainly good, but requires us to split the test script file and put the cache action after pulling the third-party repository.

id: yarn3-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Use yarn1 cache
uses: actions/cache@v3
id: yarn1-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn1-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn1-e2e-breaking-${{ matrix.project }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn1-e2e-breaking-${{ matrix.project }}-
- name: Use yarn3 cache
uses: actions/cache@v3
id: yarn3-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn3-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn3-e2e-breaking-${{ matrix.project }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn3-e2e-breaking-${{ matrix.project }}-
- name: Clean babel cache
run: |
rm -rf ${{ steps.yarn1-cache-dir-path.outputs.dir }}/*babel*
rm -rf ${{ steps.yarn3-cache-dir-path.outputs.dir }}/*babel*
- uses: actions/download-artifact@v3
with:
name: verdaccio-workspace
Expand Down
25 changes: 24 additions & 1 deletion .github/workflows/e2e-tests.yml
Expand Up @@ -44,13 +44,36 @@ jobs:
- react-native
- prettier
steps:
- name: Get yarn1 cache directory path
id: yarn1-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Checkout code
uses: actions/checkout@v3
- name: Use Node.js latest
uses: actions/setup-node@v3
with:
node-version: "*"
cache: "yarn"
- name: Get yarn3 cache directory path
id: yarn3-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
- name: Use yarn1 cache
uses: actions/cache@v3
id: yarn1-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn1-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn1-e2e-${{ matrix.project }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn1-e2e-${{ matrix.project }}-
- name: Use yarn3 cache
uses: actions/cache@v3
id: yarn3-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
with:
path: ${{ steps.yarn3-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn3-e2e-${{ matrix.project }}-${{ hashFiles('**/yarn.lock') }}
restore-keys: ${{ runner.os }}-yarn3-e2e-${{ matrix.project }}-
- name: Clean babel cache
Copy link
Member

Choose a reason for hiding this comment

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

Q: why do we need to clean the cache?

Copy link
Member Author

Choose a reason for hiding this comment

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

Because I found that the latest compiled babel will not be used, but the cache will be used. The babel package changes between each different CI test.

run: |
rm -rf ${{ steps.yarn1-cache-dir-path.outputs.dir }}/*babel*
rm -rf ${{ steps.yarn3-cache-dir-path.outputs.dir }}/*babel*
- uses: actions/download-artifact@v3
with:
name: verdaccio-workspace
Expand Down
8 changes: 5 additions & 3 deletions scripts/integration-tests/e2e-jest.sh
Expand Up @@ -58,15 +58,17 @@ if [ "$BABEL_8_BREAKING" = true ] ; then
"
fi

sed -i 's/"skipLibCheck": false,/"skipLibCheck": true,/g' tsconfig.json # Speedup
Copy link
Member

Choose a reason for hiding this comment

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

When we'll start publishing our type definitions we will need to re-enable this. However, they can safely be skipped for now.

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, the process was too slow and took about 8 minutes.


yarn build

# The full test suite takes about 20mins on CircleCI. We run only a few of them
# to speed it up.
# The goals of this e2e test are:
# 1) Check that the typescript compilation isn't completely broken
# 2) Make sure that we don't accidentally break jest's usage of the Babel API
CI=true yarn test-ci-partial packages
CI=true yarn test-ci-partial e2e/__tests__/babel
CI=true yarn test-ci-partial e2e/__tests__/transform
CI=true yarn jest --color --maxWorkers=2 --config jest.config.mjs packages
CI=true yarn jest --color --maxWorkers=2 --config jest.config.mjs e2e/__tests__/babel
CI=true yarn jest --color --maxWorkers=2 --config jest.config.mjs e2e/__tests__/transform

cleanup