-
Notifications
You must be signed in to change notification settings - Fork 63
95 lines (80 loc) · 3.02 KB
/
run_experiment.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
name: Running experiment
on:
pull_request:
types: [ labeled ]
jobs:
check-label-prefix:
runs-on: ubuntu-latest
env:
LABEL_NAME: ${{ github.event.label.name }}
outputs:
need_experiment: ${{ steps.check.outputs.need_experiment }}
label_name: ${{ env.LABEL_NAME }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- id: check
run: |
LABEL_NAME=$LABEL_NAME
PREFIX="need_experiment"
if [[ "$LABEL_NAME" == "$PREFIX"* ]]; then
echo "need_experiment=true"
echo "need_experiment=true" >> $GITHUB_OUTPUT
else
echo "need_experiment=false" >> $GITHUB_OUTPUT
fi
build:
needs: check-label-prefix
if: needs.check-label-prefix.outputs.need_experiment == 'true'
name: Run experiment
runs-on: ubuntu-latest
permissions:
contents: read
pull-requests: write
issues: write
steps:
- name: Check out code
uses: actions/checkout@v2
- name: Get the branch name
id: get-branch-name
run: echo "::set-output name=BRANCH_NAME::$(echo ${GITHUB_HEAD_REF:-${GITHUB_REF#refs/heads/}})"
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: us-east-2
- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Build, tag, and push image to Amazon ECR
id: build-image
env:
ECR_REGISTRY: ${{ steps.login-ecr.outputs.registry }}
ECR_REPOSITORY: taichi_3d_gaussian_splatting
# use the branch name for the Docker tag
IMAGE_TAG: ${{ steps.get-branch-name.outputs.BRANCH_NAME }}
run: |
aws ecr get-login-password --region us-east-2 | docker login --username AWS --password-stdin 763104351884.dkr.ecr.us-east-2.amazonaws.com
docker build -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile.aws .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image_uri::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: '3.10'
cache: 'pip'
- run: pip3 install sagemaker argparse PyGithub boto3 sagemaker-experiments
- name: Run the experiment
id: run-experiment
env:
GITHUB_OWNER: ${{ github.repository_owner }}
GITHUB_REPO: ${{ github.repository }}
GITHUB_SHA: ${{ github.sha }}
BRANCH_NAME: ${{ steps.get-branch-name.outputs.BRANCH_NAME }}
GITHUB_ACCESS_TOKEN: ${{ secrets.GITHUB_TOKEN }}
PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
IMAGE_URI: ${{ steps.build-image.outputs.image_uri }}
LABEL_NAME: ${{ needs.check-label-prefix.outputs.label_name }}
run: |
python3 ci/run_experiment.py