Repository navigation
Test #293
This file contains hidden or 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: Test | |
| on: | |
| push: | |
| workflow_dispatch: | |
| inputs: | |
| branch: | |
| required: false | |
| type: string | |
| default: master | |
| jobs: | |
| test: | |
| name: Test | |
| strategy: | |
| matrix: | |
| python: ["3.8", "3.9", "3.10"] | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions-ecosystem/action-regex-match@v2 | |
| id: regex-match | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| with: | |
| text: ${{ github.event.inputs.branch }} | |
| regex: '^[a-zA-Z0-9_/\-]+$' | |
| - name: Break on invalid branch name | |
| run: exit 1 | |
| if: ${{ github.event_name == 'workflow_dispatch' && steps.regex-match.outputs && steps.regex-match.outputs.match == '' }} | |
| - uses: actions/checkout@v3 | |
| - uses: actions/setup-python@v4 | |
| with: | |
| python-version: ${{ matrix.python }} | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ~/.cache/pip | |
| key: v1/${{ runner.os }}/pypi-${{matrix.python}}/${{ hashFiles('{requirements,development}.txt') }} | |
| restore-keys: v1/${{ runner.os }}/pypi-${matrix.python}/ | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 16 | |
| - name: Get yarn cache directory path | |
| id: yarn-cache-dir-path | |
| run: echo "::set-output name=dir::$(yarn cache dir)" | |
| - uses: actions/cache@v3 | |
| with: | |
| path: ${{ steps.yarn-cache-dir-path.outputs.dir }} | |
| key: v1/${{ runner.os }}/node-${{ matrix.node }}/${{ hashFiles('**/yarn.lock') }} | |
| restore-keys: v1/${{ runner.os }}/node-${{ matrix.node }}/ | |
| - name: Set up @percy/cli from git | |
| if: ${{ github.event_name == 'workflow_dispatch' }} | |
| env: | |
| BRANCH: ${{ github.event.inputs.branch }} | |
| run: | | |
| cd /tmp | |
| git clone --branch "$BRANCH" --depth 1 https://github.com/percy/cli | |
| cd cli | |
| PERCY_PACKAGES=`find packages -mindepth 1 -maxdepth 1 -type d | sed -e 's/packages/@percy/g' | tr '\n' ' '` | |
| git log -1 | |
| yarn | |
| yarn build | |
| yarn global:link | |
| # Non-JS repo: there is no @percy/cli dependency to remove and no node | |
| # project to `yarn link` into. yarn global:link already linked the | |
| # built @percy/* packages; just put the freshly built `percy` on PATH | |
| # for the test step (and verify it here). | |
| GLOBAL_BIN="$(yarn global bin)" | |
| echo "$GLOBAL_BIN" >> "$GITHUB_PATH" | |
| export PATH="$GLOBAL_BIN:$PATH" | |
| percy --version | |
| - run: make test-coverage |