-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (139 loc) · 5.17 KB
/
aws_runner_old.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
name: aws_runner_old
on: workflow_dispatch
jobs:
start-runner:
runs-on: ubuntu-latest
outputs:
label: ${{ steps.start-ec2-runner.outputs.label }}
ec2-instance-id: ${{ steps.start-ec2-runner.outputs.ec2-instance-id }}
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_KEY_SECRET }}
aws-region: ${{ vars.AWS_REGION }}
- name: Start EC2 runner
id: start-ec2-runner
uses: machulav/ec2-github-runner@v2
with:
mode: start
github-token: ${{ secrets.GH_TOKEN }}
ec2-image-id: ${{ vars.AWS_IMAGE_ID }}
ec2-instance-type: ${{ vars.AWS_INSTANCE_TYPE }}
subnet-id: ${{ vars.AWS_SUBNET }}
security-group-id: ${{ vars.AWS_SECURITY_GROUP }}
test-model:
name: Do the job on the runner
needs: [start-runner] # push-model, build, build-docker, push-weights, start-runner] # required to start the main job when the runner is ready
runs-on: ${{ needs.start-runner.outputs.label }} # run the job on the newly created runner
steps:
- run: export HOME=/home/ubuntu
- name: do it
run: echo $HOME
# Setups singularity to the job to make it accessible to other steps
# Cleanup steps to free up disk space
- name: Cleanup disk space for large docker images
run: |
sudo rm -rf /usr/share/dotnet
sudo rm -rf /opt/ghc
sudo rm -rf "/usr/local/share/boost"
sudo rm -rf /opt/hostedtoolcache
sudo rm -rf "$AGENT_TOOLSDIRECTORY"
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# if set to "true" but frees about 6 GB
tool-cache: false
# all of these default to true, but feel free to set to
# "false" if necessary for your workflow
android: true
dotnet: true
haskell: true
large-packages: true
docker-images: false
# Datalad get the sample dataset
- name: Get sample dataset
run: |
apt-get update
apt install unzip datalad python3-pip tree -y
python3 -m pip install datalad-installer datalad-osf
datalad-installer --sudo ok git-annex -m datalad/git-annex:release
sudo git config --global filter.annex.process "git-annex filter-process"
- name: configure git credentials
run: |
git config --system user.name "test_aws"
git config --system user.email "test_aws"
# If branchName is empty use issue number, else, use the branchName 🟢
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: datalad get
run: |
datalad siblings
datalad siblings
cd PialNN/pialnn/1.0.0/data
pwd
datalad get .
find . -name "*.zip" -exec unzip {} \;
mv example example_aws4
pwd
tree
- run: |
git config user.name
git config user.email
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: example_aws4
path: /actions-runner/_work/test-aws/test-aws/PialNN/pialnn/1.0.0/data/example_aws4
datalad-push:
name: running datalad push as a separate job
needs: [start-runner, test-model]
runs-on: ${{ needs.start-runner.outputs.label }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- run: |
git config user.name
git config user.email
- name: configure git credentials
run: |
git config --system user.name "test_aws"
git config --system user.email "test_aws"
- run: tree
- name: Download artifacts
uses: actions/download-artifact@v2
with:
name: example_aws4
- name: datalad push
run: |
pwd
tree
datalad save -m "pushing new unzipped folder" PialNN/pialnn/1.0.0/data/example_aws4
datalad push -f all --to test-aws-storage
datalad push --to origin
env:
OSF_TOKEN: ${{ secrets.OSF_TOKEN }}
stop-runner:
name: Stop self-hosted EC2 runner
needs: [start-runner, test-model, datalad-push] # required to wait when the main job is done
runs-on: ubuntu-latest
if: ${{ always() }}
# required to stop the runner even if the error happened in the previous jobs
steps:
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_KEY_SECRET }}
aws-region: ${{ vars.AWS_REGION }}
- name: Stop EC2 runner
uses: machulav/ec2-github-runner@v2
with:
mode: stop
github-token: ${{ secrets.GH_TOKEN }}
label: ${{ needs.start-runner.outputs.label }}
ec2-instance-id: ${{ needs.start-runner.outputs.ec2-instance-id }}