summaryrefslogtreecommitdiff
path: root/.github/workflows/build_where.yml
blob: 3de18730e7304c4f5e64ecb03fa89eaf6942d053 (plain)
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
name: Build where

on:
  push:
    branches: [ mane ]
  pull_request:
    branches: [ mane ]

env:
  CARGO_TERM_COLOR: always

jobs:
  build:
    runs-on: ${{ matrix.os }}

    strategy:
      matrix:
        os: [ ubuntu-latest, macos-latest ]
        profile: [ dev, release ]

    env:
      BUILD_NAME: ${{ matrix.profile == 'dev' && 'debug' || matrix.profile }}

    steps:
    - uses: actions/checkout@v4
    - name: Build
      run: cargo build --all --profile ${{ matrix.profile }}
    - name: Check
      run: cargo clippy --profile ${{ matrix.profile }} -- -D warnings
    - name: Test message exchange
      working-directory: target/${{ env.BUILD_NAME }}
      run: |
        touch ~/.config/where.toml
        echo '[global]' >> ~/.config/where.toml
        echo '[[server]]' >> ~/.config/where.toml
        echo 'endpoint="127.0.0.1:5000"' >> ~/.config/where.toml

        ./whered -l 127.0.0.1:5000 &

        i=0
        while [ ! $(pgrep whered) ] && [ $i -lt 10 ]
        do
          sleep 1
          ((i++))
        done

        ./where
    - name: Upload build
      uses: actions/upload-artifact@v4
      with:
        name: where-rs-${{ matrix.os }}-${{ env.BUILD_NAME }}
        path: |
          target/${{ env.BUILD_NAME }}/where
          target/${{ env.BUILD_NAME }}/whered