-
Notifications
You must be signed in to change notification settings - Fork 25
113 lines (95 loc) · 3.38 KB
/
ci.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
name: ci
on:
push:
branches:
- "*"
pull_request:
branches:
- master
jobs:
build:
runs-on: ubuntu-22.04
env:
CONTAINER_REGISTRY_USERNAME: ${{ secrets.CONTAINER_REGISTRY_USERNAME }}
CONTAINER_REGISTRY_TOKEN: ${{ secrets.CONTAINER_REGISTRY_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 50
- name: Install docker for ansible
run: |
ansible-galaxy collection install community.docker:3.4.5
pipx inject ansible-core docker six
- id: changed-files
name: Check changed files
run: python3 ci/check-changed-files.py | bash
- name: Set up JDK
if: steps.changed-files.outputs.gradle == '1'
uses: actions/setup-java@v3
with:
distribution: "zulu"
java-version: "11"
cache: "gradle"
- name: Set up node
if: steps.changed-files.outputs.yarn == '1'
uses: actions/setup-node@v3
with:
node-version: "16"
- name: Get yarn cache directory path
if: steps.changed-files.outputs.yarn == '1'
id: yarn-cache-dir-path
run: echo "dir=$(yarn cache dir)" >> $GITHUB_OUTPUT
- name: Use yarn cache
if: steps.changed-files.outputs.yarn == '1'
uses: actions/cache@v3
id: yarn-cache
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Build judgels-server
if: steps.changed-files.outputs.judgels-server == '1'
run: ./deployment/scripts/build_judgels_server.sh
- name: Build judgels-client
if: steps.changed-files.outputs.judgels-client == '1'
run: ./deployment/scripts/build_judgels_client.sh
- name: Build judgels-grader
if: steps.changed-files.outputs.judgels-grader == '1'
run: ./deployment/scripts/build_judgels_grader.sh
deploy-tlx-staging:
needs: build
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 50
- name: Check out deployment repository
uses: actions/checkout@v3
with:
repository: ${{ secrets.TLX_STAGING_DEPLOYMENT_REPOSITORY }}
token: ${{ secrets.TLX_STAGING_DEPLOYMENT_TOKEN }}
path: deployment/ansible/env
- name: Prepare staging environment SSH key
run: chmod 600 deployment/ansible/env/deployment_rsa
- id: changed-files
name: Check changed files
run: python3 ci/check-changed-files.py | bash
- name: Deploy judgels-server
if: steps.changed-files.outputs.judgels-server == '1'
run: |
eval "$(ssh-agent -s)"
ssh-add deployment/ansible/env/deployment_rsa
./deployment/scripts/deploy_judgels_server.sh
- name: Deploy judgels-client
if: steps.changed-files.outputs.judgels-client == '1'
run: |
eval "$(ssh-agent -s)"
ssh-add deployment/ansible/env/deployment_rsa
./deployment/scripts/deploy_judgels_client.sh
- name: Deploy judgels-grader
if: steps.changed-files.outputs.judgels-grader == '1'
run: |
eval "$(ssh-agent -s)"
ssh-add deployment/ansible/env/deployment_rsa
./deployment/scripts/deploy_judgels_grader.sh