chore(deps): bump @octokit/rest from 20.0.2 to 20.1.0 #4449
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: | |
pull_request: | |
schedule: | |
# https://crontab.guru/#3_21_*_*_6 | |
- cron: "3 21 * * 6" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/[email protected] | |
with: | |
node-version: "18" | |
- name: Install system dependencies | |
run: sudo apt update && sudo apt-get -y install libusb-1.0-0-dev libasound2-dev libudev-dev | |
- name: Install nodejs dependencies | |
run: npm ci | |
- name: Build TS | |
run: npm run build | |
- name: Create tar with compilation results | |
run: | | |
shopt -s globstar | |
tar cvzf compilation-results.tar.gz --exclude "node_modules" **/*.js **/*.js.map **/*.d.ts **/*.d.ts.map **/*.tsbuildinfo **/*.ttf | |
- name: Upload compilation results | |
uses: actions/upload-artifact@v4 | |
with: | |
name: compilation-results | |
path: compilation-results.tar.gz | |
tests: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/[email protected] | |
with: | |
node-version: "18" | |
- name: Install system dependencies | |
run: sudo apt update && sudo apt-get -y install libusb-1.0-0-dev libasound2-dev libudev-dev | |
- name: Install nodejs dependencies | |
run: npm ci | |
- name: Run tests | |
run: npm run coverage -- --verbose | |
nodecg: | |
# This test runs with the current version of NodeCG as defined by the | |
# nodecg-cli. It checks if all bundles (only core, services, samples) | |
# are mounted by NodeCG. It will fail if one of them is not mounted. | |
# You may check for other NodeCG runtime errors in the output (these | |
# may not fail the run). | |
strategy: | |
matrix: | |
os: [ubuntu-22.04, ubuntu-20.04, windows-2019] | |
runs-on: ${{ matrix.os }} | |
continue-on-error: true | |
steps: | |
- uses: actions/[email protected] | |
with: | |
node-version: "18" | |
- name: Download NodeCG | |
uses: actions/checkout@v4 | |
with: | |
repository: nodecg/nodecg | |
- name: Get NodeCG commit hash | |
id: nodecgHash | |
shell: bash | |
run: echo "NODECG_HASH=$(git rev-parse HEAD)" >> $GITHUB_ENV | |
- name: Cache NodeCG dependencies | |
id: cache-nodecg-deps | |
uses: actions/cache@v4 | |
with: | |
path: "node_modules" | |
key: ${{ runner.os }}-${{ env.NODECG_HASH }}-nodecg-deps | |
- name: Cache NodeCG compilation outputs | |
id: cache-nodecg-build | |
uses: actions/cache@v4 | |
with: | |
path: "build" | |
key: ${{ runner.os }}-${{ env.NODECG_HASH }}-nodecg-build | |
- name: Install NodeCG dependencies | |
# Only get dependencies if we didn't get them from the cache | |
if: steps.cache-nodecg-deps.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Build NodeCG | |
# Only build NodeCG if we didn't have cached compilation results | |
if: steps.cache-nodecg-build.outputs.cache-hit != 'true' | |
run: npm run build | |
- name: Setup NodeCG config linux | |
if: (matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-20.04') | |
run: | | |
mkdir cfg | |
echo '{"bundles": {"paths": ["'${GITHUB_WORKSPACE}'/nodecg-io","'${GITHUB_WORKSPACE}'/nodecg-io/services","'${GITHUB_WORKSPACE}'/nodecg-io/samples"]}}' > ./cfg/nodecg.json | |
- name: Setup NodeCG config windows | |
if: matrix.os == 'windows-2019' | |
shell: bash | |
run: | | |
mkdir cfg | |
# We need to escape backslashes to get valid json. Replaces each "\" with "\\" | |
echo '{"bundles": {"paths": ["'${GITHUB_WORKSPACE//\\/\\\\}'\\nodecg-io","'${GITHUB_WORKSPACE//\\/\\\\}'\\nodecg-io\\services","'${GITHUB_WORKSPACE//\\/\\\\}'\\nodecg-io\\samples"]}}' > ./cfg/nodecg.json | |
- uses: actions/checkout@v4 | |
with: | |
path: "nodecg-io" | |
- name: Install system dependencies | |
if: (matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-20.04') | |
run: sudo apt update && sudo apt-get -y install libusb-1.0-0-dev libasound2-dev libudev-dev | |
- name: Temp patch \#1030 (ubuntu 22.04) – Removing midi services / samples | |
working-directory: ./nodecg-io | |
if: matrix.os == 'ubuntu-22.04' | |
run: | | |
sudo rm -rf ./services/nodecg-io-midi-* | |
sudo rm -rf ./samples/midi-* | |
- name: Install node native development files | |
shell: bash | |
run: npx node-gyp install | |
- name: Install nodejs dependencies | |
run: npm ci | |
working-directory: ./nodecg-io | |
- name: Build Typescript | |
run: npm run build | |
working-directory: ./nodecg-io | |
# Under linux we need to run the test as the root user because | |
# the midi service requires access to audio devices. | |
# By default the GitHub Actions user is not in the `audio` group and therefore | |
# has no access. Either we need to run as root to get access or need to add the user | |
# to the `audio` group which doesn't work for us, as it would only take affect on next login, | |
# but we cannot logout and login in CI. | |
- name: Run test (ubuntu) | |
if: (matrix.os == 'ubuntu-22.04' || matrix.os == 'ubuntu-20.04') | |
run: sudo node .scripts/ci-nodecg-integration.mjs | |
working-directory: ./nodecg-io | |
- name: Run test (windows) | |
if: matrix.os == 'windows-2019' | |
shell: bash | |
run: node .scripts/ci-nodecg-integration.mjs | |
working-directory: ./nodecg-io | |
publish: | |
runs-on: ubuntu-latest | |
name: Publish compilation results | |
# Don't run this in forks. This pushes to our separate repository that external contributors don't have access to. | |
# We also only want to publish if we have pushed a branch, not on a pull request. Otherwise we would publish everything twice. | |
if: startsWith(github.repository, 'codeoverflow-org') && github.actor != 'dependabot[bot]' && github.event_name != 'pull_request' && github.ref_type != 'tag' | |
# Only publish anything if we're sure this version compiles (obviously) and all tests pass. | |
needs: | |
- build | |
- tests | |
- nodecg | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/[email protected] | |
with: | |
node-version: "18" | |
- name: Download compilation results # From the build step | |
uses: actions/download-artifact@v4 | |
with: | |
name: compilation-results | |
- name: Extract compilation results | |
run: tar xvf compilation-results.tar.gz | |
# All twitch services depend on the utility package `nodecg-io-twitch-auth`. | |
# In the repository the services depend on the latest development version which is not yet published. | |
# If someone installs the service using the published tarball npm would try to get the | |
# unpublished version of twitch-auth from the npm registry which is not possible. | |
# To fix this we update the version of the twitch-auth package in all usages | |
# to also reference the published tarball. | |
- name: Patch twitch-auth dependency to use published current tarball | |
run: | | |
# Get current version as it is needed for the tarball file name | |
TWITCH_AUTH_VERSION=$(cat utils/nodecg-io-twitch-auth/package.json | jq .version -r) | |
# Find usages in all package.json files and replace with the corresponding tarball url | |
find . -name 'package.json' -exec grep -q -E '"nodecg-io-twitch-auth": ".+"' {} \; -print # Print found files for debug purposes | |
find . -name 'package.json' -exec grep -q -E '"nodecg-io-twitch-auth": ".+"' {} \; -print0 | \ | |
xargs -0 sed -i "s/\"nodecg-io-twitch-auth\": \".*\"/\"nodecg-io-twitch-auth\": \"https:\/\/codeoverflow-org.github.io\/nodecg-io-publish\/nodecg-io-twitch-auth-${TWITCH_AUTH_VERSION}.tgz\"/g" | |
- name: Create npm tarballs | |
run: npm pack --workspaces | |
- name: Clone publish repository | |
uses: actions/checkout@v4 | |
with: | |
repository: codeoverflow-org/nodecg-io-publish | |
ssh-key: ${{ secrets.PUBLISH_SSH_KEY }} | |
path: publish | |
- name: Checkout branch in publish repository | |
working-directory: publish | |
# Create a local branch with the same name as in the nodecg-io repository | |
# If the branch already exists on the remote we set the upstream to it, | |
# if not we push the branch and set the upstream to it as well. | |
run: | | |
git fetch | |
git switch ${GITHUB_REF##refs/heads/} || (git checkout -b ${GITHUB_REF##refs/heads/} && git push -u origin ${GITHUB_REF##refs/heads/}) | |
- name: Clear publish directory | |
run: rm -rf publish/* | |
- name: Copy tarballs into publish directory | |
run: cp *.tgz publish | |
- name: Extract tarballs | |
working-directory: publish | |
run: | | |
for tarPath in $(ls *.tgz); do | |
tar xf $tarPath package; | |
dirname=$(echo "$tarPath" | sed "s/-[0-9]\+\.[0-9]\+\.[0-9]\+\.tgz//"); # Strip away tgz extension and version | |
mv package $dirname; | |
done; | |
- name: Publish | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
commit_message: Publish codeoverflow-org/nodecg-io@${{ github.sha }} | |
commit_user_name: codeoverflow-org | |
commit_user_email: "" | |
commit_author: codeoverflow-org <> | |
repository: publish |