summaryrefslogtreecommitdiff
path: root/.github
diff options
context:
space:
mode:
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/build.yaml88
1 files changed, 67 insertions, 21 deletions
diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml
index 44be1ca5c7..c6e6cb17af 100644
--- a/.github/workflows/build.yaml
+++ b/.github/workflows/build.yaml
@@ -2,17 +2,58 @@ name: Build
on:
workflow_dispatch:
+ inputs:
+ release_run:
+ type: boolean
+ description: Do a release of this build
+ default: false
pull_request:
push:
branches: ["main", "release/*", "project/*"]
tags: ["Second_Life*"]
jobs:
+ # The whole point of the setvar job is that we want to set a variable once
+ # that will be consumed by multiple subsequent jobs. We tried setting it in
+ # the global env, but a job.env can't directly reference the global env
+ # context.
+ setvar:
+ runs-on: ubuntu-latest
+ outputs:
+ release_run: ${{ steps.setvar.outputs.release_run }}
+ branch: ${{ steps.which-branch.outputs.branch }}
+ relnotes: ${{ steps.which-branch.outputs.relnotes }}
+ env:
+ # Build with a tag like "Second_Life#abcdef0" to generate a release page
+ # (used for builds we are planning to deploy).
+ # Even though inputs.release_run is specified with type boolean, which
+ # correctly presents a checkbox, its *value* is a GH workflow string
+ # 'true' or 'false'. If you simply test github.event.inputs.release_run,
+ # it always evaluates as true because it's a non-empty string either way.
+ # When you want to use a string variable as a workflow YAML boolean, it's
+ # important to ensure it's the empty string when false. If you omit || '',
+ # its value when false is "false", which (again) is interpreted as true.
+ RELEASE_RUN: ${{ (github.event.inputs.release_run != 'false' || (github.ref_type == 'tag' && startsWith(github.ref_name, 'Second_Life'))) && 'Y' || '' }}
+ steps:
+ - name: Set Variable
+ id: setvar
+ shell: bash
+ run: |
+ echo "release_run=$RELEASE_RUN" >> "$GITHUB_OUTPUT"
+
+ - name: Determine source branch
+ id: which-branch
+ uses: secondlife/viewer-build-util/which-branch@v2
+ with:
+ token: ${{ github.token }}
+
build:
+ needs: setvar
strategy:
matrix:
runner: [windows-large, macos-12-xl, linux-large]
configuration: [Release, ReleaseOS]
+ Linden: [true]
include:
- runner: macos-12-xl
developer_dir: "/Applications/Xcode_14.0.1.app/Contents/Developer"
@@ -27,8 +68,6 @@ jobs:
outputs:
viewer_channel: ${{ steps.build.outputs.viewer_channel }}
viewer_version: ${{ steps.build.outputs.viewer_version }}
- viewer_branch: ${{ steps.which-branch.outputs.branch }}
- relnotes: ${{ steps.which-branch.outputs.relnotes }}
imagename: ${{ steps.build.outputs.imagename }}
env:
AUTOBUILD_ADDRSIZE: 64
@@ -44,7 +83,10 @@ jobs:
AUTOBUILD_VSVER: "170"
DEVELOPER_DIR: ${{ matrix.developer_dir }}
# Ensure that Linden viewer builds engage Bugsplat.
- BUGSPLAT_DB: ${{ matrix.configuration != 'ReleaseOS' && 'SecondLife_Viewer_2018' || '' }}
+ BUGSPLAT_DB: ${{ matrix.Linden && 'SecondLife_Viewer_2018' || '' }}
+ # Run BUILD steps for Release configuration.
+ # Run BUILD steps for ReleaseOS configuration only for release runs.
+ BUILD: ${{ (matrix.Linden || needs.setvar.outputs.release_run) && 'Y' || '' }}
build_coverity: false
build_log_dir: ${{ github.workspace }}/.logs
build_viewer: true
@@ -63,16 +105,19 @@ jobs:
variants: ${{ matrix.configuration }}
steps:
- name: Checkout code
+ if: env.BUILD
uses: actions/checkout@v4
with:
ref: ${{ github.event.pull_request.head.sha || github.sha }}
- name: Setup python
+ if: env.BUILD
uses: actions/setup-python@v5
with:
python-version: "3.11"
- name: Checkout build variables
+ if: env.BUILD
uses: actions/checkout@v4
with:
repository: secondlife/build-variables
@@ -80,17 +125,20 @@ jobs:
path: .build-variables
- name: Checkout master-message-template
+ if: env.BUILD
uses: actions/checkout@v4
with:
repository: secondlife/master-message-template
path: .master-message-template
- name: Install autobuild and python dependencies
+ if: env.BUILD
run: pip3 install autobuild llsd
- name: Cache autobuild packages
- uses: actions/cache@v4
id: cache-installables
+ if: env.BUILD
+ uses: actions/cache@v4
with:
path: .autobuild-installables
key: ${{ runner.os }}-64-${{ matrix.configuration }}-${{ hashFiles('autobuild.xml') }}
@@ -110,20 +158,15 @@ jobs:
llvm mold libpipewire-0.3-dev
- name: Install windows dependencies
- if: runner.os == 'Windows'
+ if: env.BUILD && runner.os == 'Windows'
run: choco install nsis-unicode
- - name: Determine source branch
- id: which-branch
- uses: secondlife/viewer-build-util/which-branch@v2
- with:
- token: ${{ github.token }}
-
- name: Build
id: build
+ if: env.BUILD
shell: bash
env:
- AUTOBUILD_VCS_BRANCH: ${{ steps.which-branch.outputs.branch }}
+ AUTOBUILD_VCS_BRANCH: ${{ needs.setvar.outputs.branch }}
RUNNER_OS: ${{ runner.os }}
run: |
# set up things the viewer's build.sh script expects
@@ -197,7 +240,7 @@ jobs:
# determine the viewer channel from the branch name
branch=$AUTOBUILD_VCS_BRANCH
- IFS='/' read -ra ba <<< $branch
+ IFS='/' read -ra ba <<< "$branch"
prefix=${ba[0]}
if [ "$prefix" == "project" ]; then
IFS='_' read -ra prj <<< "${ba[1]}"
@@ -250,7 +293,7 @@ jobs:
echo "artifact=$RUNNER_OS$cfg_suffix" >> $GITHUB_OUTPUT
- name: Upload executable
- if: (matrix.configuration != 'ReleaseOS' && steps.build.outputs.viewer_app) || runner.os == 'Linux'
+ if: (matrix.Linden && steps.build.outputs.viewer_app) || runner.os == 'Linux'
uses: actions/upload-artifact@v4
with:
name: "${{ steps.build.outputs.artifact }}-app"
@@ -261,7 +304,7 @@ jobs:
# The other upload of nontrivial size is the symbol file. Use a distinct
# artifact for that too.
- name: Upload symbol file
- if: matrix.configuration != 'ReleaseOS'
+ if: matrix.Linden
uses: actions/upload-artifact@v4
with:
name: "${{ steps.build.outputs.artifact }}-symbols"
@@ -269,7 +312,7 @@ jobs:
${{ steps.build.outputs.symbolfile }}
- name: Upload metadata
- if: matrix.configuration != 'ReleaseOS'
+ if: matrix.Linden
uses: actions/upload-artifact@v4
with:
name: "${{ steps.build.outputs.artifact }}-metadata"
@@ -280,7 +323,7 @@ jobs:
- name: Upload physics package
uses: actions/upload-artifact@v4
# should only be set for viewer-private
- if: matrix.configuration != 'ReleaseOS' && steps.build.outputs.physicstpv
+ if: matrix.Linden && steps.build.outputs.physicstpv
with:
name: "${{ steps.build.outputs.artifact }}-physics"
# emitted by build.sh, zero or one lines
@@ -384,10 +427,13 @@ jobs:
version: ${{ needs.build.outputs.viewer_version }}
release:
- needs: [build, sign-and-package-windows, sign-and-package-mac]
+ needs: [setvar, build, sign-and-package-windows, sign-and-package-mac]
runs-on: ubuntu-latest
- # Build with a tag like "Second_Life#abcdef0" to generate a release page (used for builds we are planning to deploy).
- if: github.ref_type == 'tag' && startsWith(github.ref_name, 'Second_Life')
+ # action-gh-release requires a tag (presumably for automatic generation of
+ # release notes). Possible TODO: if we arrive here but do not have a
+ # suitable tag for github.sha, create one? If we do that, of course remove
+ # this == 'tag' condition.
+ if: needs.setvar.outputs.release_run && github.ref_type == 'tag'
steps:
- uses: actions/download-artifact@v4
with:
@@ -421,7 +467,7 @@ jobs:
Build ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}
${{ needs.build.outputs.viewer_channel }}
${{ needs.build.outputs.viewer_version }}
- ${{ needs.build.outputs.relnotes }}
+ ${{ needs.setvar.outputs.relnotes }}
prerelease: true
generate_release_notes: true
target_commitish: ${{ github.sha }}