-
Notifications
You must be signed in to change notification settings - Fork 206
186 lines (176 loc) · 7.36 KB
/
Dockerfile.dev.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
174
175
176
177
178
179
180
181
182
183
184
185
186
name: Dockerfile.dev
on:
push:
branches:
- master
pull_request:
schedule:
# UTC: At 10:15 on every day-of-week from Monday through Friday.
# UTC-8: At 02:15 on every day-of-week from Monday through Friday.
- cron: '15 10 * * 1-5'
# Prevent more than one build of this workflow for a branch to be running at the
# same time, and if multiple are queued, only run the latest, cancelling any
# already running build. The exception being any protected branch, such as
# master, where a build for every commit will run.
concurrency:
group: ${{ github.workflow }}-${{ github.ref_protected == 'true' && github.sha || github.ref }}
cancel-in-progress: true
env:
HEAD_SHA: ${{ github.event.pull_request.head.sha || github.sha }}
IMAGE: ${{ format('{0}/{1}:{2}', secrets.DOCKERHUB_TOKEN && 'docker.io' || 'ghcr.io', github.repository, github.event_name == 'pull_request' && format('pr-{0}-dev', github.event.pull_request.number) || 'dev') }}
jobs:
build-stellar-core:
runs-on: ubuntu-latest
steps:
- uses: docker/setup-buildx-action@5146db6c4d81fbfd508899f851bbb3883a96ff9f
- name: Build Stellar-Core Image
run: docker buildx build -f docker/Dockerfile.testing -t stellar-core -o type=docker,dest=/tmp/image https://github.com/stellar/stellar-core.git#master --build-arg BUILDKIT_CONTEXT_KEEP_GIT_DIR=true --build-arg CONFIGURE_FLAGS='--disable-tests'
- name: Upload Stellar-Core Image
uses: actions/upload-artifact@v2
with:
name: image-stellar-core
path: /tmp/image
build-stellar-horizon:
runs-on: ubuntu-latest
steps:
- uses: docker/setup-buildx-action@5146db6c4d81fbfd508899f851bbb3883a96ff9f
- name: Build Stellar-Horizon Image
run: docker buildx build -f services/horizon/docker/Dockerfile.dev --target builder -t stellar-horizon -o type=docker,dest=/tmp/image https://github.com/stellar/go.git#master
- name: Upload Stellar-Horizon Image
uses: actions/upload-artifact@v2
with:
name: image-stellar-horizon
path: /tmp/image
build-stellar-friendbot:
runs-on: ubuntu-latest
steps:
- uses: docker/setup-buildx-action@5146db6c4d81fbfd508899f851bbb3883a96ff9f
- name: Build Stellar-Friendbot Image
run: docker buildx build -f services/friendbot/docker/Dockerfile -t stellar-friendbot -o type=docker,dest=/tmp/image https://github.com/stellar/go.git#master
- name: Upload Stellar-Friendbot Image
uses: actions/upload-artifact@v2
with:
name: image-stellar-friendbot
path: /tmp/image
build:
needs: [build-stellar-core, build-stellar-horizon, build-stellar-friendbot]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.HEAD_SHA }}
- name: Download Stellar-Core Image
uses: actions/download-artifact@v2
with:
name: image-stellar-core
path: /tmp/stellar-core
- name: Download Stellar-Horizon Image
uses: actions/download-artifact@v2
with:
name: image-stellar-horizon
path: /tmp/stellar-horizon
- name: Download Stellar-Friendbot Image
uses: actions/download-artifact@v2
with:
name: image-stellar-friendbot
path: /tmp/stellar-friendbot
- name: Load Stellar-Core Image
run: docker load -i /tmp/stellar-core/image
- name: Load Stellar-Horizon Image
run: docker load -i /tmp/stellar-horizon/image
- name: Load Stellar-Friendbot Image
run: docker load -i /tmp/stellar-friendbot/image
# Docker buildx cannot be used to build the dev quickstart image because
# buildx does not yet support importing existing images, like the core and
# horizon images above, into a buildx builder's cache. Buildx would be
# preferred because it can output a smaller image file faster than docker
# save can. Once buildx supports it we can update.
# https://github.com/docker/buildx/issues/847
- name: Build Quickstart Image
run: docker build -f Dockerfile.dev -t $IMAGE --label org.opencontainers.image.revision="${{ env.HEAD_SHA }}" . --build-arg STELLAR_CORE_IMAGE_REF=stellar-core --build-arg HORIZON_IMAGE_REF=stellar-horizon --build-arg FRIENDBOT_IMAGE_REF=stellar-friendbot
- name: Save Quickstart Image
run: docker save $IMAGE -o /tmp/image
- name: Upload Quickstart Image
uses: actions/upload-artifact@v2
with:
name: image-Dockerfile-dev
path: /tmp/image
test:
needs: build
strategy:
matrix:
network: [testnet, pubnet, standalone]
options: ["", --enable-horizon-captive-core]
exclude:
- network: testnet
options: --enable-horizon-captive-core
- network: pubnet
options: --enable-horizon-captive-core
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.HEAD_SHA }}
- name: Download Quickstart Image
uses: actions/download-artifact@v2
with:
name: image-Dockerfile-dev
path: /tmp/
- name: Load Quickstart Image
run: docker load -i /tmp/image
- name: Run Quickstart Image
run: docker run --rm -d -p "8000:8000" -p "11626:11626" --name stellar $IMAGE --${{ matrix.network }} ${{ matrix.options }}
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: ^1
- name: Sleep until supervisor is up
run: sleep 10
- name: Run core test
run: |
echo "supervisorctl tail -f stellar-core" | docker exec -i stellar sh &
go run test_core.go
curl http://localhost:11626/info
- name: Run horizon up test
run: |
echo "supervisorctl tail -f horizon" | docker exec -i stellar sh &
go run test_horizon_up.go
curl http://localhost:8000
- name: Run horizon ingesting test
if: ${{ matrix.network != 'pubnet' }}
run: |
echo "supervisorctl tail -f stellar-core" | docker exec -i stellar sh &
echo "supervisorctl tail -f horizon" | docker exec -i stellar sh &
go run test_horizon_ingesting.go
curl http://localhost:8000
- name: Run friendbot test
# Horizon with captive-core is currently broken. Don't run the Friendbot
# test in captive-core mode since it will always fail while Horizon is not
# functioning with captive-core.
# See https://github.com/stellar/quickstart/issues/328 for more details.
if: ${{ matrix.network == 'standalone' && !contains(matrix.options, '--enable-horizon-captive-core') }}
run: |
echo "supervisorctl tail -f friendbot" | docker exec -i stellar sh &
go run test_friendbot.go
push:
# Push image to registry after build for pull requests from a local branch.
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.full_name == github.repository }}
needs: build
permissions:
packages: write
statuses: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: ${{ env.HEAD_SHA }}
- id: push
uses: ./.github/actions/push
with:
head_sha: ${{ env.HEAD_SHA }}
artifact_name: image-Dockerfile-dev
artifact_image_file: image
image: ${{ env.IMAGE }}
registry: ${{ secrets.DOCKERHUB_TOKEN && 'docker.io' || 'ghcr.io' }}
username: ${{ secrets.DOCKERHUB_USERNAME || github.actor }}
password: ${{ secrets.DOCKERHUB_TOKEN || github.token }}