Skip to content

0.21401.10

0.21401.10 #170

# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
# For more information see: https://docs.github.com/en/actions/publishing-packages/publishing-nodejs-packages
name: Node.js Package
on:
push:
workflow_dispatch:
jobs:
build-x86:
runs-on: ubuntu-latest
permissions:
contents: write
packages: write
deployments: write
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
- uses: mmomtchev/setup-swig@v3
with:
branch: jse
- run: swig -version
- run: sudo apt-get update
- run: sudo apt-get install -y libsdl2-dev ffmpeg libopenh264-dev libyuv-dev libv4l-dev libavdevice-dev libavformat-dev libavcodec-dev libswscale-dev libavutil-dev libopencore-amrnb-dev libopencore-amrwb-dev
# build x86_64 version, test, pack, package and native module
- run: npm i --ignore-scripts
# see https://github.com/bchr02/node-pre-gyp-github/pull/46
- name: Hack node-pre-gyp-github source
run: sed -i 's/cmd, //g' node_modules/node-pre-gyp-github/bin/node-pre-gyp-github.js
- run: ./node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp rebuild package
- run: npm run test
- run: NODE_PRE_GYP_GITHUB_TOKEN=$NODE_AUTH_TOKEN ./node_modules/node-pre-gyp-github/bin/node-pre-gyp-github.js publish --release
- run: rm dist/pjsua2.node
- run: npm publish
start-arm64:
timeout-minutes: 5 # normally it only takes 1-2 minutes
needs:
- build-x86
name: Start self-hosted EC2 runner
runs-on: ubuntu-latest
permissions:
actions: write
contents: read
id-token: write
steps:
- name: Configure AWS credentials
id: creds
uses: aws-actions/configure-aws-credentials@v4
with:
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ vars.ASSUME_ROLE_ARN }}
output-credentials: true
- name: Start EC2 runner
id: start-ec2-runner
uses: NextChapterSoftware/[email protected]
with:
github_token: ${{ secrets.GH_PERSONAL_ACCESS_TOKEN }}
aws_access_key_id: ${{ steps.creds.outputs.aws-access-key-id }}
aws_secret_access_key: ${{ steps.creds.outputs.aws-secret-access-key }}
aws_session_token: ${{ steps.creds.outputs.aws-session-token }}
aws_region: ${{ vars.AWS_REGION }}
ec2_subnet_id: ${{ vars.SUBNET_ID }}
ec2_security_group_id: ${{ vars.SECURITY_GROUP_ID }}
ec2_instance_type: t4g.large
ec2_ami_id: ami-0c29a2c5cf69b5a9c # arm64 ubuntu 22.04
ec2_instance_ttl: 40 # Optional (default is 60 minutes)
ec2_spot_instance_strategy: BestEffort # Other options are: None, SpotOnly, BestEffort, MaxPerformance
ec2_instance_tags: > # Required for IAM role resource permission scoping
[
{"Key": "Owner", "Value": "runner-user"}
]
# Job that runs on the self-hosted runner
build-arm64:
timeout-minutes: 15
needs:
- start-arm64
runs-on: ${{ github.run_id }}
permissions:
contents: write
packages: write
deployments: write
env:
NODE_AUTH_TOKEN: ${{secrets.GITHUB_TOKEN}}
steps:
- run: env
- uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
node-version: 20
registry-url: https://npm.pkg.github.com/
- run: sudo apt-get update
- run: sudo apt-get install -y libpcre2-dev autotools-dev autoconf libtool-bin g++ make bison uuid-dev
- run: sudo apt-get install -y libsdl2-dev ffmpeg libopenh264-dev libyuv-dev libv4l-dev libavdevice-dev libavformat-dev libavcodec-dev libswscale-dev libavutil-dev libopencore-amrnb-dev libopencore-amrwb-dev
- run: npm i -g node-gyp node-addon-api
- uses: mmomtchev/setup-swig@v3
with:
branch: jse
- run: swig -version
# build native version, test, pack, package and native module
- run: npm i --ignore-scripts
# see https://github.com/bchr02/node-pre-gyp-github/pull/46
- name: Hack node-pre-gyp-github source
run: sed -i 's/cmd, //g' node_modules/node-pre-gyp-github/bin/node-pre-gyp-github.js
- run: ./node_modules/@mapbox/node-pre-gyp/bin/node-pre-gyp rebuild package
- run: npm run test
- run: NODE_PRE_GYP_GITHUB_TOKEN=$NODE_AUTH_TOKEN ./node_modules/node-pre-gyp-github/bin/node-pre-gyp-github.js publish --release