-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat!: replace previous library version tests with new ones. (#139)
* !feat: replace previous library version tests with new ones. This is in preparation for the new library, with the new generator. * fix working directory for dependency install. * use python, as generator is not executable * add the env var so the tests actually run (instead of skip) * dir path should be all the way to testdata * install the library we just generated. 🤦 * add informational comment to the test workflow * licenses and fallback generation, per Averi.
- Loading branch information
Showing
22 changed files
with
312 additions
and
574 deletions.
There are no files selected for viewing
21 changes: 15 additions & 6 deletions
21
tests/test_firebase_auth_v1.py → .github/workflows/fallback_generation.yaml
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,20 +1,29 @@ | ||
# Copyright 2020 Google LLC | ||
# Copyright 2023 Google LLC | ||
# | ||
# 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 | ||
# 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. | ||
|
||
import json | ||
name: Test Library Generation | ||
on: | ||
pull_request: | ||
paths-ignore: | ||
- "scripts/**" | ||
- ".github/workflows/test_generation.yaml" | ||
|
||
import stringcase | ||
|
||
from helper import compare_values | ||
jobs: | ||
test-generator: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: none | ||
|
||
steps: | ||
- run: echo "No build required." |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,77 @@ | ||
# Copyright 2023 Google LLC | ||
# | ||
# 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: Test Library Generation | ||
# This workflow verifies the tooling that creates the library. It does this by | ||
# running the generator, and verifying that the tests pass on the | ||
# newly-generated library (not the library code currently committed) | ||
on: | ||
pull_request: | ||
paths: | ||
- "scripts/**" | ||
- ".github/workflows/test_generation.yaml" | ||
|
||
jobs: | ||
test-generator: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: read | ||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
env: | ||
LIBRARY_CHECKOUT_PATH: library | ||
DATA_SOURCE_CHECKOUT_PATH: google-cloudevents | ||
|
||
steps: | ||
- name: Python Library > Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
path: ${{ env.LIBRARY_CHECKOUT_PATH }} | ||
|
||
- name: Proto Schemas > Checkout Repository | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: googleapis/google-cloudevents | ||
path: ${{ env.DATA_SOURCE_CHECKOUT_PATH }} | ||
|
||
- name: Setup Python | ||
uses: actions/setup-python@v4 | ||
with: | ||
python-version: '3.10' | ||
cache: 'pip' | ||
|
||
- name: Install Generator Dependencies | ||
working-directory: ${{ env.LIBRARY_CHECKOUT_PATH }} | ||
run: pip install -r ./scripts/requirements.txt | ||
|
||
- name: Run the generator | ||
working-directory: ${{ env.LIBRARY_CHECKOUT_PATH }} | ||
run: python ./scripts/generate-from-proto.py -o ./src --quiet | ||
|
||
- name: Run library tests | ||
working-directory: ${{ env.LIBRARY_CHECKOUT_PATH }} | ||
env: | ||
GOOGLE_EVENTS_TESTDATA: ../${{env.DATA_SOURCE_CHECKOUT_PATH}}/testdata | ||
run: | | ||
pip install -r requirements-dev.txt | ||
pip install ./src | ||
pytest -v . | ||
- name: View generator output | ||
if: ${{ always() }} | ||
working-directory: ${{ env.LIBRARY_CHECKOUT_PATH }} | ||
run: | | ||
git add -N . # Needed if files are untracked | ||
git diff --ignore-all-space --ignore-blank-lines |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,6 @@ | ||
env/ | ||
tmp/ | ||
.vscode/ | ||
.github/* | ||
__pycache__ | ||
*.egg-info | ||
node_modules/ | ||
|
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
-r requirements.txt | ||
black==20.8b1 | ||
pylint==2.6.0 | ||
pytest==6.2.2 | ||
pytest==7.2.1 | ||
stringcase==1.2.0 |
93 changes: 0 additions & 93 deletions
93
tests/data/cloud_audit_v1_logentrydata_pubsubcreatetopic.json
This file was deleted.
Oops, something went wrong.
71 changes: 0 additions & 71 deletions
71
tests/data/cloud_firestore_v1_documenteventdata_complex.json
This file was deleted.
Oops, something went wrong.
39 changes: 0 additions & 39 deletions
39
tests/data/cloud_firestore_v1_documenteventdata_simple.json
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.