forked from bitcoin-computer/monorepo
-
Notifications
You must be signed in to change notification settings - Fork 0
126 lines (106 loc) · 3.5 KB
/
Copy pathrelease.yml
File metadata and controls
126 lines (106 loc) · 3.5 KB
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
name: release-or-pre-release
on:
push:
tags:
- "v*"
jobs:
decide:
runs-on: ubuntu-latest
outputs:
release_type: ${{ steps.set_type.outputs.release_type }}
version: ${{ steps.set_type.outputs.version }}
steps:
- name: Extract version and type
id: set_type
run: |
TAG="${GITHUB_REF#refs/tags/}"
echo "Detected tag: $TAG"
if [[ "$TAG" == *-pre-release ]]; then
echo "release_type=pre" >> $GITHUB_OUTPUT
echo "version=${TAG#v}" | sed 's/-pre-release$//' >> $GITHUB_OUTPUT
else
echo "release_type=final" >> $GITHUB_OUTPUT
echo "version=${TAG#v}" >> $GITHUB_OUTPUT
fi
build:
needs: decide
runs-on: ubuntu-latest
outputs:
image_tag: ${{ steps.set_tag.outputs.image_tag }}
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Log in to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_HUB_USERNAME }}
password: ${{ secrets.DOCKER_HUB_PASSWORD }}
- name: Set image tag
id: set_tag
run: |
VERSION="${{ needs.decide.outputs.version }}"
if [ "${{ needs.decide.outputs.release_type }}" = "pre" ]; then
TAG="bcdb/bcn:${VERSION}-pre-release"
else
TAG="bcdb/bcn:${VERSION}"
fi
echo "image_tag=$TAG" >> $GITHUB_OUTPUT
- name: Build and Push Docker Image
run: |
VERSION="${{ needs.decide.outputs.version }}"
TAG="${{ steps.set_tag.outputs.image_tag }}"
echo "Building image: $TAG"
docker buildx build --platform linux/amd64,linux/arm64 \
--push \
--tag "$TAG" \
-f Dockerfile .
if [ "${{ needs.decide.outputs.release_type }}" = "final" ]; then
docker buildx build --platform linux/amd64,linux/arm64 \
--push \
--tag "bcdb/bcn:latest" \
--tag "bcdb/bcn:${VERSION}" \
-f Dockerfile .
fi
integration-tests:
needs: [decide, build]
runs-on: ubuntu-latest
strategy:
matrix:
platform: [linux/amd64, linux/arm64]
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Pull temporary image
run: |
docker pull ${{ needs.build.outputs.image_tag }}
- name: Re-tag image for docker-compose
run: |
docker tag ${{ needs.build.outputs.image_tag }} bcdb:bcn
- name: Copy configuration files
working-directory: packages/node
run: |
cp chain-setup/LTC/regtest/.env.example .env
cp chain-setup/LTC/regtest/litecoin.conf.example litecoin.conf
- name: Set up Docker Compose
run: |
sudo apt-get update && sudo apt-get install -y docker-compose
- name: Install dependencies (npm install)
working-directory: packages/node
continue-on-error: true
run: |
npm install || echo "npm install failed, continuing..."
- name: Start services in regtest mode
working-directory: packages/node
run: |
npm run up &
sleep 20
- name: Run integration tests
working-directory: packages/node
run: |
sleep 30; npm run test
- name: Stop services
working-directory: packages/node
run: |
npm run down