diff options
Diffstat (limited to '.github/workflows/main.yml')
-rw-r--r-- | .github/workflows/main.yml | 119 |
1 files changed, 119 insertions, 0 deletions
diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..e2995b8 --- /dev/null +++ b/.github/workflows/main.yml | |||
@@ -0,0 +1,119 @@ | |||
1 | name: Rust | ||
2 | |||
3 | on: | ||
4 | push: | ||
5 | tags: | ||
6 | - '*' | ||
7 | |||
8 | jobs: | ||
9 | rustfmt: | ||
10 | runs-on: ubuntu-latest | ||
11 | steps: | ||
12 | - uses: actions/checkout@v1 | ||
13 | - run: rustup component add rustfmt | ||
14 | - run: cargo fmt -- --check | ||
15 | |||
16 | build-linux: | ||
17 | runs-on: ubuntu-latest | ||
18 | |||
19 | steps: | ||
20 | - name: Checkout | ||
21 | uses: actions/checkout@v1 | ||
22 | # cache the build assets so they dont recompile every time. | ||
23 | - name: Cache Rust dependencies | ||
24 | uses: actions/[email protected] | ||
25 | with: | ||
26 | path: target | ||
27 | key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} | ||
28 | restore-keys: | | ||
29 | ${{ runner.OS }}-build- | ||
30 | - name: Install latest rust toolchain | ||
31 | uses: actions-rs/toolchain@v1 | ||
32 | with: | ||
33 | toolchain: beta | ||
34 | default: true | ||
35 | override: true | ||
36 | - name: Install system dependencies | ||
37 | run: | | ||
38 | sudo apt-get update \ | ||
39 | && sudo apt-get install -y \ | ||
40 | libdbus-1-dev | ||
41 | - name: Build | ||
42 | run: cargo build --all --release && strip target/release/dijo | ||
43 | |||
44 | - name: Upload binaries to release | ||
45 | uses: svenstaro/upload-release-action@v1-release | ||
46 | with: | ||
47 | repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
48 | file: target/release/dijo | ||
49 | asset_name: dijo-x86_64-linux | ||
50 | tag: ${{ github.ref }} | ||
51 | overwrite: true | ||
52 | |||
53 | build-apple: | ||
54 | runs-on: macos-latest | ||
55 | |||
56 | steps: | ||
57 | - name: Checkout | ||
58 | uses: actions/checkout@v1 | ||
59 | - name: Cache Rust dependencies | ||
60 | uses: actions/[email protected] | ||
61 | with: | ||
62 | path: target | ||
63 | key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} | ||
64 | restore-keys: | | ||
65 | ${{ runner.OS }}-build- | ||
66 | - name: Install latest rust toolchain | ||
67 | uses: actions-rs/toolchain@v1 | ||
68 | with: | ||
69 | toolchain: beta | ||
70 | target: x86_64-apple-darwin | ||
71 | default: true | ||
72 | override: true | ||
73 | |||
74 | - name: Build for mac | ||
75 | run: cargo build --all --release && strip target/release/dijo | ||
76 | |||
77 | - name: Upload binaries to release | ||
78 | uses: svenstaro/upload-release-action@v1-release | ||
79 | with: | ||
80 | repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
81 | file: target/release/dijo | ||
82 | asset_name: dijo-x86_64-apple | ||
83 | tag: ${{ github.ref }} | ||
84 | overwrite: true | ||
85 | |||
86 | build-windows: | ||
87 | runs-on: windows-latest | ||
88 | |||
89 | steps: | ||
90 | - name: Checkout | ||
91 | uses: actions/checkout@v1 | ||
92 | - name: Cache Rust dependencies | ||
93 | uses: actions/[email protected] | ||
94 | with: | ||
95 | path: target | ||
96 | key: ${{ runner.OS }}-build-${{ hashFiles('**/Cargo.lock') }} | ||
97 | restore-keys: | | ||
98 | ${{ runner.OS }}-build- | ||
99 | - name: Install latest rust toolchain | ||
100 | uses: actions-rs/toolchain@v1 | ||
101 | with: | ||
102 | toolchain: beta | ||
103 | target: x86_64-pc-windows-msvc | ||
104 | default: true | ||
105 | override: true | ||
106 | |||
107 | - name: Build for windows | ||
108 | run: | | ||
109 | cargo build --all --release | ||
110 | strip target/release/dijo | ||
111 | |||
112 | - name: Upload binaries to release | ||
113 | uses: svenstaro/upload-release-action@v1-release | ||
114 | with: | ||
115 | repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
116 | file: target/release/dijo | ||
117 | asset_name: dijo-x86_64-windows | ||
118 | tag: ${{ github.ref }} | ||
119 | overwrite: true | ||