|
5 | 5 | - 'v*' |
6 | 6 |
|
7 | 7 | jobs: |
8 | | - create-release: |
9 | | - name: create-release |
10 | | - runs-on: ubuntu-latest |
11 | | - steps: |
12 | | - - name: get version number |
13 | | - run: | |
14 | | - echo "GITHUB_TAG=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV |
15 | | -
|
16 | | - - name: print version number |
17 | | - run: | |
18 | | - echo "tag = ${{ env.GITHUB_TAG }}" |
19 | | -
|
20 | | - - name: create release on github |
21 | | - id: create_release |
22 | | - uses: actions/create-release@v1 |
23 | | - env: |
24 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
25 | | - with: |
26 | | - tag_name: ${{ env.GITHUB_TAG }} |
27 | | - release_name: ${{ env.GITHUB_TAG }} |
28 | | - |
29 | | - - name: generate env artifact |
30 | | - run: | |
31 | | - echo "RELEASE_UPLOAD_URL=${{ steps.create_release.outputs.upload_url }}" > artifact-env |
32 | | - echo "GITHUB_TAG=$GITHUB_TAG" >> artifact-env |
33 | | -
|
34 | | - - name: save env artifact |
35 | | - uses: actions/upload-artifact@v1 |
36 | | - with: |
37 | | - name: artifact-env |
38 | | - path: artifact-env |
39 | | - |
40 | | - upload-release: |
41 | | - name: upload-release |
42 | | - needs: ['create-release'] |
| 8 | + build-lib: |
| 9 | + name: build lib file (target = ${{ matrix.build.target }}) |
43 | 10 | runs-on: ${{ matrix.build.os }} |
44 | 11 | env: |
45 | | - CARGO_BUILD_TARGET: ${{ matrix.build.target }} |
46 | | - CC: ${{ matrix.build.cc }} |
| 12 | + BUILD_ENV: release |
| 13 | + TARGET: ${{ matrix.build.target }} |
47 | 14 | CXX: ${{ matrix.build.cxx }} |
48 | 15 | LD: ${{ matrix.build.ld }} |
49 | | - CARGOFLAGS: ${{ matrix.build.cargoflags }} |
50 | | - BUILD_ENV: release |
| 16 | + AR: ${{ matrix.build.ar }} |
51 | 17 | strategy: |
52 | 18 | fail-fast: false |
53 | 19 | matrix: |
54 | 20 | build: |
55 | 21 | - os: ubuntu-latest |
56 | 22 | target: x86_64-unknown-linux-gnu |
57 | | - cc: clang-9 |
58 | | - cxx: clang++-9 |
59 | | - ld: ld.lld-9 |
60 | | - cargoflags: --features="onig" |
61 | | - output: lib-ruby-parser.a |
62 | | - upload_as: lib-ruby-parser-x86_64-unknown-linux-gnu.a |
| 23 | + cxx: clang++-12 |
| 24 | + ld: ld.lld-12 |
| 25 | + ar: llvm-ar-12 |
| 26 | + lib_file: libruby_parser_cpp.a |
| 27 | + output_artifact_name: libruby_parser_cpp-x86_64-unknown-linux-gnu.a |
63 | 28 |
|
64 | 29 | - os: macos-latest |
65 | 30 | target: x86_64-apple-darwin |
66 | | - cc: clang |
67 | 31 | cxx: clang++ |
68 | 32 | ld: ld |
69 | | - cargoflags: --features="onig" |
70 | | - output: lib-ruby-parser.a |
71 | | - upload_as: lib-ruby-parser-x86_64-apple-darwin.a |
| 33 | + ar: ar |
| 34 | + lib_file: libruby_parser_cpp.a |
| 35 | + output_artifact_name: libruby_parser_cpp-x86_64-apple-darwin.a |
72 | 36 |
|
73 | 37 | - os: windows-latest |
74 | 38 | target: x86_64-pc-windows-msvc |
75 | | - cc: cl.exe |
76 | 39 | cxx: cl.exe |
77 | 40 | ld: link.exe |
78 | | - cargoflags: "" |
79 | | - output: lib-ruby-parser.lib |
80 | | - upload_as: lib-ruby-parser-x86_64-pc-windows-msvc.lib |
| 41 | + lib_file: libruby_parser_cpp.lib |
| 42 | + output_artifact_name: libruby_parser_cpp-x86_64-pc-windows-msvc.lib |
81 | 43 |
|
82 | 44 | steps: |
83 | 45 | - name: setup msvc on windows |
84 | 46 | if: runner.os == 'Windows' |
85 | 47 | uses: ilammy/msvc-dev-cmd@v1 |
86 | 48 |
|
87 | | - - name: fix linker on windows |
88 | | - if: runner.os == 'Windows' |
89 | | - run: | |
90 | | - rm "C:\\Program Files\\Git\\usr\\bin\\link.exe" |
91 | | - which -a link.exe |
| 49 | + - name: install rust |
| 50 | + uses: actions-rs/toolchain@v1 |
| 51 | + with: |
| 52 | + profile: minimal |
| 53 | + toolchain: stable |
| 54 | + target: ${{ matrix.build.target }} |
| 55 | + override: true |
| 56 | + |
| 57 | + - name: print rustc detailed version |
| 58 | + run: rustc --version --verbose |
92 | 59 |
|
93 | 60 | - name: checkout |
94 | 61 | uses: actions/checkout@v2 |
95 | 62 |
|
96 | | - - name: download env artifact |
97 | | - uses: actions/download-artifact@v1 |
| 63 | + - name: codegen |
| 64 | + env: |
| 65 | + RUSTFLAGS: "" |
| 66 | + run: | |
| 67 | + make do-codegen |
| 68 | + make token_ids.hpp |
| 69 | +
|
| 70 | + - name: make lib file |
| 71 | + run: | |
| 72 | + make ${{ matrix.build.lib_file }} |
| 73 | + cp ${{ matrix.build.lib_file }} ${{ matrix.build.output_artifact_name }} |
| 74 | +
|
| 75 | + - name: upload ${{ matrix.build.output_artifact_name }} |
| 76 | + uses: actions/upload-artifact@v2 |
98 | 77 | with: |
99 | | - name: artifact-env |
100 | | - path: artifact-env |
| 78 | + name: ${{ matrix.build.output_artifact_name }} |
| 79 | + path: ${{ matrix.build.output_artifact_name }} |
| 80 | + |
| 81 | + - name: benchmark |
| 82 | + run: make benchmark/download && make benchmark/record |
101 | 83 |
|
102 | | - - name: load env artifact |
103 | | - shell: bash |
104 | | - run: cat artifact-env/artifact-env >> $GITHUB_ENV |
| 84 | + - name: upload ${{ matrix.build.target }}.benchmark-out |
| 85 | + uses: actions/upload-artifact@v2 |
| 86 | + with: |
| 87 | + name: ${{ matrix.build.target }}.benchmark-out |
| 88 | + path: ${{ matrix.build.target }}.benchmark-out |
105 | 89 |
|
| 90 | + build-header: |
| 91 | + name: build header file |
| 92 | + runs-on: ubuntu-latest |
| 93 | + env: |
| 94 | + TARGET: x86_64-unknown-linux-gnu |
| 95 | + steps: |
106 | 96 | - name: install rust |
107 | 97 | uses: actions-rs/toolchain@v1 |
108 | 98 | with: |
109 | | - toolchain: stable |
110 | 99 | profile: minimal |
| 100 | + toolchain: stable |
111 | 101 | override: true |
112 | 102 |
|
113 | | - - name: build |
114 | | - shell: bash |
115 | | - run: make clean build-static |
| 103 | + - name: checkout |
| 104 | + uses: actions/checkout@v2 |
116 | 105 |
|
117 | | - - name: show asset |
118 | | - shell: bash |
119 | | - run: ls -l target/release/${{ matrix.build.output }} |
| 106 | + - name: build lib-ruby-parser.hpp |
| 107 | + run: make lib-ruby-parser.hpp |
120 | 108 |
|
121 | | - - name: upload assets |
122 | | - uses: actions/upload-release-asset@v1.0.1 |
123 | | - env: |
124 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 109 | + - name: upload lib-ruby-parser.hpp |
| 110 | + uses: actions/upload-artifact@v2 |
125 | 111 | with: |
126 | | - upload_url: ${{ env.RELEASE_UPLOAD_URL }} |
127 | | - asset_path: target/release/${{ matrix.build.output }} |
128 | | - asset_name: ${{ matrix.build.upload_as }} |
129 | | - asset_content_type: application/octet-stream |
130 | | - |
131 | | - upload-headers: |
132 | | - name: upload-headers |
133 | | - needs: ['create-release'] |
| 112 | + name: lib-ruby-parser.hpp |
| 113 | + path: lib-ruby-parser.hpp |
| 114 | + |
| 115 | + build-release-notes: |
| 116 | + name: build release notes |
| 117 | + needs: |
| 118 | + - 'build-lib' |
134 | 119 | runs-on: ubuntu-latest |
135 | | - env: |
136 | | - BUILD_ENV: release |
137 | 120 | steps: |
138 | 121 | - name: checkout |
139 | 122 | uses: actions/checkout@v2 |
140 | 123 |
|
141 | | - - name: download env artifact |
142 | | - uses: actions/download-artifact@v1 |
143 | | - with: |
144 | | - name: artifact-env |
145 | | - path: artifact-env |
| 124 | + # download benchmark results |
| 125 | + - uses: actions/download-artifact@v2 |
| 126 | + with: { name: x86_64-unknown-linux-gnu.benchmark-out } |
146 | 127 |
|
147 | | - - name: load env artifact |
148 | | - run: cat artifact-env/artifact-env >> $GITHUB_ENV |
| 128 | + - uses: actions/download-artifact@v2 |
| 129 | + with: { name: x86_64-apple-darwin.benchmark-out } |
149 | 130 |
|
150 | | - - name: install rust |
151 | | - uses: actions-rs/toolchain@v1 |
| 131 | + - uses: actions/download-artifact@v2 |
| 132 | + with: { name: x86_64-pc-windows-msvc.benchmark-out } |
| 133 | + |
| 134 | + - name: build release notes |
| 135 | + run: | |
| 136 | + ls -l |
| 137 | + echo "### Results for x86_64-unknown-linux-gnu:" >> release_notes.md |
| 138 | + echo "" >> release_notes.md |
| 139 | + cat x86_64-unknown-linux-gnu.benchmark-out >> release_notes.md |
| 140 | + echo "" >> release_notes.md |
| 141 | + echo "### Results for x86_64-apple-darwin:" >> release_notes.md |
| 142 | + echo "" >> release_notes.md |
| 143 | + cat x86_64-apple-darwin.benchmark-out >> release_notes.md |
| 144 | + echo "" >> release_notes.md |
| 145 | + echo "### Results for x86_64-pc-windows-msvc:" >> release_notes.md |
| 146 | + echo "" >> release_notes.md |
| 147 | + cat x86_64-pc-windows-msvc.benchmark-out >> release_notes.md |
| 148 | + echo "" >> release_notes.md |
| 149 | + cat release_notes.md |
| 150 | +
|
| 151 | + - name: upload release_notes.md |
| 152 | + uses: actions/upload-artifact@v2 |
152 | 153 | with: |
153 | | - toolchain: stable |
154 | | - profile: minimal |
155 | | - override: true |
| 154 | + name: release_notes.md |
| 155 | + path: release_notes.md |
| 156 | + |
| 157 | + make-release: |
| 158 | + name: release |
| 159 | + needs: |
| 160 | + - 'build-lib' |
| 161 | + - 'build-header' |
| 162 | + - 'build-release-notes' |
| 163 | + runs-on: ubuntu-latest |
| 164 | + steps: |
| 165 | + - name: checkout |
| 166 | + uses: actions/checkout@v2 |
156 | 167 |
|
157 | | - - name: generate lib-ruby-parser.h |
158 | | - run: make clean target/lib-ruby-parser.h |
| 168 | + # lib files |
| 169 | + - uses: actions/download-artifact@v2 |
| 170 | + with: { name: libruby_parser_cpp-x86_64-unknown-linux-gnu.a } |
159 | 171 |
|
160 | | - - name: show asset |
161 | | - run: ls -l target/lib-ruby-parser.h |
| 172 | + - uses: actions/download-artifact@v2 |
| 173 | + with: { name: libruby_parser_cpp-x86_64-apple-darwin.a } |
162 | 174 |
|
163 | | - - name: upload assets |
164 | | - uses: actions/upload-release-asset@v1.0.1 |
165 | | - env: |
166 | | - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
167 | | - with: |
168 | | - upload_url: ${{ env.RELEASE_UPLOAD_URL }} |
169 | | - asset_path: target/lib-ruby-parser.h |
170 | | - asset_name: lib-ruby-parser.h |
171 | | - asset_content_type: application/octet-stream |
| 175 | + - uses: actions/download-artifact@v2 |
| 176 | + with: { name: libruby_parser_cpp-x86_64-pc-windows-msvc.lib } |
| 177 | + |
| 178 | + # header file |
| 179 | + - uses: actions/download-artifact@v2 |
| 180 | + with: { name: lib-ruby-parser.hpp } |
172 | 181 |
|
| 182 | + # release notes |
| 183 | + - uses: actions/download-artifact@v2 |
| 184 | + with: { name: release_notes.md } |
| 185 | + |
| 186 | + - name: show artifacts |
| 187 | + run: ls -l |
| 188 | + |
| 189 | + - name: release |
| 190 | + uses: ncipollo/release-action@v1 |
| 191 | + with: |
| 192 | + allowUpdates: true |
| 193 | + artifactErrorsFailBuild: true |
| 194 | + artifacts: "libruby_parser_cpp-*,lib-ruby-parser.hpp" |
| 195 | + bodyFile: release_notes.md |
| 196 | + token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments