Skip to content

Merge pull request #29 from throttr/binding-for-broadcast-and-unicast… #240

Merge pull request #29 from throttr/binding-for-broadcast-and-unicast…

Merge pull request #29 from throttr/binding-for-broadcast-and-unicast… #240

Workflow file for this run

name: Build and Test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
size: [uint8, uint16, uint32, uint64]
services:
throttr:
image: ghcr.io/throttr/throttr:5.0.7-debug-${{ matrix.size }}-AMD64-metrics-enabled
ports:
- 9000:9000
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '22'
- name: Install Yarn
run: |
npm install -g yarn
- name: Install dependencies
run: |
yarn install
- name: Build project
run: |
yarn build
- name: Run tests with coverage report
run: |
for i in {1..10}; do
nc -z localhost 9000 && echo "✅ throttr running ... " && break
echo "⏳ Try $i: waiting 1s..."
sleep 1
done
nc -z localhost 9000 || (echo "❌ throttr isn't running on port 9000" && exit 1)
yarn test:coverage
env:
THROTTR_SIZE: ${{ matrix.size }}
- name: Upload coverage reports to Codecov
if: ${{ matrix.size == 'uint16' }}
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
- name: Publish
if: ${{ github.ref_type == 'tag' && matrix.size == 'uint16' }}
run: |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > ~/.npmrc
npm publish --access public
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}