Skip to content

Commit 9120693

Browse files
authored
Add compile workflow
1 parent 9ddaf4c commit 9120693

File tree

1 file changed

+108
-0
lines changed

1 file changed

+108
-0
lines changed

.github/workflows/compile_bins.yml

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
2+
name: Compile binaries for the current release
3+
on:
4+
release:
5+
types: [published]
6+
workflow_dispatch:
7+
8+
jobs:
9+
Linux-MacOS-build:
10+
strategy:
11+
fail-fast: false
12+
matrix:
13+
os: [ubuntu-latest, macos-latest]
14+
15+
runs-on: ${{matrix.os}}
16+
steps:
17+
- uses: actions/checkout@v3
18+
- name: Add LLVM to path [${{ matrix.os }}]
19+
if: runner.os == 'macOS'
20+
run: |
21+
echo $(brew --prefix llvm)*/bin >> $GITHUB_PATH
22+
23+
- name: Delete Icon.o from package.yaml
24+
run: |
25+
sed '/- src\/Icon\.o/d' ./package.yaml > temp && mv temp ./package.yaml
26+
27+
- name: Build i386
28+
if: runner.os == 'macOS'
29+
run: |
30+
stack build --local-bin-path=bin --copy-bins --arch i386
31+
mv bin/binary-exe "bin/$(echo '${{github.repository}}' | rev | cut -d '/' -f 1 | rev)-${{runner.os}}-x86"
32+
33+
- name: Build x86_64
34+
run: |
35+
stack build --local-bin-path=bin --copy-bins --arch x86_64
36+
mv bin/binary-exe "bin/$(echo '${{github.repository}}' | rev | cut -d '/' -f 1 | rev)-${{runner.os}}-x86_64"
37+
38+
- name: Build summary
39+
run: ls bin
40+
41+
- name: Add Linux|MacOS binary to release
42+
uses: softprops/action-gh-release@v1
43+
if: startsWith(github.ref, 'refs/tags/')
44+
with:
45+
files: bin/*
46+
47+
- name: Job summary
48+
run: |
49+
echo "### ✔ Build ${{runner.os}}" >> $GITHUB_STEP_SUMMARY
50+
51+
52+
53+
Windows-build:
54+
runs-on: windows-latest
55+
56+
env:
57+
BACKEND_ROOT: 'llvm_backend'
58+
LLVM_ZIP_NAME: 'llvm_zip.7z'
59+
LLVM_ROOT_NAME: 'llvm'
60+
CLANG_ZIP_NAME: 'clang_zip.7z'
61+
CLANG_ROOT_NAME: 'clang'
62+
63+
steps:
64+
- uses: actions/checkout@v3
65+
66+
- name: Downloading LLVM Windows binary
67+
uses: dsaltares/fetch-gh-release-asset@1.0.0
68+
with:
69+
repo: 'vovkos/llvm-package-windows'
70+
version: 'tags/llvm-12.0.1'
71+
file: 'llvm-12.0.1-windows-amd64-msvc15-msvcrt.7z'
72+
target: '${{env.BACKEND_ROOT}}/${{env.LLVM_ZIP_NAME}}'
73+
74+
- name: Extract LLVM
75+
run: |
76+
7z x -y ${{env.BACKEND_ROOT}}/llvm* -o${{env.BACKEND_ROOT}}/
77+
Get-ChildItem ${{env.BACKEND_ROOT}}/llvm-* | Rename-Item -NewName "${{env.LLVM_ROOT_NAME}}"
78+
echo "${{env.LLVM_ROOT}}" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
79+
env:
80+
LLVM_ROOT: "$pwd/${{env.BACKEND_ROOT}}/${{env.LLVM_ROOT_NAME}}/bin"
81+
82+
83+
- name: Exctraction summary
84+
run: |
85+
ls $pwd/${{env.BACKEND_ROOT}}/${{env.LLVM_ROOT_NAME}}/bin/llc*
86+
87+
echo ("LLVM llc exist: " + ((Get-Command "llc" -ErrorAction SilentlyContinue) -ne $null))
88+
echo ("LLVM clang(preinstalled) exist: " + ((Get-Command "clang" -ErrorAction SilentlyContinue) -ne $null))
89+
(&{If((Get-Command "llc" -ErrorAction SilentlyContinue) -eq $null -or (Get-Command "clang" -ErrorAction SilentlyContinue) -eq $null) {exit 1}})
90+
91+
- name: Build binary
92+
run: |
93+
stack build --local-bin-path=bin --copy-bins
94+
ls bin
95+
96+
- name: Rename binary to platform specific name
97+
run: Get-ChildItem bin/binary-exe* | Rename-Item -NewName ("${{github.repository}}".Split("/")[-1] + "-win-amd64.exe")
98+
99+
- name: Add Windows binary to release
100+
uses: softprops/action-gh-release@v1
101+
if: startsWith(github.ref, 'refs/tags/')
102+
with:
103+
files: bin/*
104+
105+
106+
- name: Job summary
107+
run: |
108+
echo "### ✔ Build ${{runner.os}}" >> $GITHUB_STEP_SUMMARY

0 commit comments

Comments
 (0)