This repository was archived by the owner on Nov 5, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
177 lines (148 loc) · 4.69 KB
/
release.yml
File metadata and controls
177 lines (148 loc) · 4.69 KB
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
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
name: release
on:
push:
tags:
- 'v*'
defaults:
run:
shell: bash
jobs:
build-lib:
name: build lib file (target = ${{ matrix.build.target }})
runs-on: ${{ matrix.build.os }}
env:
BUILD_ENV: release
TARGET: ${{ matrix.build.target }}
CC: ${{ matrix.build.cc }}
AR: ${{ matrix.build.ar }}
strategy:
fail-fast: false
matrix:
build:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
cc: clang-12
ar: llvm-ar-12
zig: false
lib_file: libruby_parser_c.a
output_artifact_name: libruby_parser_c-x86_64-unknown-linux-gnu.a
- os: macos-latest
target: x86_64-apple-darwin
cc: clang
ar: ar
zig: false
lib_file: libruby_parser_c.a
output_artifact_name: libruby_parser_c-x86_64-apple-darwin.a
- os: macos-latest
target: aarch64-apple-darwin
cc: zig cc --target=aarch64-macos
ar: ar
zig: true
lib_file: libruby_parser_c.a
output_artifact_name: libruby_parser_c-aarch64-apple-darwin.a
- os: windows-latest
target: x86_64-pc-windows-msvc
cc: cl.exe
zig: false
lib_file: libruby_parser_c.lib
output_artifact_name: libruby_parser_c-x86_64-pc-windows-msvc.lib
- os: windows-latest
target: x86_64-pc-windows-gnu
cc: gcc
ar: ar
zig: false
lib_file: libruby_parser_c.a
output_artifact_name: libruby_parser_c-x86_64-pc-windows-gnu.a
steps:
- name: setup msvc on windows
if: runner.os == 'Windows'
uses: ilammy/msvc-dev-cmd@v1
- name: install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.build.target }}
override: true
- name: print system info
run: |
rustc --version --verbose
which make
make --version
which bash
bash --version
- name: checkout
uses: actions/checkout@v2
- name: fix link.exe on windows
if: runner.os == 'Windows'
run: rm "C:\\Program Files\\Git\\usr\\bin\\link.exe"
- name: install zig
uses: goto-bus-stop/setup-zig@v2
if: ${{ matrix.build.zig }}
- name: install cargo-zigbuild
run: cargo install cargo-zigbuild
if: ${{ matrix.build.zig }}
- name: codegen
run: make do-codegen
- name: make lib file
run: |
make ${{ matrix.build.lib_file }}
cp ${{ matrix.build.lib_file }} ${{ matrix.build.output_artifact_name }}
- name: upload ${{ matrix.build.output_artifact_name }}
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.build.output_artifact_name }}
path: ${{ matrix.build.output_artifact_name }}
build-header:
name: build header file
runs-on: ubuntu-latest
env:
TARGET: x86_64-unknown-linux-gnu
steps:
- name: install rust
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
override: true
- name: checkout
uses: actions/checkout@v2
- name: build lib-ruby-parser.h
run: make lib-ruby-parser.h
- name: upload lib-ruby-parser.h
uses: actions/upload-artifact@v2
with:
name: lib-ruby-parser.h
path: lib-ruby-parser.h
make-release:
name: release
needs:
- 'build-lib'
- 'build-header'
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@v2
# lib files
- uses: actions/download-artifact@v2
with: { name: libruby_parser_c-x86_64-unknown-linux-gnu.a }
- uses: actions/download-artifact@v2
with: { name: libruby_parser_c-x86_64-apple-darwin.a }
- uses: actions/download-artifact@v2
with: { name: libruby_parser_c-aarch64-apple-darwin.a }
- uses: actions/download-artifact@v2
with: { name: libruby_parser_c-x86_64-pc-windows-msvc.lib }
- uses: actions/download-artifact@v2
with: { name: libruby_parser_c-x86_64-pc-windows-gnu.a }
# header file
- uses: actions/download-artifact@v2
with: { name: lib-ruby-parser.h }
- name: show artifacts
run: ls -l
- name: release
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifactErrorsFailBuild: true
artifacts: "libruby_parser_c-*,lib-ruby-parser.h"
token: ${{ secrets.GITHUB_TOKEN }}