-
Notifications
You must be signed in to change notification settings - Fork 1
120 lines (113 loc) · 3.1 KB
/
build_and_release.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
name: Build and Release
on:
push:
branches:
- main
tags:
- "v*"
pull_request:
branches: [main]
env:
LINUX_ARTIFACT: jvem_linux.tar.gz
WINDOWS_ARTIFACT: jvem.zip
MACOS_ARTIFACT: jvem_macos.tar.gz
jobs:
common-build:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: tests
run: cargo test --verbose
- name: install latest rust toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
override: true
build-linux:
needs: common-build
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: build and test
run: |
cargo build --all --release
bash src/tests/test.sh
- name: package
run: |
mv target/release/jvem target/release/jvem_amd64
mkdir source
mv target/release/jvem_amd64 source/
tar -czvf ${{ env.LINUX_ARTIFACT }} -C source/ .
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: linux-artifact
path: ${{ env.LINUX_ARTIFACT }}
build-win:
needs: common-build
runs-on: windows-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: build
run: |
cargo build --all --release
mkdir source
copy target\release\jvem.exe source/
Compress-Archive -Path source\* -DestinationPath ${{ env.WINDOWS_ARTIFACT }}
- name: Upload Artifact
uses: actions/upload-artifact@v2
with:
name: windows-artifact
path: ${{ env.WINDOWS_ARTIFACT }}
build-macos:
needs: common-build
runs-on: macos-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: build
run: |
cargo build --all --release
mkdir source
mv target/release/jvem source/
tar -czvf ${{ env.MACOS_ARTIFACT }} -C source/ .
- name: upload Artifact
uses: actions/upload-artifact@v2
with:
name: macos-artifact
path: ${{ env.MACOS_ARTIFACT }}
release:
needs: [build-linux, build-win, build-macos]
runs-on: ubuntu-latest
steps:
- name: checkout code
uses: actions/checkout@v2
- name: download Linux Artifact
uses: actions/download-artifact@v2
with:
name: linux-artifact
path: .
- name: download Windows Artifact
uses: actions/download-artifact@v2
with:
name: windows-artifact
path: .
- name: download macOS Artifact
uses: actions/download-artifact@v2
with:
name: macos-artifact
path: .
- name: release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
files: |
${{ env.LINUX_ARTIFACT }}
${{ env.WINDOWS_ARTIFACT }}
${{ env.MACOS_ARTIFACT }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}