1name: CI
2
3on:
4 push:
5 branches:
6 - master
7 pull_request:
8 branches:
9 - "**"
10
11env:
12 CARGO_TERM_COLOR: always
13 CARGO_INCREMENTAL: 0
14
15jobs:
16 tests:
17 name: Run tests
18 runs-on: self-hosted
19 steps:
20 - name: Checkout repo
21 uses: actions/checkout@v2
22
23 # Work around https://github.com/actions/cache/issues/403.
24 - name: Use GNU tar
25 run: |
26 echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
27
28 - name: Cache artifacts
29 id: cache
30 uses: actions/cache@v2
31 with:
32 path: |
33 ~/.cargo/registry
34 ~/.cargo/git
35 ~/.rustup
36 target
37 key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
38
39 - name: Install Rust
40 if: steps.cache.outputs.cache-hit != 'true'
41 uses: actions-rs/toolchain@v1
42 with:
43 toolchain: stable
44 target: x86_64-apple-darwin
45 profile: minimal
46
47 - name: Run tests
48 run: cargo test --no-fail-fast
49
50 bundle:
51 name: Bundle app
52 runs-on: self-hosted
53 steps:
54 - name: Checkout repo
55 uses: actions/checkout@v2
56
57 # Work around https://github.com/actions/cache/issues/403.
58 - name: Use GNU tar
59 run: |
60 echo PATH="/usr/local/opt/gnu-tar/libexec/gnubin:$PATH" >> $GITHUB_ENV
61
62 - name: Cache artifacts
63 id: cache
64 uses: actions/cache@v2
65 with:
66 path: |
67 ~/.cargo/registry
68 ~/.cargo/git
69 ~/.rustup
70 target
71 key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
72
73 - name: Install Rust
74 if: steps.cache.outputs.cache-hit != 'true'
75 uses: actions-rs/toolchain@v1
76 with:
77 toolchain: stable
78 target: x86_64-apple-darwin
79 profile: minimal
80
81 - name: Create app bundle
82 run: script/bundle
83
84 - name: Upload app bundle to workflow run
85 uses: actions/upload-artifact@v2
86 with:
87 name: Zed.dmg
88 path: target/release/Zed.dmg
89
90 - uses: svenstaro/upload-release-action@v2
91 name: Upload app bundle to release
92 if: ${{ startsWith(github.github.ref, 'refs/tags/v') }}
93 with:
94 repo_token: ${{ secrets.GITHUB_TOKEN }}
95 file: target/release/Zed.dmg
96 asset_name: Zed.dmg
97 tag: ${{ github.ref }}
98 overwrite: true
99 body: ""