Skip to content

Commit

Permalink
Merge pull request #7 from michelle192837/update
Browse files Browse the repository at this point in the history
Revert "Update dev guide and generated protos."
  • Loading branch information
k8s-ci-robot authored Oct 25, 2024
2 parents 9651187 + 1c36ab8 commit 34a05f1
Show file tree
Hide file tree
Showing 6 changed files with 225 additions and 520 deletions.
24 changes: 5 additions & 19 deletions web/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,12 @@ Testgrid frontend code uses Lit elements and is written in Typescript. `tsconfig
More info about Lit and Typescript can be found in [Lit docs](https://lit.dev/) and [TS docs](https://www.typescriptlang.org/) respectively.

## Development
Local development is done with the help of [Web Dev Server](https://modern-web.dev/docs/dev-server/overview/). Web dev server configurations are defined in `web-dev-server-{env}.config.mjs` file. Depending on the config, frontend will render from the data from either fake or prod API.
Local development is done with the help of [Web Dev Server](https://modern-web.dev/docs/dev-server/overview/). Web dev server configurations are defined in `web-dev-server-{env}.config.mjs` file. Depending on the config, frontend will render from the data from either fake or prod API.

To develop locally:
- Run `npm install`, then:
- To see fake data, run `npm run start:local`
- To see prod data, run `npm run start:k8s`

More info in the [Scripts](#scripts) section below.

TIP: If you hit unexpected errors, try running `rm -rf node_modules/`, then `npm install` to refresh dependencies.
To see fake data, run `npm run start:local`. To see prod data, run `npm run start:k8s`. More info in the [Scripts](#scripts) section below.

## Testing
Testing relies on [Web Test Runner](https://modern-web.dev/docs/test-runner/overview/) with the configuration defined in `web-test-runner.config.mjs`. Testing is currently happening across the fake data provided by `json-server`.

To run the tests, run `npm run test`. More info in the [Scripts](#scripts) section below.

Expand All @@ -34,15 +28,7 @@ Most scripts are in `npm run` commands.

## Pulling from upstream

To generate or update the proto definitions:

- Checkout a local copy of https://github.com/GoogleCloudPlatform/testgrid, ex. `gh repo clone GoogleCloudPlatform/testgrid $HOME/gcp-testgrid`
- Run
```
# Path to local GCP/testgrid repo, `$HOME/gcp-testgrid`
TGREPO={{local GCP/testgrid repo}}
bump-protos.sh "$TGREPO"
```
Upstream proto definitions can be generated by running `pb/bump-protos.sh`

## Configs and files
- Frontend code is located in `src` dir.
Expand All @@ -52,4 +38,4 @@ To generate or update the proto definitions:
- `tsconfig.json` defines how and where will the .ts files compile.
- `web-dev-server-*.config.mjs` defines configuration parameters for the web dev server.
- `web-test-runner.config.mjs` defined configuration parameters for the web test runner.
- `rollup.config.js` defines how the code will be built and bundled.
- `rollup.config.js` defines how the code will be built and bundled.
27 changes: 8 additions & 19 deletions web/bump-protos.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,27 +17,16 @@ set -o errexit
set -o nounset
set -o pipefail

if [ "$#" -lt 1 ]
then
echo "Usage: $0 [path to local GCP/testgrid repo]"
exit 1
fi

# The location of your local https://github.com/GoogleCloudPlatform/testgrid repo, where the proto files live.
TESTGRID_REPO=$1

WORKDIR="$(git rev-parse --show-toplevel)" # The root directory of your repository
WORKDIR="${HOME}/github/testgrid" # The root directory of your repository
PROTO_DEST="${WORKDIR}/web/src/gen"

echo "Generating protos from source $TESTGRID_REPO to destination $PROTO_DEST..."

cd "${WORKDIR}/web"

# See https://github.com/timostamm/protobuf-ts/blob/master/MANUAL.md
npx protoc --ts_out ${PROTO_DEST} --proto_path ${TESTGRID_REPO} --ts_opt long_type_string \
${TESTGRID_REPO}/pb/custom_evaluator/custom_evaluator.proto \
${TESTGRID_REPO}/pb/state/state.proto \
${TESTGRID_REPO}/pb/summary/summary.proto \
${TESTGRID_REPO}/pb/config/config.proto \
${TESTGRID_REPO}/pb/test_status/test_status.proto \
${TESTGRID_REPO}/pb/api/v1/data.proto
npx protoc --ts_out ${PROTO_DEST} --proto_path ${WORKDIR} --ts_opt long_type_string \
${WORKDIR}/pb/custom_evaluator/custom_evaluator.proto \
${WORKDIR}/pb/state/state.proto \
${WORKDIR}/pb/summary/summary.proto \
${WORKDIR}/pb/config/config.proto \
${WORKDIR}/pb/test_status/test_status.proto \
${WORKDIR}/pb/api/v1/data.proto
Loading

0 comments on commit 34a05f1

Please sign in to comment.