-
Notifications
You must be signed in to change notification settings - Fork 0
199 lines (196 loc) · 6.79 KB
/
remoteBuild.yml
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
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
name: Remote Build
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
workflow_dispatch:
inputs:
fullName:
description: The full name of the release
default: Adept 3.0
required: true
type: string
shortVersion:
description: The short version number
default: "3.0"
required: true
type: string
longVersion:
description: The long version number
default: "3.0.0"
required: true
type: string
alternativeBinaryName:
description: The alternative binary name
default: "adept3-0"
required: true
type: string
env:
BUILD_TYPE: Release
IS_GITHUB_WORKFLOW: On
jobs:
build:
runs-on: ${{matrix.os}}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
defaults:
run:
working-directory: ${{github.workspace}}
name: ${{ format('Build / {0}', matrix.os) }}
steps:
- uses: actions/checkout@v3
- name: Configure to use MinGW-w64 (Windows)
if: matrix.os == 'windows-latest'
shell: bash
run: |
export CC=x86_64-w64-mingw32-gcc
export CXX=x86_64-w64-mingw32-g++
- name: Install latest Rust nightly
uses: actions-rs/toolchain@v1
with:
toolchain: nightly
override: true
components: clippy
- name: Install LLVM and dependencies (Windows)
if: ${{ matrix.os == 'windows-latest' }}
shell: bash
run: |
C:\msys64\usr\bin\pacman -S mingw-w64-x86_64-gcc --noconfirm
C:\msys64\usr\bin\pacman -S mingw-w64-x86_64-llvm --noconfirm
C:\msys64\usr\bin\pacman -S mingw-w64-x86_64-zlib --noconfirm
C:\msys64\usr\bin\pacman -S mingw-w64-x86_64-zstd --noconfirm
- name: Install LLVM and dependencies (macOS)
if: ${{ matrix.os == 'macos-latest' }}
run: |
brew install llvm@18
brew install zstd
- name: Install LLVM and dependencies (Ubuntu)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt-get update
sudo apt-get remove -y llvm-13
eval "$(/home/linuxbrew/.linuxbrew/bin/brew shellenv)"
brew install llvm@18
brew install zstd
- name: Build (Windows)
if: ${{ matrix.os == 'windows-latest' }}
run: |
cargo build --release
env:
CFLAGS: -static-libstdc++
CXXFLAGS: -static-libstdc++
LLVM_SYS_181_PREFIX: C:\msys64\mingw64
zstd_DIR: C:\msys64\mingw64
zstd_LIBRARY: C:\msys64\mingw64\lib\libzstd.a
ZLIB_INCLUDE_DIR: C:\msys64\mingw64\include
ZLIB_LIBRARY: C:\msys64\mingw64\lib\libz.a
- name: Build (macOS)
run: |
cargo build --release
env:
CC: /opt/homebrew/opt/llvm/bin/clang
LLVM_SYS_181_PREFIX: /opt/homebrew/opt/llvm
zstd_DIR: /usr/local/opt/zstd
CFLAGS: -static-libstdc++
CXXFLAGS: -static-libstdc++
LDFLAGS: /opt/homebrew/opt/llvm/lib/libunwind.a
- name: Build (Linux)
if: ${{ matrix.os == 'linux-latest' }}
run: |
cargo build --release
env:
LLVM_SYS_181_PREFIX: /home/linuxbrew/.linuxbrew/opt/llvm@18
zstd_DIR: /home/linuxbrew/.linuxbrew/opt/zstd
- name: Archive Build Result
if: ${{ matrix.os == 'windows-latest' }}
uses: a7ul/[email protected]
with:
command: c
files: target/release/adept.exe
outPath: build-${{ matrix.os }}.tar.gz
- name: Archive Build Result
if: ${{ matrix.os != 'windows-latest' }}
uses: a7ul/[email protected]
with:
command: c
files: target/release/adept
outPath: build-${{ matrix.os }}.tar.gz
- name: Upload Build Artifact
uses: actions/upload-artifact@v3
with:
name: build-${{ matrix.os }}-archive
path: build-${{ matrix.os }}.tar.gz
test:
needs: build
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [windows-latest, macos-latest, ubuntu-latest]
name: ${{ format('Test / {0}', matrix.os) }}
steps:
- name: Download Build Artifact
uses: actions/download-artifact@v3
with:
name: build-${{ matrix.os }}-archive
- name: Unpack Build Artifact
uses: a7ul/[email protected]
with:
command: x
files: build-${{ matrix.os }}.tar.gz
deploy:
name: Deploy
needs: [test]
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' }}
steps:
- name: Get workflow dispatch inputs (workflow dispatch)
if: github.event_name == 'workflow_dispatch'
shell: bash
run: |
echo 'fullName=${{github.event.inputs.fullName}}' >> $GITHUB_ENV
echo 'shortVersion=${{github.event.inputs.shortVersion}}' >> $GITHUB_ENV
echo 'longVersion=${{github.event.inputs.longVersion}}' >> $GITHUB_ENV
echo 'alternativeBinaryName=${{github.event.inputs.alternativeBinaryName}}' >> $GITHUB_ENV
echo 'releaseName=${{github.event.inputs.fullName}}' >> $GITHUB_ENV
echo 'releaseTagName=v${{github.event.inputs.shortVersion}}' >> $GITHUB_ENV
- name: Get default inputs (push / pr)
if: github.event_name != 'workflow_dispatch'
shell: bash
run: |
echo 'fullName=Adept Nightly' >> $GITHUB_ENV
echo 'shortVersion=nightly' >> $GITHUB_ENV
echo 'longVersion=nightly' >> $GITHUB_ENV
echo 'alternativeBinaryName=adept-nightly' >> $GITHUB_ENV
echo 'releaseName=Nightly' >> $GITHUB_ENV
echo 'releaseTagName=Nightly' >> $GITHUB_ENV
- name: Download Build Artifact (windows-latest)
uses: actions/download-artifact@v3
with:
name: build-windows-latest-archive
- name: Download Build Artifact (macos-latest)
uses: actions/download-artifact@v3
with:
name: build-macos-latest-archive
- name: Download Build Artifact (ubuntu-latest)
uses: actions/download-artifact@v3
with:
name: build-ubuntu-latest-archive
- name: Get current date
id: date
run: echo "::set-output name=date::$(date '+%B %d %Y at %l:%M %p %Z')"
- name: Release
uses: IsaacShelton/[email protected]
with:
token: ${{secrets.GITHUB_TOKEN}}
release: ${{env.releaseName}}
body: ${{ format('Last built on {0} - {1}', steps.date.outputs.date, github.sha) }}
tag: ${{env.releaseTagName}}
replace: true
files: >
build-windows-latest.tar.gz
build-macos-latest.tar.gz
build-linux-latest.tar.gz