summaryrefslogtreecommitdiff
path: root/.github/workflows/build.yaml
blob: 00dd7ed1168381f592c96a191dcf849968ad5d50 (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
name: Build

on:
  workflow_dispatch:
  pull_request:
  push:
    branches: ["actions"]
    tags: ["*"]

jobs:
  build:
    strategy:
      matrix:
        runner: [windows-large, macos-12-xl]
        configuration: [Release]
        addrsize: [64]
        python-version: ["3.11"]
        include:
          - runner: windows-large
            configuration: Release
            addrsize: 32
            python-version: "3.11"
          - runner: macos-12-xl
            developer_dir: "/Applications/Xcode_14.0.1.app/Contents/Developer"
    runs-on: ${{ matrix.runner }}
    env:
      AUTOBUILD_ADDRSIZE: ${{ matrix.addrsize }}
      AUTOBUILD_CONFIGURATION: ${{ matrix.configuration }}
      # authorizes fetching private constituent packages
      AUTOBUILD_GITHUB_TOKEN: ${{ secrets.SHARED_AUTOBUILD_GITHUB_TOKEN }}
      AUTOBUILD_INSTALLABLE_CACHE: ${{ github.workspace }}/.autobuild-installables
      AUTOBUILD_VARIABLES_FILE: ${{ github.workspace }}/.build-variables/variables
      AUTOBUILD_VSVER: "170"
      AUTOBUILD_BUILD_ID: ${{ github.run_id }}
      DEVELOPER_DIR: ${{ matrix.developer_dir }}
      # Ensure that viewer builds engage Bugsplat.
      BUGSPLAT_DB: "SecondLife_Viewer_2018"
      # Setting this variable directs Linden's TUT test driver code to capture
      # test-program log output at the specified level, but to display it only if
      # the individual test fails.
      LOGFAIL: DEBUG
      # if unit tests fail to import llsd (i.e. wrong Python interpreter),
      # make py.exe enumerate the possibilities and explain its choice
      PYLAUNCHER_DEBUG: "1"
      GIT_REF: ${{ github.head_ref || github.ref }}
      LL_SKIP_REQUIRE_SYSROOT: 1
    steps:
      - name: Checkout code
        uses: actions/checkout@v3
        with:
          ref: ${{ github.event.pull_request.head.sha || github.sha }}

      - name: Setup python
        uses: actions/setup-python@v4
        with:
          python-version: ${{ matrix.python-version }}

      - name: Checkout build variables
        uses: actions/checkout@v3
        with:
          repository: secondlife/build-variables
          ref: viewer
          path: .build-variables

      - name: Install autobuild 
        run: pip3 install autobuild llsd

      - name: Cache autobuild packages
        uses: actions/cache@v3
        id: cache-installables
        with:
          path: .autobuild-installables
          key: ${{ runner.os }}-${{ matrix.addrsize }}-${{ matrix.configuration }}-${{ hashFiles('autobuild.xml') }}
          restore-keys: |
            ${{ runner.os }}-${{ matrix.addrsize }}-${{ matrix.configuration }}-
            ${{ runner.os }}-${{ matrix.addrsize }}-

      - name: Install windows dependencies
        if: runner.os == 'Windows'
        run: choco install nsis-unicode

      - name: Build
        id: build
        shell: bash
        env:
          RUNNER_OS: ${{ runner.os }}
        run: |
          # On windows we need to point the build to the correct python
          # as neither CMake's FindPython nor our custom Python.cmake module
          # will resolve the correct interpreter location.
          if [[ "$RUNNER_OS" == "Windows" ]]; then
            export PYTHON="$(cygpath -m "$(which python)")"
            echo "Python location: $PYTHON"
          fi

          autobuild configure --id "${{ github.run_id }}" -- -DVIEWER_CHANNEL="Second Life Test ${GIT_REF##*/}"
          autobuild build --no-configure

          # Find artifacts
          if [[ "$RUNNER_OS" == "Windows" ]]; then
            installer_path=$(find ./build-*/newview/ | grep '_Setup\.exe')
            installer_name="$(basename $installer_path)"
          elif [[ "$RUNNER_OS" == "macOS" ]]; then
            installer_path=$(find ./build-*/newview/ | grep '\.dmg')
            installer_name="$(basename $installer_path)"
          fi

          echo "installer_path=$installer_path" >> $GITHUB_OUTPUT
          echo "installer_name=$installer_name" >> $GITHUB_OUTPUT
      
      - name: Upload installer
        uses: actions/upload-artifact@v3
        with:
          name: ${{ steps.build.outputs.installer_name }}
          path: ${{ steps.build.outputs.installer_path }}