forked from AcademySoftwareFoundation/OpenCue
-
Notifications
You must be signed in to change notification settings - Fork 0
173 lines (148 loc) · 5.52 KB
/
packaging-pipeline.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
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
name: OpenCue Packaging Pipeline
# Trigger this pipeline on new commits to master.
on:
push:
branches: [ master ]
jobs:
integration_test:
name: Run Integration Test
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Run test
run: ci/run_integration_test.sh
- name: Archive log files
uses: actions/upload-artifact@v3
if: ${{ always() }}
with:
name: test-logs
path: /tmp/opencue-test/*.log
build_components:
needs: integration_test
strategy:
matrix:
component: [cuebot, rqd]
include:
- component: cuebot
NAME: Cuebot
ARTIFACTS: cuebot-${BUILD_ID}-all.jar opencue-cuebot-${BUILD_ID}-1.noarch.rpm
- component: rqd
NAME: RQD
ARTIFACTS: rqd-${BUILD_ID}-all.tar.gz
- component: cuegui
NAME: CueGUI
ARTIFACTS: cuegui-${BUILD_ID}-all.tar.gz
- component: pycue
NAME: PyCue
ARTIFACTS: pycue-${BUILD_ID}-all.tar.gz
- component: pyoutline
NAME: PyOutline
ARTIFACTS: pyoutline-${BUILD_ID}-all.tar.gz
- component: cuesubmit
NAME: CueSubmit
ARTIFACTS: cuesubmit-${BUILD_ID}-all.tar.gz
- component: cueadmin
NAME: CueAdmin
ARTIFACTS: cueadmin-${BUILD_ID}-all.tar.gz
name: Build ${{ matrix.NAME }}
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Fetch all Git history, otherwise the current version number will
# not be correctly calculated.
fetch-depth: 0
- 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: ${{ secrets.S3_REGION }}
role-to-assume: ${{ secrets.AWS_S3_ROLE }}
role-duration-seconds: 1800
- name: Login to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USER }}
password: ${{ secrets.DOCKER_PASS }}
- name: Set build ID
run: |
set -e
ci/generate_version_number.sh > VERSION
echo "Build ID: $(cat ./VERSION)"
echo "BUILD_ID=$(cat ./VERSION)" >> ${GITHUB_ENV}
- name: Build Docker image
uses: docker/build-push-action@v3
with:
file: ${{ matrix.component }}/Dockerfile
tags: opencuebuild/${{ matrix.component }}:${{ env.BUILD_ID }}
context: .
push: true
- name: Extract Artifacts
run: |
set -e
image_name="opencuebuild/${{ matrix.component }}:${BUILD_ID}"
container_id=$(docker create ${image_name})
artifacts="${{ matrix.ARTIFACTS }}"
mkdir -p "${GITHUB_WORKSPACE}/artifacts/"
for artifact in $artifacts; do
docker cp ${container_id}:/opt/opencue/${artifact} "${GITHUB_WORKSPACE}/artifacts/"
done
docker rm $container_id
- name: Upload Artifacts
env:
S3_BUCKET: ${{ secrets.S3_BUCKET }}
run: |
artifacts="${{ matrix.ARTIFACTS }}"
for artifact in $artifacts; do
aws s3 cp ${GITHUB_WORKSPACE}/artifacts/${artifact} s3://${S3_BUCKET}/opencue/${BUILD_ID}/
done
create_other_artifacts:
name: Create Other Build Artifacts
needs: build_components
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
# Fetch all Git history, otherwise the current version number will
# not be correctly calculated.
fetch-depth: 0
- 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: ${{ secrets.S3_REGION }}
role-to-assume: ${{ secrets.AWS_S3_ROLE }}
role-duration-seconds: 1800
- name: Set build ID
run: |
set -e
ci/generate_version_number.sh > VERSION
echo "Build ID: $(cat ./VERSION)"
echo "BUILD_ID=$(cat ./VERSION)" >> ${GITHUB_ENV}
- name: Extract database schema
run: |
mkdir -p "${GITHUB_WORKSPACE}/artifacts/"
ci/extract_schema.sh ${BUILD_ID} "${GITHUB_WORKSPACE}/artifacts/"
- name: Create build metadata
run: |
mkdir -p "${GITHUB_WORKSPACE}/artifacts/"
echo "{\"git_commit\": \"$(BUILD_SOURCEVERSION)\"}" | tee "${GITHUB_WORKSPACE}/artifacts/build_metadata.json"
- name: Upload artifacts
env:
S3_BUCKET: ${{ secrets.S3_BUCKET }}
run: |
aws s3 cp LICENSE s3://${S3_BUCKET}/opencue/${BUILD_ID}/
aws s3 cp VERSION s3://${S3_BUCKET}/opencue/${BUILD_ID}/
aws s3 cp "${GITHUB_WORKSPACE}/artifacts/schema-${BUILD_ID}.sql" s3://${S3_BUCKET}/opencue/${BUILD_ID}/
aws s3 cp "${GITHUB_WORKSPACE}/artifacts/seed_data-${BUILD_ID}.sql" s3://${S3_BUCKET}/opencue/${BUILD_ID}/
aws s3 cp "${GITHUB_WORKSPACE}/artifacts/build_metadata.json" s3://${S3_BUCKET}/opencue/${BUILD_ID}/
- name: Display artifacts
env:
S3_BUCKET: ${{ secrets.S3_BUCKET }}
run: |
aws s3 ls s3://${S3_BUCKET}/opencue/${BUILD_ID}/