-
Notifications
You must be signed in to change notification settings - Fork 2
134 lines (117 loc) · 3.84 KB
/
ci.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
name: "build"
on:
push:
branches:
- release
jobs:
draft_release:
name: Create Release
runs-on: ubuntu-latest
outputs:
upload_url: ${{ steps.create_release.outputs.upload_url }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
body: |
🚀 This release contains necessary binaries to install over-the-wire on different platforms. See README.md of this repo for more details.
draft: true
prerelease: false
build:
needs: [draft_release]
name: "Build"
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Install coreutils for macOS
if: matrix.os == 'macos-latest'
run: brew install coreutils
- name: Install Zip
if: matrix.os == 'windows-latest'
run: choco install zip
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install libpcap on Ubuntu
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update
sudo apt-get install -y libpcap-dev
- name: Install libpcap on macOS
if: matrix.os == 'macos-latest'
run: |
brew update
brew install libpcap
- name: Install npcap on Windows
if: matrix.os == 'windows-latest'
run: |
choco install wget --no-progress
mkdir -p build/Release/npcap
wget "https://npcap.com/dist/npcap-sdk-1.13.zip"
unzip npcap-sdk-1.13.zip -d build/Release/npcap
shell: bash
- name: Install npcap on Windows (step 2)
if: matrix.os == 'windows-latest'
run: |
set NPCAP_FILE=npcap-0.96.exe
curl -L https://npcap.com/dist/%NPCAP_FILE% --output %NPCAP_FILE%
%NPCAP_FILE% /S /winpcap_mode
xcopy C:\Windows\System32\Npcap\*.dll C:\Windows\System32
xcopy C:\Windows\SysWOW64\Npcap\*.dll C:\Windows\SysWOW64
shell: cmd
- name: Submodule update
run: git submodule update --init --recursive
shell: bash
- name: Build and Test (Windows)
if: matrix.os == 'windows-latest'
run: |
ls "$(pwd)/build/Release/npcap"
PCAP_ROOT="$(pwd)/build/Release/npcap" npm i
PCAP_ROOT="$(pwd)/build/Release/npcap" npm run build
node --test test/liveDevice.test.js test/arpTable.test.js test/routing.test.js
shell: bash
- name: Build and Test
if: matrix.os != 'windows-latest'
run: |
npm i
npm run build
npm run test
shell: bash
- name: Prebuild (Windows)
if: matrix.os == 'windows-latest'
run: |
PCAP_ROOT="$(pwd)/build/Release/npcap" npm run precompile
ls prebuilds
zip -r prebuilds-${{ matrix.os }}.zip prebuilds
shell: bash
- name: Prebuild
if: matrix.os != 'windows-latest'
run: |
npm run precompile
ls prebuilds
zip -r prebuilds-${{ matrix.os }}.zip prebuilds
shell: bash
- name: ls
run: ls
shell: bash
- name: Upload
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ needs.draft_release.outputs.upload_url }}
asset_path: prebuilds-${{ matrix.os }}.zip
asset_name: prebuilds-${{ matrix.os }}.zip
asset_content_type: application/zip