-
Notifications
You must be signed in to change notification settings - Fork 0
99 lines (87 loc) · 2.6 KB
/
ci.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
name: Rust
on:
push:
release:
types: [created]
env:
CARGO_TERM_COLOR: always
defaults:
run:
# necessary for windows
shell: bash
jobs:
build:
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
os: [x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu]
runs-on: [ubuntu-latest]
cross: [true]
include:
- os: x86_64-apple-darwin
runs-on: macos-latest # Apple needs to be compiled on an apple os
cross: false # Cross fails on these platforms
- os: x86_64-pc-windows-gnu
runs-on: windows-latest # Not needed, but why not?
suffix: .exe # Windows has an .exe suffix
cross: false # Cross fails on these platforms
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
target: ${{ matrix.os }}
- name: Build Binary
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.cross }}
command: build
args: --target ${{ matrix.os }} --release
- name: Save Artifact
uses: actions/upload-artifact@v2
with:
name: dbimport-${{ matrix.os }}${{ matrix.suffix }}
path: target/${{ matrix.os }}/release/dbimport${{ matrix.suffix }}
- name: Upload Binary
if: github.event_name == 'release' && startsWith(github.ref, 'refs/tags/v')
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
asset_name: dbimport-${{ matrix.os }}${{ matrix.suffix }}
asset_path: target/${{ matrix.os }}/release/dbimport${{ matrix.suffix }}
upload_url: ${{ github.event.release.upload_url }}
asset_content_type: application/octet-stream
- name: Tests
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.cross }}
command: test
args: --target ${{ matrix.os }} --verbose
clippy_check:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v1
- run: rustup component add clippy
- uses: actions-rs/clippy-check@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
args: --all-features
rustfmt:
name: rustfmt
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
profile: minimal
components: rustfmt
- name: Check formatting
run: |
cargo fmt --all -- --check