Skip to content

Commit

Permalink
Merge branch 'next'
Browse files Browse the repository at this point in the history
  • Loading branch information
derevnjuk committed Oct 11, 2023
2 parents 19f53a6 + 50a8604 commit 26ed9cb
Show file tree
Hide file tree
Showing 73 changed files with 7,163 additions and 2,106 deletions.
6 changes: 1 addition & 5 deletions .github/workflows/auto-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
strategy:
fail-fast: false
matrix:
target: [ 'lint', 'format', 'test:unit', 'test:e2e' ]
target: [ 'lint', 'format', 'test:unit' ]
steps:
- name: Checkout
uses: actions/checkout@v3
Expand All @@ -37,9 +37,5 @@ jobs:
- name: Install deps
uses: ./.github/workflows/composite/npm

- name: Compute arguments
if: matrix.target == 'test:e2e'
run: echo "JEST_ARGUMENTS=--testTimeout 4000" >> $GITHUB_ENV

- name: Execute ${{ matrix.target }} npm script
run: npm run ${{ matrix.target }} -- $JEST_ARGUMENTS
7 changes: 6 additions & 1 deletion .github/workflows/composite/npm/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ inputs:
description: 'Node.JS version'
required: false
default: "18"
cache:
description: 'Cache'
required: false
default: "npm"


runs:
using: 'composite'
Expand All @@ -21,7 +26,7 @@ runs:
uses: actions/setup-node@v3
with:
node-version: ${{ inputs.version }}
cache: 'npm'
cache: ${{ inputs.cache }}
registry-url: ${{ inputs.registry }}
scope: ${{ inputs.scope }}

Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/composite/todoapp/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: 'TODO App'
description: 'Runs TODO App'

outputs:
port:
description: "Target port"
value: "9000"
cmd:
description: "Command to run the target"
value: ${{ steps.download.outputs.cmd }}

runs:
using: 'composite'
steps:
- name: Download Executable
id: download
shell: bash
run: |
if [ "$RUNNER_OS" == "Linux" ]; then
EXECUTABLE=todoapp-linux-x64
CMD=./$EXECUTABLE
elif [ "$RUNNER_OS" == "Windows" ]; then
EXECUTABLE=todoapp-windows-x64.exe
CMD=.\\$EXECUTABLE
elif [ "$RUNNER_OS" == "macOS" ]; then
EXECUTABLE=todoapp-darwin-x64
CMD=./$EXECUTABLE
fi
curl -fsSL https://github.com/NeuraLegion/go-todoapp-demo/releases/latest/download/$EXECUTABLE > ./$EXECUTABLE
chmod +x ./$EXECUTABLE
echo "cmd=$CMD" >> "$GITHUB_OUTPUT"
59 changes: 24 additions & 35 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,9 @@ jobs:
- name: Install deps
uses: ./.github/workflows/composite/npm

- name: Set default distribution
run: npm pkg set brightCli.distribution=package

- name: Build package
run: npm run build

Expand Down Expand Up @@ -63,18 +66,20 @@ jobs:
strategy:
matrix:
include:
- os: windows-2022
- os: windows-2019
target: win
node: 18
- os: macos-latest
- os: macos-11
target: macos
node: 18
# Using the `ubuntu-18.04` runner instead of latest (i.e. `ubuntu-22.04`)
# because G++/GCC 4.8 is not in an official repository yet.
- os: ubuntu-22.04
# Using the `centos7-devtoolset7` runner instead of latest (i.e. `ubuntu-20.04`)
# with gcc 7 but glibc 2.17, so binaries are compatible for Ubuntu 14.04 and Debian 8.
- os: ubuntu-20.04
target: linux
container: ubuntu:18.04
node: 14
container:
image: centos/devtoolset-7-toolchain-centos7:7
options: "--user root"
runs-on: ${{ matrix.os }}
container: ${{ matrix.container }}
steps:
Expand All @@ -90,46 +95,25 @@ jobs:
- name: Install dev-deps
if: startsWith(matrix.os, 'ubuntu')
run: |
apt-get update -yq \
&& apt-get install build-essential python python-dev python3-pip g++-4.8 gcc-4.8 -yq \
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
- name: Configures aliases to GCC/G++
if: startsWith(matrix.os, 'ubuntu')
run: |
update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.8 10 \
--slave /usr/bin/g++ g++ /usr/bin/g++-4.8 \
--slave /usr/bin/gcov gcov /usr/bin/gcov-4.8
yum install build-essential python3 -y \
&& yum clean all -y \
&& rm -rf /var/cache/yum
- name: Install deps
uses: ./.github/workflows/composite/npm
with:
version: ${{ matrix.node }}

- name: Set distribution
run: npx json -I -f package.json -e "this.brightCli.distribution='${{ matrix.target }}-executable'"

- name: Build executable file
run: npm run build:pkg -- -t node${{ matrix.node }}-${{ matrix.target }}-x64

- name: Copy deps
if: startsWith(matrix.os, 'win')
run: |
Copy-Item ".\node_modules\@neuralegion\os-service\build\Release\service.node" -Destination ".\bin\service.node"
Copy-Item ".\node_modules\win-ca\lib\crypt32-ia32.node" -Destination ".\bin\crypt32-ia32.node"
Copy-Item ".\node_modules\win-ca\lib\crypt32-x64.node" -Destination ".\bin\crypt32-x64.node"
Copy-Item ".\node_modules\win-ca\lib\roots.exe" -Destination ".\bin\roots.exe"
Copy-Item ".\node_modules\raw-socket\build\Release\raw.node" -Destination ".\bin\raw.node"
- name: Install WIX
if: startsWith(matrix.os, 'win')
run: |
curl -OLS https://github.com/wixtoolset/wix3/releases/download/wix3111rtm/wix311.exe
.\wix311.exe /install /quiet /norestart
- name: Build MSI
if: startsWith(matrix.os, 'win')
run: .\tools\msi\build.ps1
run: .\tools\scripts\build-msi.ps1
shell: pwsh
continue-on-error: true

- uses: svenstaro/upload-release-action@v2
with:
Expand Down Expand Up @@ -174,14 +158,19 @@ jobs:
exit 1
fi
- name: Set NPM distribution
run: npm pkg set brightCli.distribution=npm

- run: npm publish --tag $TAG
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

# The scope does not align with the package name
# FIXME: once GitHub organization name has been changed, we should prevent this behavior
- name: Prepare GPR package
run: npm pkg set name='@neuralegion/bright-cli'
run: |
npm pkg set name='@neuralegion/bright-cli' \
&& npm pkg set brightCli.distribution=gpr
- name: Setup node
uses: ./.github/workflows/composite/npm
Expand Down
Loading

0 comments on commit 26ed9cb

Please sign in to comment.