1 | name: Build binary artifacts |
2 | |
3 | on: |
4 | push: |
5 | tags: |
6 | - weekly.** |
7 | - 0.** |
8 | |
9 | jobs: |
10 | |
11 | build-linux: |
12 | runs-on: ubuntu-20.04 |
13 | env: |
14 | CC: gcc |
15 | ZIPNAME: v_linux.zip |
16 | steps: |
17 | - uses: actions/checkout@v1 |
18 | - name: Compile |
19 | run: | |
20 | make |
21 | ./v -skip-unused -cc $CC -prod -o v cmd/v |
22 | ./v -skip-unused -cc $CC -prod cmd/tools/vup.v |
23 | ./v -skip-unused -cc $CC -prod cmd/tools/vdoctor.v |
24 | - name: Remove excluded |
25 | run: | |
26 | rm -rf .git/ |
27 | rm -rf thirdparty/tcc/.git/ |
28 | rm -rf vc/ |
29 | rm -rf v_old |
30 | rm -rf vlib/v/tests/bench/gcboehm/*.svg |
31 | - name: Create ZIP archive |
32 | run: | |
33 | cd .. |
34 | zip -r9 --symlinks $ZIPNAME v/ |
35 | mv $ZIPNAME v/ |
36 | cd v/ |
37 | - name: Create artifact |
38 | uses: actions/upload-artifact@v2 |
39 | with: |
40 | name: linux |
41 | path: v_linux.zip |
42 | |
43 | build-macos: |
44 | runs-on: macos-latest |
45 | env: |
46 | CC: clang |
47 | ZIPNAME: v_macos.zip |
48 | steps: |
49 | - uses: actions/checkout@v1 |
50 | - name: Compile |
51 | run: | |
52 | make |
53 | ./v -skip-unused -cc $CC -prod -o v cmd/v |
54 | ./v -skip-unused -cc $CC -prod cmd/tools/vup.v |
55 | ./v -skip-unused -cc $CC -prod cmd/tools/vdoctor.v |
56 | - name: Remove excluded |
57 | run: | |
58 | rm -rf .git/ |
59 | rm -rf thirdparty/tcc/.git/ |
60 | rm -rf vc/ |
61 | rm -rf v_old |
62 | rm -rf vlib/v/tests/bench/gcboehm/*.svg |
63 | - name: Create ZIP archive |
64 | run: | |
65 | cd .. |
66 | zip -r9 --symlinks $ZIPNAME v/ |
67 | mv $ZIPNAME v/ |
68 | cd v/ |
69 | - name: Create artifact |
70 | uses: actions/upload-artifact@v2 |
71 | with: |
72 | name: macos |
73 | path: v_macos.zip |
74 | |
75 | build-windows: |
76 | runs-on: windows-latest |
77 | env: |
78 | CC: msvc |
79 | ZIPNAME: v_windows.zip |
80 | steps: |
81 | - uses: actions/checkout@v1 |
82 | - uses: msys2/setup-msys2@v2 |
83 | - name: Compile needed executables with -prod |
84 | run: | |
85 | .\make.bat -msvc |
86 | .\v.exe -skip-unused -prod -cc msvc -o cmd/vprod.exe cmd/v |
87 | del *.exe |
88 | move cmd\vprod.exe v.exe |
89 | .\v.exe -skip-unused -prod -cc msvc cmd\tools\vup.v |
90 | .\v.exe -skip-unused -prod -cc msvc cmd\tools\vdoctor.v |
91 | - name: Remove excluded |
92 | shell: msys2 {0} |
93 | run: | |
94 | rm -rf .git/ |
95 | rm -rf thirdparty/tcc/.git/ |
96 | rm -rf vc/ |
97 | rm -rf v_old.exe |
98 | rm -rf vlib/v/tests/bench/gcboehm/*.svg |
99 | - name: Create archive |
100 | shell: msys2 {0} |
101 | run: | |
102 | cd .. |
103 | powershell Compress-Archive v $ZIPNAME |
104 | mv $ZIPNAME v/ |
105 | cd v/ |
106 | # NB: the powershell Compress-Archive line is from: |
107 | # https://superuser.com/a/1336434/194881 |
108 | # It is needed, because `zip` is not installed by default :-| |
109 | - name: Create artifact |
110 | uses: actions/upload-artifact@v2 |
111 | with: |
112 | name: windows |
113 | path: v_windows.zip |
114 | |
115 | release: |
116 | name: Create Github Release |
117 | needs: [build-linux, build-windows, build-macos] |
118 | runs-on: ubuntu-20.04 |
119 | steps: |
120 | - name: Get short tag name |
121 | uses: jungwinter/split@v1 |
122 | id: split |
123 | with: |
124 | msg: ${{ github.ref }} |
125 | seperator: / |
126 | - name: Create Release |
127 | id: create_release |
128 | uses: ncipollo/release-action@v1 |
129 | with: |
130 | token: ${{ secrets.GITHUB_TOKEN }} |
131 | tag: ${{ steps.split.outputs._2 }} |
132 | name: ${{ steps.split.outputs._2 }} |
133 | commit: ${{ github.sha }} |
134 | draft: false |
135 | prerelease: false |
136 | |
137 | publish: |
138 | needs: [release] |
139 | runs-on: ubuntu-20.04 |
140 | strategy: |
141 | matrix: |
142 | version: [linux, macos, windows] |
143 | steps: |
144 | - uses: actions/checkout@v1 |
145 | - name: Fetch artifacts |
146 | uses: actions/download-artifact@v1 |
147 | with: |
148 | name: ${{ matrix.version }} |
149 | path: ./${{ matrix.version }} |
150 | - name: Get short tag name |
151 | uses: jungwinter/split@v1 |
152 | id: split |
153 | with: |
154 | msg: ${{ github.ref }} |
155 | seperator: / |
156 | - name: Get release |
157 | id: get_release_info |
158 | uses: leahlundqvist/[email protected] |
159 | env: |
160 | GITHUB_TOKEN: ${{ github.token }} |
161 | with: |
162 | tag_name: ${{ steps.split.outputs._2 }} |
163 | - name: Upload Release Asset |
164 | id: upload-release-asset |
165 | uses: actions/[email protected] |
166 | env: |
167 | GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
168 | with: |
169 | upload_url: ${{ steps.get_release_info.outputs.upload_url }} |
170 | asset_path: ${{ matrix.version }}/v_${{ matrix.version }}.zip |
171 | asset_name: v_${{ matrix.version }}.zip |
172 | asset_content_type: application/zip |