-
Notifications
You must be signed in to change notification settings - Fork 40
137 lines (115 loc) · 5.01 KB
/
build_prod_exe.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
name: Build and Publish Compute Releases
on:
push:
branches:
- compute-exe
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.runner }}
strategy:
matrix:
include:
# - { runner: macos-latest, osname: macOS, arch: amd64, target: x86_64-apple-darwin }
# - { runner: macos-latest, osname: macOS, arch: arm64, target: aarch64-apple-darwin }
- { runner: ubuntu-latest, osname: linux, arch: amd64, target: x86_64-unknown-linux-gnu }
# - { runner: ubuntu-latest, osname: linux, arch: arm64, target: aarch64-unknown-linux-gnu}
# - { runner: windows-latest, osname: windows, arch: amd64, target: x86_64-pc-windows-msvc, extension: ".exe"}
# - { runner: windows-latest, osname: windows, arch: arm64, target: aarch64-unknown-linux-gnu, extension: ".exe"}
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Get the release version from the tag
shell: bash
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install OpenSSL
shell: bash
run: |
if [ "${{ matrix.osname }}" = "macOS" ]; then
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
brew install [email protected] pkg-config
echo "OPENSSL_DIR=$(brew --prefix [email protected])" >> $GITHUB_ENV
echo "OPENSSL_INCLUDE_DIR=$(brew --prefix [email protected])/include" >> $GITHUB_ENV
echo "OPENSSL_LIB_DIR=$(brew --prefix [email protected])/lib" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=$(brew --prefix [email protected])/lib/pkgconfig" >> $GITHUB_ENV
elif [ "${{ matrix.osname }}" = "linux" ]; then
sudo apt-get update
sudo apt-get install -y pkg-config libssl-dev
if [ "${{ matrix.arch }}" = "amd64" ]; then
sudo apt-get install gcc-aarch64-linux-gnu
echo "PKG_CONFIG_PATH=/usr/lib/x86_64-linux-gnu/pkgconfig" >> $GITHUB_ENV
elif [ "${{ matrix.arch }}" = "arm64" ]; then
echo "PKG_CONFIG_PATH=/usr/lib/aarch64-linux-gnu/pkgconfig" >> $GITHUB_ENV
fi
echo "OPENSSL_DIR=/usr/lib/ssl" >> $GITHUB_ENV
echo "OPENSSL_INCLUDE_DIR=/usr/include/openssl" >> $GITHUB_ENV
echo "OPENSSL_LIB_DIR=/usr/lib/ssl" >> $GITHUB_ENV
elif [ "${{ matrix.osname }}" = "windows" ]; then
choco install openssl.light
echo "OPENSSL_DIR=C:\\Program Files\\OpenSSL-Win64" >> $GITHUB_ENV
echo "OPENSSL_INCLUDE_DIR=C:\\Program Files\\OpenSSL-Win64\\include" >> $GITHUB_ENV
echo "OPENSSL_LIB_DIR=C:\\Program Files\\OpenSSL-Win64\\lib" >> $GITHUB_ENV
echo "PKG_CONFIG_PATH=C:\\Program Files\\OpenSSL-Win64\\lib\\pkgconfig" >> $GITHUB_ENV
fi
- name: Build
env:
OPENSSL_DIR: ${{ env.OPENSSL_DIR }}
OPENSSL_INCLUDE_DIR: ${{ env.OPENSSL_INCLUDE_DIR }}
OPENSSL_LIB_DIR: ${{ env.OPENSSL_LIB_DIR }}
PKG_CONFIG_PATH: ${{ env.PKG_CONFIG_PATH }}
run: |
echo $OPENSSL_DIR
echo $OPENSSL_INCLUDE_DIR
echo $OPENSSL_LIB_DIR
echo $PKG_CONFIG_PATH
cargo build --verbose --release --target ${{ matrix.target }}
# - name: Build
# uses: actions-rs/cargo@v1
# env:
# with:
# use-cross: true
# command: build
# args: --verbose --release --target ${{ matrix.target }}
- name: Prepare Release File
env:
BINARY_NAME: dkn-compute${{ matrix.extension }}
FOLDER_NAME: dkn-compute-node
ZIP_NAME: dkn-compute-${{ matrix.osname }}-${{ matrix.arch }}
run: |
mkdir $FOLDER_NAME
# move the binary
mv "target/${{ matrix.target }}/release/$BINARY_NAME" "$FOLDER_NAME"
zip -r $ZIP_NAME.zip $FOLDER_NAME
- name: Upload Launch Artifacts
uses: actions/upload-artifact@v4
with:
name: dkn-compute-${{ matrix.osname }}-${{ matrix.arch }}
path: dkn-compute-${{ matrix.osname }}-${{ matrix.arch }}.zip
release:
needs: build
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/compute-exe'
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Download Launch Artifacts
uses: actions/download-artifact@v4
with:
merge-multiple: true
path: ./artifacts
- name: Get the latest tag
id: get_latest_tag
run: echo "LATEST_TAG=$(git describe --tags $(git rev-list --tags --max-count=1))" >> $GITHUB_ENV
- name: Create release with artifacts
uses: ncipollo/release-action@v1
with:
name: ${{ env.LATEST_TAG }}
tag: ${{ env.LATEST_TAG }}
artifacts: "artifacts/*"
artifactContentType: application/zip
draft: true