Skip to content

Commit

Permalink
Merge pull request #12 from Project-OMOTES/WouterSpaak/issue3
Browse files Browse the repository at this point in the history
Typescript: Add typescript generation
  • Loading branch information
lfse-slafleur authored Jul 5, 2024
2 parents 2ab4472 + 370e5a4 commit 11d6132
Show file tree
Hide file tree
Showing 12 changed files with 3,012 additions and 2 deletions.
23 changes: 21 additions & 2 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,18 +8,37 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: [ "3.8", "3.11" ]
python-version: ["3.8", "3.11"]
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
cache: 'pip'
cache: "pip"
- run: |
./python/ci/linux/create_venv.sh
./python/ci/linux/install_dependencies.sh
- name: build
run: |
./python/ci/linux/build_python_package.sh
build-typescript:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./typescript
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
cache: "npm"
cache-dependency-path: "./typescript/package-lock.json"
- uses: arduino/setup-protoc@v3
with:
version: "25.2"
- name: Build TypeScript artifacts
run: |
npm ci
npm run build
32 changes: 32 additions & 0 deletions .github/workflows/node_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
name: NPM Publish
on:
push:
tags:
- "*"

jobs:
npm-publish:
runs-on: ubuntu-latest
environment: release
defaults:
run:
working-directory: ./typescript
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "20.x"
registry-url: "https://registry.npmjs.org"
cache: "npm"
cache-dependency-path: "./typescript/package-lock.json"
- uses: arduino/setup-protoc@v3
with:
version: "25.2"
- name: Build and publish to NPM
run: |
npm ci
npm run set-version --version="${{ github.ref_name }}"
npm run build
npm publish --public
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ var/
wheels/
pip-wheel-metadata/
share/python-wheels/
node_modules/
*.egg-info/
.installed.cfg
*.egg
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,3 +28,7 @@ A number of tools are available to create the Python package:
- `./python/ci/linux/update_dependencies.sh`: Updates the build and package dependencies.
- `./python/ci/linux/build_python_package.sh`: Generates the python package containing the python generated protobuf
messages.

# TypeScript-specific implementation Developers Guide
To build the TypeScript artifacts, navigate to `/typescript` and run `npm run build`. Versioning is done automatically
through the corresponding GitHub action (see [node_release.yml](./.github/workflows/node_release.yml)).
28 changes: 28 additions & 0 deletions typescript/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# @omotes/proto

Library containing generated OMOTES Job class from Protobuf specification.

You probably don't want to install this directly, rather install it through [@omotes/sdk](https://npmjs.com/@omotes/sdk).

## Development

Make sure you have the `protoc` executable available on your PATH.
Version 25.2 is used: https://github.com/protocolbuffers/protobuf/releases.

### Building

Run the following command to build the protobuf artifacts:

```sh
npm run build
```

### Bumping version from tag

To correctly version `package.json` with the corresponding git tag, run:

```sh
npm run set-version major.minor.patch
```

You shouldn't have to run this yourself, it will be called through GitHub actions (see [node_release.yml](../.github/workflows/node_release.yml)).
Loading

0 comments on commit 11d6132

Please sign in to comment.