summaryrefslogtreecommitdiffhomepage
path: root/.github/workflows/daemon.yml
blob: 7f1be23c5a1f557aea555169227bc415a0585408 (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
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
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Daemon+CLI - Build and test
on:
    # Build whenever a file that affects a Rust crate is changed in a pull request
    pull_request:
        paths-ignore:
            - '**/*.md'
            - .github/workflows/android*.yml
            - .github/workflows/frontend.yml
            - .github/workflows/ios.yml
            - .github/workflows/rustfmt.yml
            - .github/workflows/translations.yml
            - android/**
            - audits/**
            - ci/buildserver-*
            - ci/ci-*
            - dist-assets/**
            - docs/**
            - graphics/**
            - gui/**
            - ios/**
            - mullvad-jni/**
            - scripts/**
            - '.*ignore'
            - .editorconfig
            - .gitattributes
            - Dockerfile
            - build.sh
            - build-apk.sh
            - integration-tests.sh
            - prepare-release.sh
            - rustfmt.toml
            - version-metadata.sh
    # Build if requested manually from the Actions tab
    workflow_dispatch:
jobs:
    build-linux:
        strategy:
            matrix:
                rust: [stable, beta, nightly]

        continue-on-error: ${{ matrix.rust == 'nightly' }}
        runs-on: ubuntu-latest
        steps:
            - name: Checkout repository
              uses: actions/checkout@v2

            - name: Checkout binaries submodule
              run: git submodule update --init --depth=1 dist-assets/binaries

            - name: Install Rust
              uses: actions-rs/toolchain@v1.0.6
              with:
                  toolchain: ${{ matrix.rust }}
                  default: true

            - name: Install Go
              uses: actions/setup-go@v2.1.3
              with:
                  go-version: 1.16

            - name: Install build dependencies
              run: |
                sudo apt-get update
                sudo apt-get install libdbus-1-dev

            - name: Build and test crates
              run: ./ci/check-rust.sh

    build-macos:
        runs-on: macos-latest
        steps:
            - name: Checkout repository
              uses: actions/checkout@v2

            - name: Install Rust
              uses: actions-rs/toolchain@v1.0.6
              with:
                  toolchain: stable
                  default: true

            - name: Install Go
              uses: actions/setup-go@v2.1.3
              with:
                  go-version: 1.16

            - name: Build and test crates
              run: ./ci/check-rust.sh

    build-windows:
        runs-on: windows-latest
        steps:
            - name: Checkout repository
              uses: actions/checkout@v2

            - name: Checkout submodules
              run: git submodule update --init --depth=1

            - name: Calculate Windows libraries cache hash
              id: windows-modules-hash
              shell: bash
              run: |
                hash="$(git grep --recurse-submodules --cached -l '' -- './windows/' | xargs sha1sum | sha1sum | cut -d" " -f1)"
                echo "::set-output name=hash::$hash"

            - name: Cache Windows libraries
              uses: actions/cache@v2
              id: cache-windows-modules
              with:
                path: |
                  ./windows/*/bin/x64-*/*.dll
                  ./windows/*/bin/x64-*/*.lib
                  !./windows/*/bin/x64-*/libcommon.lib
                  !./windows/*/bin/x64-*/libshared.lib
                  !./windows/*/bin/x64-*/libwfp.lib
                key: windows-modules-${{ steps.windows-modules-hash.outputs.hash }}

            - name: Install Rust
              uses: actions-rs/toolchain@v1.0.6
              with:
                  toolchain: stable
                  default: true

            - name: Install Go
              uses: actions/setup-go@v2.1.3
              with:
                  go-version: 1.16

            - name: Install msbuild
              uses: microsoft/setup-msbuild@v1.0.2
              with:
                  vs-version: 16

            - name: Build Windows modules
              if: steps.cache-windows-modules.outputs.cache-hit != 'true'
              shell: bash
              run: ./build-windows-modules.sh

            - name: Build and test crates
              shell: bash
              run: ./ci/check-rust.sh