-
Notifications
You must be signed in to change notification settings - Fork 5
135 lines (133 loc) · 4.42 KB
/
quickjs-build.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
name: QuickJS Build Matrix
on: [push, pull_request, release]
jobs:
build:
name: ${{ matrix.config.name }}
runs-on: ${{ matrix.config.os }}
strategy:
fail-fast: false
matrix:
config:
- {
name: "Windows",
os: "windows-latest",
artifact: "qjs-windows",
build_type: "Release",
generator: "MinGW Makefiles",
archiver: "7z"
}
- {
name: "Ubuntu 20.04",
os: "ubuntu-20.04",
artifact: "qjs-ubuntu-20_04",
build_type: "Release",
generator: "Unix Makefiles",
archiver: "7z"
}
- {
name: "Linux arm64",
os: "ubuntu-20.04",
artifact: "qjs-linux-arm64",
build_type: "Release",
generator: "Unix Makefiles",
cmake_extra: "-DCMAKE_TOOLCHAIN_FILE=./toolchains/linux_aarch64.cmake",
archiver: "7z"
}
- {
name: "Ubuntu 18.04",
os: "ubuntu-18.04",
artifact: "qjs-ubuntu-18_04",
build_type: "Release",
generator: "Unix Makefiles",
cmake_extra: "",
archiver: "7z"
}
- {
name: "macOS",
os: "macos-latest",
artifact: "qjs-macOS",
build_type: "Release",
generator: "Unix Makefiles",
cmake_extra: "",
archiver: "7z"
}
steps:
- uses: actions/checkout@v2
- name: Print environment
run: |
echo "Name: ${{ matrix.config.name }}"
echo "OS: ${{ matrix.config.os }}"
echo "Generator: ${{ matrix.config.generator }}"
echo "Archiver: ${{ matrix.config.archiver }}"
echo "Artifact: ${{ matrix.config.artifact }}"
- name: Install dependencies on Windows
if: startsWith(matrix.config.os, 'windows')
run: |
echo "Install for windows ..."
cmake --version
${{ matrix.config.archiver }}
- name: Install dependencies on Linux
if: startsWith(matrix.config.os, 'ubuntu')
run: |
echo "Install for Linux ..."
sudo apt-get update
sudo apt-get install build-essential -y
sudo apt-get install g++-aarch64-linux-gnu qemu qemu-user -y
sudo apt-get install p7zip-full -y
gcc --version
cmake --version
make --version
- name: Install dependencies on macOS
if: startsWith(matrix.config.os, 'macos')
run: |
echo "Install for macOs ..."
brew install p7zip cmake
cmake --version
make --version
- name: Configure on Unix system
if: startsWith(matrix.config.os, 'macos') || startsWith(matrix.config.os, 'ubuntu')
shell: bash
run: |
mkdir ./build
cmake \
-DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} \
${{ matrix.config.cmake_extra }} \
-G "${{ matrix.config.generator }}" \
-S ./ \
-B ./build
- name: Configure on Windows
if: startsWith(matrix.config.os, 'windows')
shell: cmd
run: |
mkdir ./build
setx PATH "%PATH%;C:\msys64\mingw64\bin"
cmake -G "${{ matrix.config.generator }}" -DCMAKE_BUILD_TYPE=${{ matrix.config.build_type }} -S ./ -B ./build
- name: Build
shell: bash
run: cmake --build ./build --config ${{ matrix.config.build_type }}
- name: "Prepare"
shell: bash
run: |
mkdir ./qjs
cp ./build/libqjs.a ./qjs/libqjs.a
cp ./build/qjsc ./qjs/qjsc
cp ./build/quickjs ./qjs/quickjs
cp ./build/run-test262 ./qjs/run-test262
cp -R ./include ./qjs/include
cd ./qjs
${{ matrix.config.archiver }} a -tzip ../${{ matrix.config.artifact }}.zip .
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
path: ./${{ matrix.config.artifact }}.zip
name: ${{ matrix.config.artifact }}
- name: Release
if: github.event_name == 'release' && (github.event.action == 'published')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: ./${{ matrix.config.artifact }}.zip
asset_name: ${{ matrix.config.artifact }}.zip
asset_content_type: application/zip