Skip to content
This repository was archived by the owner on Jan 8, 2023. It is now read-only.

Commit 0d94797

Browse files
author
ApsarasX
committed
chore: add release workflow
1 parent ef9d59a commit 0d94797

File tree

2 files changed

+145
-7
lines changed

2 files changed

+145
-7
lines changed
Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,18 +1,26 @@
1-
name: Continuous Integration
1+
name: Build
22

33
on:
44
push:
5+
branches:
6+
- '**'
57
paths-ignore:
68
- 'README.md'
79
- 'README-zh_CN.md'
810
- 'ROADMAP-zh_CN.md'
911
- 'LICENSE'
12+
tags-ignore:
13+
- '**'
1014
pull_request:
15+
branches:
16+
- '**'
1117
paths-ignore:
1218
- 'README.md'
1319
- 'README-zh_CN.md'
1420
- 'ROADMAP-zh_CN.md'
1521
- 'LICENSE'
22+
tags-ignore:
23+
- '**'
1624

1725
jobs:
1826
build_on_linux:
@@ -69,14 +77,14 @@ jobs:
6977
cd ../cmake-build-release
7078
sudo cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-w" -G "Unix Makefiles" ..
7179
sudo cmake --build . --target staticscript document -- -j $THREAD_COUNT
72-
- name: Upload Debug Executable File
80+
- name: Upload Debug File
7381
uses: actions/upload-artifact@v2
7482
with:
7583
name: staticscript-${{ matrix.os }}-${{ matrix.compiler.cc }}-debug
7684
path: |
7785
cmake-build-debug/staticscript
7886
cmake-build-debug/lib/*.bc
79-
- name: Upload Release Executable File
87+
- name: Upload Release File
8088
uses: actions/upload-artifact@v2
8189
with:
8290
name: staticscript-${{ matrix.os }}-${{ matrix.compiler.cc }}-release
@@ -111,14 +119,14 @@ jobs:
111119
cd ../cmake-build-release
112120
sudo cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-w" -G "Unix Makefiles" ..
113121
sudo cmake --build . --target staticscript document -- -j $THREAD_COUNT
114-
- name: Upload Debug Executable File
122+
- name: Upload Debug File
115123
uses: actions/upload-artifact@v2
116124
with:
117125
name: staticscript-${{ matrix.os }}-${{ matrix.compiler.cc }}-debug
118126
path: |
119127
cmake-build-debug/staticscript
120128
cmake-build-debug/lib/*.bc
121-
- name: Upload Release Executable File
129+
- name: Upload Release File
122130
uses: actions/upload-artifact@v2
123131
with:
124132
name: staticscript-${{ matrix.os }}-${{ matrix.compiler.cc }}-release
@@ -139,12 +147,12 @@ jobs:
139147
steps:
140148
- name: Fetch Codebase
141149
uses: actions/checkout@v2
142-
- name: Download Debug Executable File
150+
- name: Download Debug File
143151
uses: actions/download-artifact@v2
144152
with:
145153
name: staticscript-${{ matrix.os }}-${{ matrix.compiler.cc }}-debug
146154
path: executables/debug
147-
- name: Download Release Executable File
155+
- name: Download Release File
148156
uses: actions/download-artifact@v2
149157
with:
150158
name: staticscript-${{ matrix.os }}-${{ matrix.compiler.cc }}-release

.github/workflows/release.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- 'v*'
7+
8+
jobs:
9+
build_on_ubuntu_before_release:
10+
name: Build on Ubuntu Before Release
11+
runs-on: ubuntu-20.04
12+
env:
13+
CC: clang
14+
CXX: clang++
15+
steps:
16+
- name: Fetch Codebase
17+
uses: actions/checkout@v2
18+
- name: Cache Antlr4 and Antlr4 Runtime
19+
id: cache-antlr
20+
uses: actions/cache@v2
21+
with:
22+
path: ${{ github.workspace }}/thirdparty
23+
key: ubuntu-20.04-clang-antlr4.9
24+
- name: Install Prerequirements
25+
run: |
26+
sudo wget https://apt.llvm.org/llvm.sh
27+
sudo chmod +x llvm.sh
28+
sudo ./llvm.sh 11
29+
sudo apt-get -y install uuid-dev pkg-config doxygen graphviz
30+
- name: Install Antlr4 and Antlr4 Runtime
31+
if: steps.cache-antlr.outputs.cache-hit != 'true'
32+
run: |
33+
sudo mkdir -p thirdparty/antlr && cd thirdparty/antlr
34+
sudo wget https://www.antlr.org/download/antlr-4.9-complete.jar
35+
sudo wget -O ${{ runner.temp }}/antlr4-src.zip https://www.antlr.org/download/antlr4-cpp-runtime-4.9-source.zip
36+
cd ${{ runner.temp }}
37+
sudo unzip antlr4-src.zip
38+
sudo mkdir build && cd build
39+
sudo mkdir -p ${{ github.workspace }}/thirdparty/antlr-runtime
40+
sudo cmake .. -DANTLR4_INSTALL=ON -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-w" -DCMAKE_INSTALL_PREFIX=${{ github.workspace }}/thirdparty/antlr-runtime
41+
sudo cmake --build . --target install -- -j 2
42+
- name: Move Antlr Runtime into /usr/local
43+
run: |
44+
cd ${{ github.workspace }}/thirdparty/antlr-runtime
45+
sudo cp -r include/* /usr/local/include/
46+
sudo cp -r lib/* /usr/local/lib/
47+
- name: CMake Build
48+
run: |
49+
echo "THREAD_COUNT=$(sudo cat /proc/cpuinfo| grep "processor"| wc -l)" >> $GITHUB_ENV
50+
sudo mkdir cmake-build-release
51+
cd cmake-build-release
52+
sudo cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-w" -G "Unix Makefiles" ..
53+
sudo cmake --build . --target staticscript document -- -j $THREAD_COUNT
54+
sudo mkdir bin && sudo cp staticscript bin/
55+
- name: Upload Release File
56+
uses: actions/upload-artifact@v2
57+
with:
58+
name: staticscript-ubuntu-release
59+
path: |
60+
cmake-build-release/bin/staticscript
61+
cmake-build-release/lib/*.bc
62+
63+
build_on_macos_before_release:
64+
name: Build on macOS Before Release
65+
runs-on: macos-10.15
66+
env:
67+
CC: clang
68+
CXX: clang++
69+
steps:
70+
- name: Install Prerequirements
71+
run: brew install antlr antlr4-cpp-runtime doxygen graphviz
72+
- name: Fetch Codebase
73+
uses: actions/checkout@v2
74+
- name: CMake Build
75+
run: |
76+
echo "THREAD_COUNT=$(sudo sysctl -n machdep.cpu.thread_count)" >> $GITHUB_ENV
77+
sudo mkdir cmake-build-debug cmake-build-release
78+
cd cmake-build-release
79+
sudo cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_CXX_FLAGS="-w" -G "Unix Makefiles" ..
80+
sudo cmake --build . --target staticscript document -- -j $THREAD_COUNT
81+
sudo mkdir bin && sudo cp staticscript bin/
82+
- name: Upload Release File
83+
uses: actions/upload-artifact@v2
84+
with:
85+
name: staticscript-macos-release
86+
path: |
87+
cmake-build-release/bin/staticscript
88+
cmake-build-release/lib/*.bc
89+
90+
release:
91+
name: Release
92+
needs: [ build_on_ubuntu_before_release, build_on_macos_before_release ]
93+
runs-on: ubuntu-20.04
94+
steps:
95+
- name: Fetch Codebase
96+
uses: actions/checkout@v2
97+
- name: Download Release File
98+
uses: actions/download-artifact@v2
99+
- name: Create Release
100+
id: create_release
101+
uses: actions/create-release@v1
102+
env:
103+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
104+
with:
105+
tag_name: ${{ github.ref }}
106+
release_name: ${{ github.ref }}
107+
draft: false
108+
prerelease: false
109+
- name: Compress Release Attachments
110+
run: |
111+
sudo zip -r staticscript-ubuntu-release.zip staticscript-ubuntu-release
112+
sudo zip -r staticscript-macos-release.zip staticscript-macos-release
113+
- name: Upload Ubuntu Release Attachment
114+
uses: actions/upload-release-asset@v1
115+
env:
116+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
117+
with:
118+
upload_url: ${{ steps.create_release.outputs.upload_url }}
119+
asset_path: ./staticscript-ubuntu-release.zip
120+
asset_name: staticscript-ubuntu-release.zip
121+
asset_content_type: application/zip
122+
- name: Upload macOS Release Attachment
123+
uses: actions/upload-release-asset@v1
124+
env:
125+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
126+
with:
127+
upload_url: ${{ steps.create_release.outputs.upload_url }}
128+
asset_path: ./staticscript-macos-release.zip
129+
asset_name: staticscript-macos-release.zip
130+
asset_content_type: application/zip

0 commit comments

Comments
 (0)