|
| 1 | +# ┏━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┓ |
| 2 | +# ┃ ██████ ██████ ██████ █ █ █ █ █ █▄ ▀███ █ ┃ |
| 3 | +# ┃ ▄▄▄▄▄█ █▄▄▄▄▄ ▄▄▄▄▄█ ▀▀▀▀▀█▀▀▀▀▀ █ ▀▀▀▀▀█ ████████▌▐███ ███▄ ▀█ █ ▀▀▀▀▀ ┃ |
| 4 | +# ┃ █▀▀▀▀▀ █▀▀▀▀▀ █▀██▀▀ ▄▄▄▄▄ █ ▄▄▄▄▄█ ▄▄▄▄▄█ ████████▌▐███ █████▄ █ ▄▄▄▄▄ ┃ |
| 5 | +# ┃ █ ██████ █ ▀█▄ █ ██████ █ ███▌▐███ ███████▄ █ ┃ |
| 6 | +# ┣━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┫ |
| 7 | +# ┃ Copyright (c) 2017, the Perspective Authors. ┃ |
| 8 | +# ┃ ╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌╌ ┃ |
| 9 | +# ┃ This file is part of the Perspective library, distributed under the terms ┃ |
| 10 | +# ┃ of the [Apache License 2.0](https://www.apache.org/licenses/LICENSE-2.0). ┃ |
| 11 | +# ┗━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━┛ |
| 12 | + |
| 13 | +name: "Initialize" |
| 14 | +description: "Initialize the build environment with caching" |
| 15 | + |
| 16 | +inputs: |
| 17 | + skip_cache: |
| 18 | + description: "Don't use cache from previous builds" |
| 19 | + |
| 20 | +runs: |
| 21 | + using: "composite" |
| 22 | + steps: |
| 23 | + # - name: Clean System |
| 24 | + # uses: AdityaGarg8/remove-unwanted-software@v3 |
| 25 | + # if: ${{ runner.os == 'Linux' }} |
| 26 | + # with: |
| 27 | + # remove-android: "true" |
| 28 | + # remove-dotnet: "true" |
| 29 | + # remove-haskell: "true" |
| 30 | + # remove-codeql: "true" |
| 31 | + |
| 32 | + - name: Install pnpm |
| 33 | + uses: pnpm/action-setup@v3 |
| 34 | + with: |
| 35 | + version: 9 |
| 36 | + |
| 37 | + - name: Setup emsdk cache |
| 38 | + uses: actions/cache@v4 |
| 39 | + id: emsdk-cache |
| 40 | + if: ${{ inputs.skip_cache == 'false' }} |
| 41 | + with: |
| 42 | + path: | |
| 43 | + ~/boost_1_82_0/ |
| 44 | + ~/.emsdk/ |
| 45 | + ~/.llvm/ |
| 46 | + key: ${{ runner.os }}-emsdk-${{ hashFiles('package.json') }} |
| 47 | + restore-keys: | |
| 48 | + ${{ runner.os }}-emsdk- |
| 49 | +
|
| 50 | + - name: Setup pip cache |
| 51 | + uses: actions/cache@v4 |
| 52 | + if: ${{ inputs.skip_cache == 'false' }} |
| 53 | + with: |
| 54 | + path: | |
| 55 | + ~/.cache/pip |
| 56 | + ~/py_modules/ |
| 57 | + key: ${{ runner.os }}-pip-${{ hashFiles('**/setup.py') }} |
| 58 | + restore-keys: | |
| 59 | + ${{ runner.os }}-pip- |
| 60 | +
|
| 61 | + - name: Setup cargo cache |
| 62 | + uses: actions/cache@v4 |
| 63 | + if: ${{ inputs.skip_cache == 'false' }} |
| 64 | + with: |
| 65 | + key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} |
| 66 | + path: | |
| 67 | + ~/.cargo/bin/ |
| 68 | + ~/.cargo/registry/index/ |
| 69 | + ~/.cargo/registry/cache/ |
| 70 | + ~/.cargo/git/db/ |
| 71 | + rust/perspective-viewer/target/ |
| 72 | + restore-keys: | |
| 73 | + ${{ runner.os }}-cargo- |
| 74 | +
|
| 75 | + - name: ccache |
| 76 | + uses: hendrikmuhs/[email protected] |
| 77 | + if: ${{ inputs.skip_cache == 'false' }} |
| 78 | + with: |
| 79 | + key: ${{ github.job }}-${{ matrix.os }} |
| 80 | + |
| 81 | + - name: Set up Python ${{ matrix.python-version }} |
| 82 | + uses: actions/setup-python@v5 |
| 83 | + with: |
| 84 | + python-version: ${{ matrix.python-version }} |
| 85 | + cache: "pip" |
| 86 | + |
| 87 | + - name: Use Node.js ${{ matrix.node-version }} |
| 88 | + uses: actions/setup-node@v4 |
| 89 | + with: |
| 90 | + node-version: ${{ matrix.node-version }} |
| 91 | + cache: "pnpm" |
| 92 | + cache-dependency-path: pnpm-lock.yaml |
| 93 | + |
| 94 | + - name: Install latest nightly rust |
| 95 | + uses: dtolnay/rust-toolchain@nightly |
| 96 | + with: |
| 97 | + toolchain: nightly-2024-05-07 |
| 98 | + targets: wasm32-unknown-unknown |
| 99 | + components: rustfmt, clippy, rust-src |
| 100 | + |
| 101 | + - name: Install LLVM 17 |
| 102 | + uses: KyleMayes/install-llvm-action@v2 |
| 103 | + with: |
| 104 | + version: "17" |
| 105 | + directory: "./.llvm" |
| 106 | + cached: true |
| 107 | + |
| 108 | + # JS |
| 109 | + - name: Install JS dependencies |
| 110 | + shell: bash |
| 111 | + run: pnpm install |
| 112 | + |
| 113 | + - name: Install venv |
| 114 | + shell: bash |
| 115 | + run: |
| 116 | + |
| 117 | + - name: Activate virtualenv |
| 118 | + shell: bash |
| 119 | + run: | |
| 120 | + python3 -m venv py_modules |
| 121 | + . ./py_modules/bin/activate |
| 122 | + echo PATH=$PATH >> $GITHUB_ENV |
| 123 | + echo VIRTUAL_ENV=$VIRTUAL_ENV >> $GITHUB_ENV |
| 124 | + pip3 install maturin |
| 125 | +
|
| 126 | + - name: Linux init steps |
| 127 | + shell: bash |
| 128 | + run: sudo node tools/perspective-scripts/install_tools.mjs |
| 129 | + if: ${{ runner.os == 'Linux' }} |
| 130 | + |
| 131 | + - name: Install CCache |
| 132 | + shell: bash |
| 133 | + run: sudo apt install -y ccache |
0 commit comments