-
Notifications
You must be signed in to change notification settings - Fork 437
/
action.yml
83 lines (72 loc) · 2.46 KB
/
action.yml
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
# yamllint disable rule:line-length
name: "Setup build environment"
description: "Setup the build environment. An action so that it can be shared between in-tree/out-of-tree jobs"
inputs:
cache-enabled:
required: true
default: true
cache-suffix:
description: |
Additional string that is used to compute the ccache hash.
Different jobs running the action need distinct values for this key,
but the content is irrelevant.
required: false
default: ''
torch-version:
description: |
Additional string to determine wether to test against a stable
torch release or against the nightly build
required: false
default: 'nightly'
runs:
using: "composite"
steps:
- name: Set up Python
if: ${{ runner.arch == 'X64' }}
uses: actions/setup-python@v4
with:
python-version: '3.11'
- name: Install MLIR Python depends
if: ${{ runner.os != 'Linux' }}
run: |
python -m pip install -r $GITHUB_WORKSPACE/externals/llvm-project/mlir/python/requirements.txt
shell: bash
- name: Install PyTorch nightly depends
if: ${{ runner.os != 'Linux' }}
run: |
python -m pip install -r pytorch-requirements.txt
python -m pip install -r build-requirements.txt
shell: bash
- name: Install prerequisites (Linux)
if: ${{ runner.os == 'Linux' }}
run: sudo apt-get install --yes ccache ninja-build
shell: bash
- name: Install prerequisites (macOS)
if: ${{ runner.os == 'macOS' }}
run: brew install ccache ninja
shell: bash
- name: Install prerequisites (Windows)
if: ${{ runner.os == 'Windows' }}
run: |
pip install ninja
choco install ccache --yes
shell: bash
- name: Configure ccache
if: ${{ inputs.cache-enabled == 'true' }}
run: |
rm -rf ${{ github.workspace }}/.ccache
mkdir -p ${{ github.workspace }}/.ccache
ccache --set-config "cache_dir=${{ github.workspace }}/.ccache"
ccache --set-config "compression=true"
ccache --set-config "max_size=300M"
ccache --zero-stats
shell: bash
- name: Enable ccache
if: ${{ inputs.cache-enabled == 'true' }}
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/.ccache
key: ${{ runner.os }}-${{ inputs.cache-suffix }}-${{ github.sha }}
restore-keys: |
${{ runner.os }}-${{ inputs.cache-suffix }}-
${{ runner.os }}-