Skip to content

Commit

Permalink
update CI
Browse files Browse the repository at this point in the history
Signed-off-by: Matheus Sampaio Queiroga <srherobrine20@gmail.com>
  • Loading branch information
Sirherobrine23 committed Aug 21, 2023
1 parent b4b1985 commit 43e8ba5
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 15 deletions.
34 changes: 20 additions & 14 deletions .github/workflows/testProject.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,19 +11,13 @@ jobs:
test:
strategy:
matrix:
os:
- ubuntu
- windows
- macos
node_version:
- 16.x
- 18.x
node_version: [ 16.x, 17.x, 18.x, 19.x ]
os: [ ubuntu, macos ]
runs-on: ${{ matrix.os }}-latest
name: "Test on ${{ matrix.os }} with Node ${{ matrix.node_version }}"
steps:
- uses: actions/checkout@v3
name: Checkout
with:
submodules: true

- uses: actions/setup-node@v3
name: Setup Node.js
Expand All @@ -33,16 +27,29 @@ jobs:
- name: Install dependencies
run: |
npm install --no-save
${{ matrix.os == 'ubuntu' && 'sudo' || '' }} npm install -g ts-node typescript mocha
sudo npm install -g ts-node typescript mocha
- name: Setup Go environment
if: matrix.os == 'macos'
uses: actions/setup-go@v4.1.0

- name: "Start wireguard interface (MacOS)"
if: matrix.os == 'macos'
run: |
cd ..
git clone https://git.zx2c4.com/wireguard-go
cd wireguard-go
echo "WG_INETRFACE=utun15" >> $GITHUB_ENV
go build -v -o "wireguard-go"
sudo ./wireguard-go utun15
- name: Test
run: |
tsc --build --clean
tsc --build
${{ matrix.os == 'ubuntu' && 'sudo' || '' }} mocha 'tests/**'
sudo -E mocha 'tests/**'
- name: Upload generate interface
if: matrix.os == 'ubuntu'
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.os }}_${{ matrix.node_version }}
Expand Down Expand Up @@ -70,7 +77,7 @@ jobs:
registry-url: https://registry.npmjs.org/

- run: npm install --no-save --ignore-scripts
- run: node scripts/build.mjs build --auto -v
- run: npm run prebuildify -- -v

- name: Upload generate interface
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -107,7 +114,6 @@ jobs:
uses: actions/download-artifact@v3
with:
path: ./prebuilds
name:

- run: npm install --no-save
- run: npm pack
Expand Down
2 changes: 1 addition & 1 deletion tests/interfaces.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@ import * as Bridge from "../src/mergeSets";
import * as utils from "../src/utils/index";
import { randomInt } from "crypto";

const interfaceName = (process.platform === "darwin" ? "utun" : "shtest").concat(String(randomInt(20, 1023)));
// Make base config
const interfaceName = String(((process.env.WG_INETRFACE||"").length > 0) ? process.env.WG_INETRFACE : (process.platform === "darwin" ? "utun" : "shtest").concat(String(randomInt(20, 1023))));
const deviceConfig: Bridge.wireguardInterface = {
portListen: randomInt(1024, 65535),
privateKey: utils.genPrivateKey(),
Expand Down

0 comments on commit 43e8ba5

Please sign in to comment.