-
Notifications
You must be signed in to change notification settings - Fork 9
137 lines (119 loc) · 3.69 KB
/
build_libnode.yml
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
135
136
137
name: Build libnode
on:
workflow_dispatch:
inputs:
nodeVersion:
description: "Node.js version"
required: true
env:
LIBNODE_NODE_VERSION: ${{ github.event.inputs.nodeVersion }}
jobs:
build:
strategy:
fail-fast: false
matrix:
os: [macos-11, windows-2019, ubuntu-18.04]
arch: [x86, x64, arm64]
small_icu: [0, 1]
exclude:
- os: macos-11
arch: x86
- os: ubuntu-18.04
arch: x86
- os: windows-2019
arch: arm64
- os: ubuntu-18.04
arch: arm64
runs-on: ${{ matrix.os }}
env:
LIBNODE_ARCH: ${{ matrix.arch }}
LIBNODE_SMALL_ICU: ${{ matrix.small_icu }}
defaults:
run:
working-directory: libnode
steps:
- name: Checkout code
uses: actions/checkout@v2
- uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install nasm on Windows
run: choco install -y nasm
if: runner.os == 'Windows'
- name: Install rust target
shell: bash
run: rustup target add `python -m scripts.config`
- name: Install LLVM on Windows
run: |
C:\\msys64\\usr\\bin\\bash.exe -lc "pacman --noconfirm -R mingw-w64-x86_64-clang-tools-extra mingw-w64-x86_64-clang"
choco install -y llvm
if: runner.os == 'Windows'
- name: Install GNU patch on Windows
run: choco install -y patch
if: runner.os == 'Windows'
- name: Install rust-bindgen
run: cargo install bindgen
- name: Download source code of Node.js
run: python -m scripts.download
- name: Patch source code of Node.js
run: python -m scripts.patch
- name: Build
shell: bash
run: |
if [[ "$OSTYPE" == "linux-gnu"* ]]; then
export CC=gcc-9
export CXX=g++-9
fi
python -m scripts.build
- uses: ilammy/msvc-dev-cmd@v1
- name: Postprocess
run: python -m scripts.postproc
- name: Cleanup
shell: bash
run: rm -rf node-*
- name: Archive
run: |
zipname=$(python -m scripts.archive)
echo "::set-output name=zipname::$zipname"
shell: bash
id: archive
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ steps.archive.outputs.zipname }}
path: libnode/${{ steps.archive.outputs.zipname }}
- name: Test
run: python -m scripts.test
gh_release:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download artifacts
uses: actions/download-artifact@v2
with:
path: ${{ runner.temp }}
- name: Compute checksums
working-directory: ${{ runner.temp }}
run: |
mkdir zips
mv ./*/*.zip ./zips
cd zips
echo '## SHA256 Checksums' > ../release_notes.md
echo '```' >> ../release_notes.md
sha256sum --binary *.zip >> ../release_notes.md
echo '```' >> ../release_notes.md
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: "libnode-${{ env.LIBNODE_NODE_VERSION }}"
release_name: "libnode-${{ env.LIBNODE_NODE_VERSION }}"
body_path: ${{ runner.temp }}/release_notes.md
- name: Upload release assets
uses: csexton/release-asset-action@v2
with:
pattern: ${{ runner.temp }}/zips/*.zip
github-token: ${{ secrets.GITHUB_TOKEN }}
release-url: ${{ steps.create_release.outputs.upload_url }}