chore: drop api.json from repo, generate instead (#133)
This commit is contained in:
@@ -0,0 +1,43 @@
|
||||
name: Verify API
|
||||
on:
|
||||
push:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'scripts/*'
|
||||
- 'api-generator/*'
|
||||
pull_request:
|
||||
branches: [ master ]
|
||||
paths:
|
||||
- 'scripts/**'
|
||||
- 'api-generator/**'
|
||||
jobs:
|
||||
verify:
|
||||
timeout-minutes: 30
|
||||
strategy:
|
||||
fail-fast: true
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Cache Maven packages
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: ~/.m2
|
||||
key: ${{ runner.os }}-m2-${{ hashFiles('**/pom.xml') }}
|
||||
restore-keys: ${{ runner.os }}-m2
|
||||
- name: Cache Downloaded Drivers
|
||||
uses: actions/cache@v2
|
||||
with:
|
||||
path: driver-bundle/src/main/resources/driver
|
||||
key: ${{ runner.os }}-drivers-${{ hashFiles('scripts/*') }}
|
||||
restore-keys: ${{ runner.os }}-drivers
|
||||
- name: Download drivers
|
||||
run: scripts/download_driver_for_all_platforms.sh
|
||||
- name: Regenerate APIs
|
||||
run: scripts/generate_api.sh
|
||||
- name: Verify API is up to date
|
||||
run: |
|
||||
if [[ -n $(git status -s) ]]; then
|
||||
echo "ERROR: generated interfaces differ from the current sources:"
|
||||
git diff
|
||||
exit 1
|
||||
fi
|
||||
+7
-1
@@ -28,7 +28,13 @@ mvn test
|
||||
|
||||
### Generating API
|
||||
|
||||
Public Java API is generated from [api.json](https://github.com/microsoft/playwright-java/blob/master/api-generator/src/main/resources/api.json) which in turn is created by `playwright-cli print-api-json`.
|
||||
Public Java API is generated from api.json which is produced by `playwright-cli print-api-json`. To regenerate
|
||||
Java interfaces for the current driver run the following commands:
|
||||
|
||||
```bash
|
||||
./scripts/download_driver_for_all_platforms.sh
|
||||
./scripts/generate_api.sh
|
||||
```
|
||||
|
||||
### Code Style
|
||||
|
||||
|
||||
@@ -0,0 +1 @@
|
||||
api.json
|
||||
File diff suppressed because one or more lines are too long
@@ -9,7 +9,7 @@ cd "$(dirname $0)/.."
|
||||
echo "Updating api.json"
|
||||
./driver-bundle/src/main/resources/driver/linux/playwright-cli print-api-json > ./api-generator/src/main/resources/api.json
|
||||
|
||||
mvn compile -projects api-generator
|
||||
mvn compile -projects api-generator --no-transfer-progress
|
||||
|
||||
echo "Regenerating Java interfaces"
|
||||
mvn exec:java --projects api-generator -Dexec.mainClass=com.microsoft.playwright.tools.ApiGenerator
|
||||
|
||||
Reference in New Issue
Block a user