-
Notifications
You must be signed in to change notification settings - Fork 4
69 lines (64 loc) · 2.14 KB
/
rust.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
name: Rust
on: [push]
env:
CARGO_TERM_COLOR: always
RELEASE_TAG: idl-latest
jobs:
linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Get processor arch
run: echo "PROCESSOR_ARCH=`uname -p`" >> $GITHUB_ENV
- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --verbose
- name: Prepare Release
run: tar --transform 's/.*\///g' -zcvf ${{github.workspace}}/${{ runner.os }}-${{ env.PROCESSOR_ARCH }}-packet_generator.tar.gz target/*/packet_generator
- name: Upload linux build
uses: actions/upload-artifact@v2
with:
name: linux_build
path: ${{github.workspace}}/${{ runner.os }}-${{ env.PROCESSOR_ARCH }}-packet_generator.tar.gz
windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v2
- name: Build
run: cargo build --release --verbose
- name: Run tests
run: cargo test --verbose
- name: Prepare Release
run: |
copy-item ${{github.workspace}}\target\release\packet_generator.exe -destination ${{github.workspace}}\packet_generator.exe
7z a ${{github.workspace}}/windows-amd64-packet_generator.zip ${{github.workspace}}\packet_generator.exe
- name: Upload windows build
uses: actions/upload-artifact@v2
with:
name: windows_build
path: ${{github.workspace}}/windows-amd64-packet_generator.zip
release:
runs-on: ubuntu-latest
needs: [linux, windows]
if: github.ref == 'refs/heads/master'
steps:
- name: Download linux build
uses: actions/download-artifact@v2
with:
name: linux_build
- name: Download windows build
uses: actions/download-artifact@v2
with:
name: windows_build
- name: Release
uses: ncipollo/[email protected]
with:
allowUpdates: true
omitBodyDuringUpdate: true
omitNameDuringUpdate: true
replacesArtifacts: true
body: latest packet_generator build
artifacts: "*-packet_generator.tar.gz,*-packet_generator.zip"
tag: ${{env.RELEASE_TAG}}
token: ${{ secrets.GITHUB_TOKEN }}