feat: Apply cache to load proto registry for performance #9055
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: unit-tests | |
on: [pull_request] | |
jobs: | |
unit-test-python: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
python-version: [ "3.8", "3.9", "3.10" ] | |
os: [ ubuntu-latest, macOS-latest ] | |
exclude: | |
- os: macOS-latest | |
python-version: "3.9" | |
- os: macOS-latest | |
python-version: "3.10" | |
env: | |
OS: ${{ matrix.os }} | |
PYTHON: ${{ matrix.python-version }} | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Setup Python | |
id: setup-python | |
uses: actions/setup-python@v3 | |
with: | |
python-version: ${{ matrix.python-version }} | |
architecture: x64 | |
- name: Install mysql on macOS | |
if: startsWith(matrix.os, 'macOS') | |
run: | | |
brew install mysql | |
PATH=$PATH:/usr/local/mysql/bin | |
- name: Work around Homebrew MySQL being broken | |
# See https://github.com/Homebrew/homebrew-core/issues/130258 for more details. | |
if: startsWith(matrix.os, 'macOS') | |
run: | | |
brew install zlib | |
ln -sv $(brew --prefix zlib)/lib/libz.dylib $(brew --prefix)/lib/libzlib.dylib | |
- name: Upgrade pip version | |
run: | | |
pip install --upgrade "pip>=21.3.1,<23.2" | |
- name: Get pip cache dir | |
id: pip-cache | |
run: | | |
echo "::set-output name=dir::$(pip cache dir)" | |
- name: pip cache | |
uses: actions/cache@v2 | |
with: | |
path: | | |
${{ steps.pip-cache.outputs.dir }} | |
/opt/hostedtoolcache/Python | |
/Users/runner/hostedtoolcache/Python | |
key: ${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-pip-${{ hashFiles(format('**/py{0}-ci-requirements.txt', env.PYTHON)) }} | |
restore-keys: | | |
${{ runner.os }}-${{ steps.setup-python.outputs.python-version }}-pip- | |
- name: Install pip-tools | |
run: pip install pip-tools | |
- name: Install dependencies | |
run: make install-python-ci-dependencies | |
- name: Test Python | |
run: pytest -n 8 --cov=./ --cov-report=xml --color=yes sdk/python/tests | |
unit-test-ui: | |
runs-on: ubuntu-latest | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: '17.x' | |
registry-url: 'https://registry.npmjs.org' | |
- name: Install yarn dependencies | |
working-directory: ./ui | |
run: yarn install | |
- name: Build yarn rollup | |
working-directory: ./ui | |
run: yarn build:lib | |
- name: Run yarn tests | |
working-directory: ./ui | |
run: yarn test --watchAll=false |