diff options
| author | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2021-03-12 10:27:37 -0300 |
|---|---|---|
| committer | Janito Vaqueiro Ferreira Filho <janito@mullvad.net> | 2021-03-12 10:27:37 -0300 |
| commit | 5945235cfbb0648c61e4d1740d775070c50e5702 (patch) | |
| tree | d2e5e51efefbab703cb575beb0205629be9ef8a5 | |
| parent | 041ba31f1b9fd9a88b5ffd2e5c06bd07e8a2abd8 (diff) | |
| parent | 84d55360aabefd7dd2fddf7a7caaef5d643b6f5b (diff) | |
| download | mullvadvpn-5945235cfbb0648c61e4d1740d775070c50e5702.tar.xz mullvadvpn-5945235cfbb0648c61e4d1740d775070c50e5702.zip | |
Merge branch 'migrate-rust-builds-to-github-actions'
| -rw-r--r-- | .github/workflows/daemon.yml | 110 | ||||
| -rw-r--r-- | .github/workflows/rustfmt.yml | 28 | ||||
| -rwxr-xr-x | ci/check-rust.sh | 22 |
3 files changed, 160 insertions, 0 deletions
diff --git a/.github/workflows/daemon.yml b/.github/workflows/daemon.yml new file mode 100644 index 0000000000..7848c9fb14 --- /dev/null +++ b/.github/workflows/daemon.yml @@ -0,0 +1,110 @@ +name: Mullvad VPN daemon CI +on: + # Build whenever a file that affects a Rust crate is changed by a push + push: + paths-ignore: + - '**/*.md' + - .github/workflows/android*.yml + - .github/workflows/rustfmt.yml + - android/** + - audits/** + - ci/buildserver-* + - ci/ci-* + - dist-assets/** + - docs/** + - graphics/** + - gui/** + - ios/** + - mullvad-jni/** + - scripts/** + - '.*ignore' + - .editorconfig + - .gitattributes + - .travis.yml + - Dockerfile + - build.sh + - build-apk.sh + - integration-tests.sh + - prepare-release.sh + - rustfmt.toml + - update-api-address.sh + - update-relays.sh + - version-metadata.sh + # Build if requested manually from the Actions tab + workflow_dispatch: +jobs: + build-linux: + strategy: + matrix: + rust: [stable, beta, 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: ATiltedTree/setup-rust@v1.0.4 + with: + rust-version: ${{ matrix.rust }} + + - name: Install Go + uses: actions/setup-go@v2.1.3 + with: + go-version: 1.16 + + - name: Install build dependencies + run: 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: ATiltedTree/setup-rust@v1.0.4 + with: + rust-version: stable + + - 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: Install Rust + uses: ATiltedTree/setup-rust@v1.0.4 + with: + rust-version: stable + + - 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 and test crates + shell: bash + run: ./ci/check-rust.sh diff --git a/.github/workflows/rustfmt.yml b/.github/workflows/rustfmt.yml new file mode 100644 index 0000000000..3f95dfda3e --- /dev/null +++ b/.github/workflows/rustfmt.yml @@ -0,0 +1,28 @@ +name: Rust formatting check CI +on: + # Check whenever a file that affects Rust formatting is changed by a push + push: + paths: + - .github/workflows/rustfmt.yml + - rustfmt.toml + - '**/*.rs' + # Check if requested manually from the Actions tab + workflow_dispatch: +jobs: + check-formatting: + runs-on: ubuntu-latest + steps: + - name: Checkout repository + uses: actions/checkout@v2 + + - name: Install nightly Rust + uses: ATiltedTree/setup-rust@v1.0.4 + with: + rust-version: nightly + components: rustfmt + + - name: Check formatting + run: | + rustfmt --version + cargo fmt -- --check --unstable-features + diff --git a/ci/check-rust.sh b/ci/check-rust.sh new file mode 100755 index 0000000000..4862bc84dd --- /dev/null +++ b/ci/check-rust.sh @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +set -eux + +export RUSTFLAGS="--deny warnings" + +# Build WireGuard Go +./wireguard/build-wireguard-go.sh + +# Build Windows modules +case "$(uname -s)" in + MINGW*|MSYS_NT*) + time ./build_windows_modules.sh --dev-build + ;; +esac + +# Build Rust crates +source env.sh +time cargo build --locked --verbose + +# Test Rust crates +time cargo test --locked --verbose |
