Add web app for testing ws-protocol server implementations #1468
Workflow file for this run
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
name: CI | |
on: | |
push: | |
branches: [main] | |
tags: ["releases/**"] | |
pull_request: | |
branches: ["*"] | |
jobs: | |
typescript: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
package: [ws-protocol, ws-protocol-examples] | |
node-version: [16.x, 18.x] | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
registry-url: https://registry.npmjs.org | |
cache: yarn | |
- name: Ensure examples use current version of ws-protocol package | |
run: "! grep '@foxglove/ws-protocol' yarn.lock" | |
- run: yarn install --frozen-lockfile | |
- run: yarn workspace @foxglove/${{ matrix.package }} lint:ci | |
- run: yarn workspace @foxglove/${{ matrix.package }} test | |
- name: Publish to NPM | |
if: ${{ startsWith(github.ref, format('refs/tags/releases/typescript/{0}/v', matrix.package)) }} | |
run: yarn workspace @foxglove/${{ matrix.package }} publish --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }} | |
python: | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
working-directory: python | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-python@v4 | |
with: | |
python-version: 3.8 | |
cache: pipenv | |
- run: pip install pipenv>=2022.1.8 | |
- run: pipenv install --dev --deploy | |
- run: pipenv run black --check . | |
- run: pipenv run pyright src tests | |
- run: pipenv run pytest | |
- run: pipenv run python -m build | |
- name: Publish to TestPyPI | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
if: ${{ !github.event.pull_request.head.repo.fork && github.actor != 'dependabot[bot]' }} | |
with: | |
user: __token__ | |
password: ${{ secrets.TESTPYPI_API_TOKEN }} | |
packages_dir: python/dist | |
repository_url: https://test.pypi.org/legacy/ | |
skip_existing: true | |
- name: Publish to PyPI | |
if: ${{ startsWith(github.ref, 'refs/tags/releases/python/v') }} | |
uses: pypa/gh-action-pypi-publish@release/v1 | |
with: | |
user: __token__ | |
password: ${{ secrets.PYPI_API_TOKEN }} | |
packages_dir: python/dist | |
cpp: | |
runs-on: ubuntu-latest | |
strategy: | |
fail-fast: false | |
matrix: | |
make_cmd: [format-check, build, build-cpp20, build-boost-asio] | |
defaults: | |
run: | |
working-directory: cpp | |
name: cpp (${{ matrix.make_cmd }}) | |
steps: | |
- uses: actions/checkout@v4 | |
- run: make ${{ matrix.make_cmd }} | |
test-client-web-app: | |
runs-on: ubuntu-latest | |
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment | |
permissions: | |
pages: write # to deploy to Pages | |
id-token: write # to verify the deployment originates from an appropriate source | |
# Deploy to the github-pages environment | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
registry-url: https://registry.npmjs.org | |
cache: yarn | |
- run: yarn install --frozen-lockfile | |
- run: yarn workspace test-client-web-app lint:ci | |
- run: yarn workspace test-client-web-app build | |
- name: Upload pages artifact | |
if: github.event_name == 'push' | |
uses: actions/upload-pages-artifact@v2 | |
with: | |
path: typescript/test-client-web-app/dist | |
- name: Deploy to GitHub Pages | |
if: github.event_name == 'push' | |
id: deployment | |
uses: actions/deploy-pages@v2 |