Skip to content

Commit 0da49f1

Browse files
authored
Merge pull request #7 from labjack/dev/refactor-ci
Dev/refactor ci
2 parents 4d4e744 + 34eeed3 commit 0da49f1

3 files changed

Lines changed: 105 additions & 21 deletions

File tree

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
name: Build release binaries
2+
3+
on:
4+
release:
5+
types: [created]
6+
7+
jobs:
8+
build:
9+
10+
strategy:
11+
matrix:
12+
node-version: [8.9.4]
13+
platform: [ubuntu-16.04, macos-latest, windows-latest]
14+
15+
runs-on: ${{ matrix.platform }}
16+
17+
steps:
18+
- run: echo "${{ github.event.release.tag_name }}"
19+
- uses: actions/checkout@v2
20+
with:
21+
ref: ${{ github.event.release.tag_name }}
22+
23+
- name: get-npm-version
24+
id: package-version
25+
uses: pchynoweth/action-get-npm-version@master
26+
27+
- name: Validate version
28+
run: echo "Wrong tag"
29+
if: ${{ github.event.release.tag_name != format('{0}{1}', 'v', steps.package-version.outputs.version) }}
30+
31+
- name: Get current date
32+
uses: 1466587594/get-current-time@v2
33+
id: date
34+
with:
35+
format: YYYY_MM_DD
36+
utcOffset: "+08:00"
37+
- name: Download ljm
38+
if: ${{ matrix.platform == 'ubuntu-16.04' }}
39+
uses: wei/wget@v1
40+
with:
41+
args: -O labjack_ljm_software.tar.gz https://labjack.com/sites/default/files/software/labjack_ljm_software_2019_07_16_x86_64.tar.gz
42+
- name: Install ljm
43+
if: ${{ matrix.platform == 'ubuntu-16.04' }}
44+
run: tar xfz labjack_ljm_software.tar.gz && cd ./labjack_ljm_software_2019_07_16_x86_64 && sudo ./labjack_ljm_installer.run
45+
- uses: actions/checkout@v2
46+
- name: Use Node.js ${{ matrix.node-version }}
47+
uses: actions/setup-node@v1
48+
with:
49+
node-version: ${{ matrix.node-version }}
50+
# - run: npm ci # doesn't work with node8
51+
- run: npm install --global node-gyp@latest
52+
- run: npm install --global --production windows-build-tools --vs2015
53+
if: ${{ matrix.platform == 'windows-latest' }}
54+
- run: npm install
55+
- run: npm config set msvs_version 2015
56+
- run: npm run setup
57+
- name: Fix lerna mess
58+
run: node ./scripts/fix_lerna_backup.js
59+
- run: OVERRIDE_BUILD_DATE=${{ steps.date.outputs.formattedTime }} npm run build
60+
- run: SKIP_HARDWARE_TEST=true npm run test
61+
if: ${{ matrix.platform == 'ubuntu-16.04' }}
62+
63+
- name: Upload Release Asset
64+
uses: actions/upload-release-asset@v1
65+
env:
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
with:
68+
upload_url: ${{ github.event.release.upload_url }}
69+
asset_path: ljswitchboard-builder/kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_linux64.tar.gz
70+
asset_name: kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_linux64.tar.gz
71+
asset_content_type: application/zip
72+
if: ${{ matrix.platform == 'ubuntu-16.04' }}
73+
74+
- name: Upload Release Asset
75+
uses: actions/upload-release-asset@v1
76+
env:
77+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78+
with:
79+
upload_url: ${{ github.event.release.upload_url }}
80+
asset_path: ljswitchboard-builder/kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_win64.zip
81+
asset_name: kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_win64.tar.gz
82+
asset_content_type: application/zip
83+
if: ${{ matrix.platform == 'windows-latest' }}
84+
85+
- name: Upload Release Asset
86+
uses: actions/upload-release-asset@v1
87+
env:
88+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89+
with:
90+
upload_url: ${{ github.event.release.upload_url }}
91+
asset_path: ljswitchboard-builder/kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_mac64.zip
92+
asset_name: kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_mac64.tar.gz
93+
asset_content_type: application/zip
94+
if: ${{ matrix.platform == 'macos-latest' }}
Lines changed: 7 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,15 @@ name: Node.js CI
55

66
on:
77
push:
8-
branches: [ publish-locally-ci ]
9-
pull_request:
10-
branches: [ publish-locally-ci ]
8+
branches: [ master ]
119

1210
jobs:
1311
build:
14-
12+
if: ${{ github.event.repository.full_name == 'labjack/labjack_kipling_private' }}
1513
strategy:
1614
matrix:
1715
node-version: [8.9.4]
18-
platform: [ubuntu-16.04, macos-latest, windows-latest]
16+
platform: [self-hosted]
1917

2018
runs-on: ${{ matrix.platform }}
2119

@@ -42,30 +40,18 @@ jobs:
4240
# - run: npm ci # doesn't work with node8
4341
- run: npm install --global node-gyp@latest
4442
- run: npm install --global --production windows-build-tools --vs2015
45-
if: ${{ matrix.platform == 'windows-latest' }}
43+
if: ${{ matrix.platform == 'self-hosted' }}
4644
- run: npm install
4745
- run: npm config set msvs_version 2015
4846
- run: npm run setup
4947
- name: Fix lerna mess
5048
run: node ./scripts/fix_lerna_backup.js
5149
- run: npm run build
52-
- run: SKIP_HARDWARE_TEST=true npm run test
53-
if: ${{ matrix.platform == 'ubuntu-16.04' }}
50+
- run: npm run test
51+
if: ${{ matrix.platform == 'self-hosted' }}
5452

55-
- run: ls ./ljswitchboard-builder
56-
57-
- uses: actions/upload-artifact@v2
58-
with:
59-
name: kipling.3.1.18.${{ steps.date.outputs.date }}_linux64.tar.gz
60-
path: ljswitchboard-builder/kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_linux64.tar.gz
61-
if: ${{ matrix.platform == 'ubuntu-16.04' }}
6253
- uses: actions/upload-artifact@v2
6354
with:
6455
name: kipling.3.1.18.${{ steps.date.outputs.date }}_windows.zip
6556
path: ljswitchboard-builder/kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_win64.zip
66-
if: ${{ matrix.platform == 'windows-latest' }}
67-
- uses: actions/upload-artifact@v2
68-
with:
69-
name: kipling.3.1.18.${{ steps.date.outputs.date }}_macos.zip
70-
path: ljswitchboard-builder/kipling.3.1.18.${{ steps.date.outputs.formattedTime }}_mac64.zip
71-
if: ${{ matrix.platform == 'macos-latest' }}
57+
if: ${{ matrix.platform == 'self-hosted' }}

ljswitchboard-builder/build_scripts/compress_output.js

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,10 @@ if(dayStr.length < 2) {
5252
}
5353
var dateStrPartial = [yearStr,monthStr,dayStr].join('_') + '_';
5454

55+
if (process.env.OVERRIDE_BUILD_DATE) {
56+
dateStrPartial =process.env.OVERRIDE_BUILD_DATE + '_';
57+
}
58+
5559
var osForOutputFileName = {
5660
'darwin': 'mac',
5761
'win32': 'win',

0 commit comments

Comments
 (0)