-
Notifications
You must be signed in to change notification settings - Fork 1
138 lines (114 loc) · 4.2 KB
/
Copy pathrelease.yml
File metadata and controls
138 lines (114 loc) · 4.2 KB
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
name: release
on:
push:
tags:
- "cli/v*"
env:
CARGO_TERM_COLOR: always
jobs:
check:
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/cli
outputs:
version: ${{ steps.version.outputs.value }}
steps:
- uses: actions/checkout@v4
- name: Extract version from tag
id: version
run: echo "value=${GITHUB_REF_NAME#cli/}" >> $GITHUB_OUTPUT
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
- name: Clone dependency repos
run: |
mkdir -p /home/runner/work/packages
git clone --depth 1 https://github.com/quanttide/quanttide-agent-toolkit.git /home/runner/work/packages/quanttide-agent-toolkit
git clone --depth 1 https://github.com/quanttide/quanttide-data-toolkit.git /home/runner/work/packages/quanttide-data-toolkit
- name: Build
run: cargo build --release
- name: Test
run: cargo test
- name: Clippy
run: cargo clippy -- -D warnings
- name: Format
run: cargo fmt --check
publish-crate:
needs: check
runs-on: ubuntu-latest
defaults:
run:
working-directory: src/cli
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Clone dependency repos
run: |
mkdir -p /home/runner/work/packages
git clone --depth 1 https://github.com/quanttide/quanttide-agent-toolkit.git /home/runner/work/packages/quanttide-agent-toolkit
git clone --depth 1 https://github.com/quanttide/quanttide-data-toolkit.git /home/runner/work/packages/quanttide-data-toolkit
- name: Publish quanttide-agent
run: |
cd /home/runner/work/packages/quanttide-agent-toolkit/packages/rust
cargo publish --allow-dirty --token ${{ secrets.CRATE_API_KEY }}
- name: Publish quanttide-data-core
run: |
cd /home/runner/work/packages/quanttide-data-toolkit/packages/rust
cargo publish --allow-dirty --token ${{ secrets.CRATE_API_KEY }}
- name: Switch deps to crates.io versions
run: |
sed -i 's|quanttide-agent = { path = ".*" }|quanttide-agent = "0.1"|' src/cli/Cargo.toml
sed -i 's|quanttide-data-core = { path = ".*" }|quanttide-data-core = "0.1"|' src/cli/Cargo.toml
- name: Publish qtcloud-data-cli
run: cargo publish --allow-dirty --token ${{ secrets.CRATE_API_KEY }}
build-binary:
needs: check
strategy:
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
ext: ""
- os: macos-latest
target: aarch64-apple-darwin
ext: ""
- os: windows-latest
target: x86_64-pc-windows-msvc
ext: ".exe"
runs-on: ${{ matrix.os }}
defaults:
run:
working-directory: src/cli
steps:
- uses: actions/checkout@v4
with:
ref: ${{ github.ref }}
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: ${{ matrix.target }}
- name: Clone dependency repos
run: |
mkdir -p /home/runner/work/packages
git clone --depth 1 https://github.com/quanttide/quanttide-agent-toolkit.git /home/runner/work/packages/quanttide-agent-toolkit
git clone --depth 1 https://github.com/quanttide/quanttide-data-toolkit.git /home/runner/work/packages/quanttide-data-toolkit
- name: Build binary
run: cargo build --release --target ${{ matrix.target }}
- name: Package (Unix)
if: matrix.os != 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
tar czf ../../../qtcloud-data-${{ matrix.target }}.tar.gz qtcloud-data
- name: Package (Windows)
if: matrix.os == 'windows-latest'
run: |
cd target/${{ matrix.target }}/release
7z a ../../../qtcloud-data-${{ matrix.target }}.zip qtcloud-data.exe
- name: Upload to Release
uses: softprops/action-gh-release@v1
with:
files: |
qtcloud-data-*.tar.gz
qtcloud-data-*.zip