forked from IGinX-THU/IGinX
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathaction.yml
157 lines (144 loc) · 5.77 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
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
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
name: "dependence-setup"
description: "environment dependence setup"
inputs:
python-version:
description: "python version"
required: false
default: 3.11
java:
description: "java version"
required: false
default: 8
os:
description: "running environment"
required: false
default: ubuntu-latest
scope:
description: "partial dependency required"
required: false
default: all
# all: setup all
docker-required:
description: "is docker needed in this test"
required: false
default: "false"
free-thread-python-required:
description: "is free-threading python needed"
required: false
default: "false"
iginx-conda-flag:
description: "whether to use conda"
required: false
default: "false"
iginx-conda-env:
description: "conda env name"
required: false
runs:
using: "composite"
steps:
# need to set up timezone and enlarge JVM heap size manually on windows
- if: runner.os == 'Windows'
name: Set Dynamic Timezone
shell: cmd
run: |
tzutil /s "China Standard Time"
echo "JAVA_OPTS=-Xmx4g -Xms2g" >> %GITHUB_ENV%
# after this setup, every shell using login mode will be in conda env
# conda should be set at very beginning because this action will delete ~/.bashrc & ~/.bash_profile
# and regenerate them by initializing conda
- if: inputs.scope=='all' && inputs.iginx-conda-flag == 'true'
name: Setup Miniconda
uses: conda-incubator/[email protected]
with:
miniconda-version: ${{ inputs.conda-version }}
python-version: ${{ inputs.python-version }}
activate-environment: ${{ inputs.iginx-conda-env }}
channel-priority: strict
run-post: "false"
# we use a patched version of lima(slower) because colima cannot start on M1 chips and the docker task is lightweight.
- if: runner.os == 'macOS' && inputs.docker-required=='true'
name: Install Docker on MacOS
shell: bash
run: |
brew update
brew install docker qemu
brew install colima
LIMACTL_PATH=$(brew --prefix)/bin/limactl
sudo curl -L -o $LIMACTL_PATH https://github.com/mikekazakov/lima-nohvf/raw/master/limactl && sudo chmod +x $LIMACTL_PATH
colima start --network-address --arch arm64 --vm-type=qemu
docker --version
- if: inputs.scope=='all'
name: Write Python dependencies to requirements.txt
shell: bash
run: |
echo "pandas" >> requirements.txt
echo "numpy" >> requirements.txt
echo "pemjax" >> requirements.txt
echo "thrift" >> requirements.txt
echo "fastparquet" >> requirements.txt
echo "tqdm" >> requirements.txt
echo "requests" >> requirements.txt
echo "torch" >> requirements.txt
- if: inputs.scope=='all' && inputs.iginx-conda-flag != 'true'
name: Set up Python ${{ inputs.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ inputs.python-version }}
cache: "pip" # caching pip dependencies
# when using login mode shell, setup-python does not take effect.
# thus manually add python path to PATH
- if: inputs.scope=='all' && inputs.iginx-conda-flag != 'true'
name: Add System Python to PATH
shell: bash
run: |
PYTHON_PATH=$(dirname $(which python))
echo $PYTHON_PATH
echo "IGINX_PYTHON_PATH=$PYTHON_PATH" >> $GITHUB_ENV
- if: inputs.scope=='all'
name: Install Python dependencies
shell: bash -el {0}
run: |
if [ ! -z "$IGINX_PYTHON_PATH" ]; then
export PATH="$IGINX_PYTHON_PATH:$PATH"
fi
echo $PATH
which python
python -m pip install --upgrade pip
pip install -r requirements.txt
- if: inputs.free-thread-python-required=='true'
name: Install free-thread python
uses: ./.github/actions/service/freeThreadPython
- name: Set up JDK ${{ inputs.java }}
uses: actions/setup-java@v4
with:
java-version: ${{ inputs.java }}
distribution: ${{ runner.os == 'macOS' && matrix.java == '8' && 'liberica' || 'temurin' }}
cache: "maven"
- name: Check Java & Python Version
shell: bash
run: |
java -version
which java
python --version
which python
- name: Check Java & Python Version in Conda and set conda env name
if: inputs.iginx-conda-flag == 'true'
shell: bash -el {0}
run: |
java -version
which java
python --version
which python
# to access conda env in scripts
echo "IGINX_CONDA_ENV=${{ inputs.iginx-conda-env }}" >> $GITHUB_ENV
echo "IGINX_CONDA_FLAG=${{ inputs.iginx-conda-flag }}" >> $GITHUB_ENV
- name: Get project info
id: project
uses: ./.github/actions/project
- name: Set up environment variable
shell: bash
run: |
echo "VERSION=${{ steps.project.outputs.version }}" >> $GITHUB_ENV
PROJECT_ROOT=${{ steps.project.outputs.workspace }}
echo "PROJECT_ROOT=${PROJECT_ROOT}" >> $GITHUB_ENV
echo "SERVICE_DIR=${PROJECT_ROOT}/.github/actions/service" >> $GITHUB_ENV