Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Partially improve TypeScript compatibility tests #595

Merged
merged 1 commit into from
Oct 26, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions .eslintrc.cjs
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,9 @@ module.exports = {
node: true,
},
ignorePatterns: [
"packages/typescript-compat/*/dist/**",
"packages/*/dist/**",
"packages/*/.tmp/**",
"node_modules/**",
],
plugins: ["@typescript-eslint", "node", "import"],
Expand Down
21 changes: 17 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,6 @@ jobs:
steps:
- name: checkout
uses: actions/checkout@v4
- uses: bufbuild/[email protected]
with:
github_token: ${{ github.token }}
- name: Cache
uses: actions/cache@v3
with:
Expand All @@ -25,4 +22,20 @@ jobs:
restore-keys: |
${{ runner.os }}-protobuf-es-ci-
- name: make
run: make all checkdiff
run: make ci
typescript-compat:
runs-on: ubuntu-20.04
steps:
- name: checkout
uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.tmp
.tmp
key: ${{ runner.os }}-protobuf-es-typescript-compat-${{ hashFiles('Makefile') }}
restore-keys: |
${{ runner.os }}-protobuf-es-typescript-compat-
- name: make
run: make test-ts-compat
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
node_modules
/packages/*/dist
/packages/typescript-compat/*/dist
/packages/protobuf-test/descriptorset.bin
/packages/protoplugin-test/descriptorset.bin
/.tmp
Expand Down
14 changes: 6 additions & 8 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,6 @@ $(BUILD)/protobuf-conformance: $(GEN)/protobuf-conformance node_modules tsconfig
@touch $(@)

$(BUILD)/protobuf-example: $(BUILD)/protobuf node_modules tsconfig.base.json packages/protobuf-example/tsconfig.json $(shell find packages/protobuf-example/src -name '*.ts')
npm run -w packages/protobuf-example clean
npm run -w packages/protobuf-example build
@mkdir -p $(@D)
@touch $(@)
Expand Down Expand Up @@ -101,6 +100,10 @@ help: ## Describe useful make targets
.PHONY: all
all: build test format lint bench bootstrapwkt ## build, test, format, lint, bench, and bootstrapwkt (default)

.PHONY: ci
ci: build test-protobuf test-protoplugin test-conformance format lint bench bootstrapwkt #
$(MAKE) checkdiff

.PHONY: clean
clean: ## Delete build artifacts and installed dependencies
@# -X only removes untracked files, -d recurses into directories, -f actually removes files/dirs
Expand Down Expand Up @@ -129,13 +132,8 @@ test-conformance: $(BUILD)/upstream-protobuf $(BUILD)/protobuf-conformance
npm run -w packages/protobuf-conformance test

.PHONY: test-ts-compat
test-ts-compat: $(GEN)/protobuf-test node_modules
@for number in $(TS_VERSIONS) ; do \
formatted=$$(echo "$${number}" | sed -r 's/[\.]/_/g'); \
dirname=packages/protobuf-test ; \
echo "Testing TypeScript `node_modules/ts$$formatted/bin/tsc --version`" ; \
node_modules/ts$$formatted/bin/tsc -p $$dirname/typescript/tsconfig.$${formatted}.json --outDir $$dirname/dist/typescript/$$formatted || exit ; \
done
test-ts-compat: $(GEN)/protobuf-test $(BUILD)/protobuf node_modules
node packages/typescript-compat/typescript-compat.mjs

.PHONY: lint
lint: node_modules $(BUILD)/protobuf $(BUILD)/protobuf-test $(BUILD)/protobuf-conformance $(BUILD)/protoplugin $(GEN)/protobuf-bench $(GEN)/protobuf-example ## Lint all files
Expand Down
Loading