feat(test): snapshot testing (#107)

Co-authored-by: pre-commit-ci[bot] <66853113+pre-commit-ci[bot]@users.noreply.github.com>
This commit is contained in:
Aaron Pham
2023-07-10 17:23:19 -04:00
committed by GitHub
parent d3e4b95e84
commit c7f4dc7bb2
205 changed files with 11633 additions and 2349 deletions

View File

@@ -29,6 +29,20 @@ defaults:
run:
shell: bash --noprofile --norc -exo pipefail {0}
jobs:
quality:
runs-on: ubuntu-latest
if: github.event_name == 'pull_request'
name: quality-check
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Setup CI
uses: ./.github/actions/setup-repo
with:
python-version: ${{ env.STABLE_PYTHON_VERSION }}
- name: Run type check
run: hatch run typing
tests:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'pull_request' || github.event_name == 'push' }}
@@ -47,7 +61,7 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Run tests
run: hatch run full
run: hatch run tests:python
- name: Disambiguate coverage filename
run: mv .coverage ".coverage.${{ matrix.os }}.${{ matrix.python-version }}"
- name: Upload coverage data
@@ -99,6 +113,7 @@ jobs:
needs:
- coverage
- tests
- quality
runs-on: ubuntu-latest
steps:
- name: Decide whether the needed jobs succeeded or failed

View File

@@ -1,46 +0,0 @@
# Copyright 2023 BentoML Team. All rights reserved.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
name: cache-cleanup
on:
pull_request:
types:
- closed
jobs:
cleanup:
runs-on: ubuntu-latest
if: github.repository_owner == 'bentoml'
steps:
- name: Check out code
uses: actions/checkout@v3
- name: Cleanup
run: |
gh extension install actions/gh-actions-cache
REPO=${{ github.repository }}
BRANCH="refs/pull/${{ github.event.pull_request.number }}/merge"
echo "Fetching list of cache key"
cacheKeysForPR=$(gh actions-cache list -R $REPO -B $BRANCH | cut -f 1 )
## Setting this to not fail the workflow while deleting cache keys.
set +e
echo "Deleting caches..."
for cacheKey in $cacheKeysForPR
do
gh actions-cache delete $cacheKey -R $REPO -B $BRANCH --confirm
done
echo "Done"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}