Initial public release of Warp.
Repo-Sync-Origin: warpdotdev/warp-internal@12af1d983b
This commit is contained in:
@@ -0,0 +1,139 @@
|
||||
name: Prepare Environment
|
||||
description: A shared set of setup steps to prepare the runtime environment.
|
||||
inputs:
|
||||
target_os:
|
||||
required: true
|
||||
description: The target OS that we're building for ("macos", "linux", "windows", or "wasm").
|
||||
is_self_hosted:
|
||||
required: true
|
||||
description: Whether or not the workflow is running on a self-hosted runner.
|
||||
ref:
|
||||
description: If set, the ref to checkout.
|
||||
install_test_deps:
|
||||
description: If true, dependencies needed for running tests will be installed.
|
||||
install_release_deps:
|
||||
description: If true, dependencies needed for building release artifacts will be installed (e.g., cargo-about for license generation).
|
||||
cache_key:
|
||||
description: If set, the cache key to use. If unset, the cache key will be derived from the target OS.
|
||||
|
||||
runs:
|
||||
using: composite
|
||||
steps:
|
||||
- name: Make GitHub token available in the environment
|
||||
shell: bash
|
||||
run: echo "GH_TOKEN=${{ github.token }}" >> $GITHUB_ENV
|
||||
|
||||
- name: Set up git for Windows
|
||||
if: ${{ inputs.target_os == 'windows' }}
|
||||
shell: bash
|
||||
run: git config --system core.longpaths true
|
||||
|
||||
- name: Set CARGO_HOME location
|
||||
if: ${{ inputs.target_os == 'windows' }}
|
||||
shell: bash
|
||||
run: echo "CARGO_HOME=C:\cargo" >> $GITHUB_ENV
|
||||
|
||||
- name: Determine repository root
|
||||
id: repo-root
|
||||
shell: bash
|
||||
run: |
|
||||
# The action lives at <repo-root>/.github/actions/prepare_environment.
|
||||
# Derive the repository root from the action path.
|
||||
REPO_ROOT=$(cd "${{ github.action_path }}/../../.." && pwd)
|
||||
echo "path=$REPO_ROOT" >> $GITHUB_OUTPUT
|
||||
# Normalize $GITHUB_WORKSPACE through cd/pwd so that path formats
|
||||
# match on Windows (where $GITHUB_WORKSPACE uses backslashes but
|
||||
# pwd produces MSYS-style forward-slash paths).
|
||||
WORKSPACE=$(cd "$GITHUB_WORKSPACE" && pwd)
|
||||
if [ "$REPO_ROOT" = "$WORKSPACE" ]; then
|
||||
echo "is-workspace-root=true" >> $GITHUB_OUTPUT
|
||||
else
|
||||
echo "is-workspace-root=false" >> $GITHUB_OUTPUT
|
||||
fi
|
||||
|
||||
- uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2
|
||||
if: ${{ inputs.is_self_hosted != 'true' && !startsWith(runner.name, 'nsc-runner') }}
|
||||
with:
|
||||
# Make sure x86_64-unknown-linux-gnu and wasm32-unknown-unknown builds
|
||||
# don't share a cache, despite running on the same _host_ architecture.
|
||||
key: ${{ inputs.cache_key != '' && inputs.cache_key || inputs.target_os }}
|
||||
# Only cache runs on the master branch (caches on feature branches
|
||||
# are not reusable).
|
||||
save-if: ${{ github.ref == 'refs/heads/master' }}
|
||||
|
||||
- name: Set up Namespace cache
|
||||
if: ${{ startsWith(runner.name, 'nsc-runner') }}
|
||||
uses: namespacelabs/nscloud-cache-action@a90bb5d4b27522ce881c6e98eebd7d7e6d1653f9 # v1.4.2
|
||||
with:
|
||||
cache: |
|
||||
rust
|
||||
${{ inputs.target_os == 'macos' && 'brew' || '' }}
|
||||
|
||||
- name: Install cargo-binstall
|
||||
uses: cargo-bins/cargo-binstall@dc19f1e48450eefe5a29b8da6c6b00a87d730b37 # v1.18.1
|
||||
env:
|
||||
BINSTALL_VERSION: 1.14.4
|
||||
|
||||
- name: Install dependencies
|
||||
shell: bash
|
||||
run: |
|
||||
cd "${{ steps.repo-root.outputs.path }}"
|
||||
if ${{ inputs.target_os == 'macos' }}; then
|
||||
# Try to install warp-channel-config but don't complain if it cannot
|
||||
# be installed.
|
||||
./script/install_channel_config || true
|
||||
if ${{ inputs.install_release_deps == 'true' }}; then
|
||||
./script/install_cargo_release_deps
|
||||
else
|
||||
./script/install_cargo_build_deps
|
||||
fi
|
||||
elif ${{ inputs.target_os == 'linux' }}; then
|
||||
# Update the apt cache before installing dependencies - it can be slow, so the install scripts
|
||||
# don't do it.
|
||||
sudo apt-get update -y
|
||||
|
||||
if ${{ inputs.install_test_deps == 'true' }}; then
|
||||
./script/linux/install_test_deps
|
||||
elif ${{ inputs.install_release_deps == 'true' }}; then
|
||||
./script/linux/install_build_deps
|
||||
./script/install_cargo_release_deps
|
||||
else
|
||||
./script/linux/install_build_deps
|
||||
fi
|
||||
elif ${{ inputs.target_os == 'windows' }}; then
|
||||
./script/windows/install_build_deps.ps1
|
||||
if ${{ inputs.install_release_deps == 'true' }}; then
|
||||
./script/install_cargo_release_deps
|
||||
fi
|
||||
elif ${{ inputs.target_os == 'wasm' }}; then
|
||||
# Update the apt cache before installing dependencies - it can be slow, so the install scripts
|
||||
# don't do it (to avoid doing it more than once).
|
||||
sudo apt update -y
|
||||
./script/wasm/install_build_deps
|
||||
else
|
||||
echo "::error::Missing logic to install build dependencies for OS \"${{ inputs.target_os }}\""
|
||||
exit 1
|
||||
fi
|
||||
|
||||
- name: Install Node
|
||||
uses: actions/setup-node@3235b876344d2a9aa001b8d1453c930bba69e610 # v3.9.1
|
||||
with:
|
||||
node-version: 20.9.0
|
||||
|
||||
- name: Enable Corepack
|
||||
# Enables NodeJS's Corepack tool, which is necessary to use the right version of `yarn` to
|
||||
# build TS command signatures.
|
||||
shell: bash
|
||||
run: corepack enable
|
||||
|
||||
- name: Install protoc for generating rust bindings of protobuf APIs
|
||||
# Install protoc for generating rust bindings of protobuf APIs.
|
||||
uses: ConorMacBride/install-package@3e7ad059e07782ee54fa35f827df52aae0626f30 # v1
|
||||
with:
|
||||
brew: protobuf
|
||||
choco: protoc
|
||||
|
||||
- uses: maxim-lobanov/setup-xcode@ed7a3b1fda3918c0306d1b724322adc0b8cc0a90 # v1.7.0
|
||||
if: ${{ inputs.target_os == 'macos' && inputs.is_self_hosted != 'true' }}
|
||||
with:
|
||||
xcode-version: '26'
|
||||
Reference in New Issue
Block a user