summaryrefslogtreecommitdiffhomepage
path: root/.github/workflows/rustdoc.yml
blob: bdf496692e8335c516f9839deda43f5c003274ea (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
---
name: Daemon+CLI - Check rust documentation
on:
  pull_request:
    paths:
      - "**/*.rs"
      - "**/Cargo.toml"
      - "**/Cargo.lock"
      - "rust-toolchain.toml"
      - "rustfmt.toml"
      - "ci/cargo-ci.sh"
      - "env.sh"

  workflow_dispatch:
    inputs:
      override_container_image:
        description: Override container image
        type: string
        required: false

permissions: {}

jobs:
  prepare-linux:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Use custom container image if specified
        if: ${{ github.event.inputs.override_container_image != '' }}
        run:
          echo "inner_container_image=${{ github.event.inputs.override_container_image }}"
          >> $GITHUB_ENV

      - name: Use default container image and resolve digest
        if: ${{ github.event.inputs.override_container_image == '' }}
        run: echo "inner_container_image=$(cat ./building/linux-container-image.txt)" >> $GITHUB_ENV

    outputs:
      container_image: ${{ env.inner_container_image }}

  document-linux:
    needs: prepare-linux
    runs-on: ubuntu-latest
    container:
      image: ${{ needs.prepare-linux.outputs.container_image }}
    continue-on-error: true
    steps:
      # Fix for HOME path overridden by GH runners when building in containers, see:
      # https://github.com/actions/runner/issues/863
      - name: Fix HOME path
        run: echo "HOME=/root" >> $GITHUB_ENV

      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Checkout submodules
        run: |
          git config --global --add safe.directory '*'
          git submodule update --init --depth=1 dist-assets/binaries
          git submodule update --init wireguard-go-rs/libwg/wireguard-go

      - name: Setup Rust cache
        uses: Swatinem/rust-cache@v2
        with:
          add-job-id-key: "false" # Preserve cache across jobs
          cache-targets: "false" # Only cache cargo registry

      - name: Check rust docs
        run: ci/cargo-ci.sh doc --workspace --document-private-items --no-deps --keep-going

  document-macos:
    runs-on: macos-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - uses: ./.github/actions/mullvad-build-env

      - name: Check rust docs
        run: ci/cargo-ci.sh doc --workspace --document-private-items --no-deps --keep-going

  document-windows:
    runs-on: windows-latest
    steps:
      # By default, the longest path a filename can have in git on Windows is 260 character.
      - name: Set git config for long paths
        run: |
          git config --system core.longpaths true

      - name: Checkout repository
        uses: actions/checkout@v4

      - uses: ./.github/actions/mullvad-build-env
        with:
          rust-cache-targets: "true"

      - name: Check rust docs
        shell: bash
        run: ci/cargo-ci.sh doc --workspace --document-private-items --no-deps --keep-going