forked from soramitsu/soramitsu-iroha
-
Notifications
You must be signed in to change notification settings - Fork 2
151 lines (146 loc) · 5.16 KB
/
iroha2-release.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
name: I2::Release::Publish
on:
push:
tags:
- 'v2*'
env:
CARGO_TERM_COLOR: always
DEFAULTS_DIR: defaults
WASM_TARGET_DIR: wasm/target/prebuilt
IROHA2_PROFILE: profiling
IROHA2_RUSTFLAGS: -C force-frame-pointers=on
IROHA2_FEATURES: profiling
IROHA2_CARGOFLAGS: -Z build-std
jobs:
build_wasm_libs:
runs-on: ubuntu-latest
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
timeout-minutes: 30
steps:
- uses: actions/checkout@v4
- name: Build wasm libs
run: ./scripts/build_wasm.sh libs
- name: Upload wasm libs to reuse in other jobs
uses: actions/upload-artifact@v4
with:
name: wasm-libs
path: ${{ env.WASM_TARGET_DIR }}/libs
retention-days: 1
registry-no-profiling:
runs-on: [self-hosted, Linux, iroha2]
needs: build_wasm_libs
steps:
- uses: actions/checkout@v4
- name: Download wasm libs
uses: actions/download-artifact@v4
with:
name: wasm-libs
path: ${{ env.DEFAULTS_DIR }}/libs
- name: Move the default executor
run: mv ${{ env.DEFAULTS_DIR }}/libs/default_executor.wasm ${{ env.DEFAULTS_DIR }}/executor.wasm
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Get the release tag
run: |
RELEASE_VERSION=${{ github.ref_name }}
PREFIX='v'
TAG=${RELEASE_VERSION#$PREFIX}
echo "TAG=$TAG" >>$GITHUB_ENV
- name: Build and export to Docker iroha2 image
uses: docker/build-push-action@v6
if: always()
with:
context: .
load: true
tags: |
hyperledger/iroha:${{ env.TAG }}
docker.soramitsu.co.jp/iroha2/iroha:${{ env.TAG }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Test docker-compose.single.yml before pushing
run: |
docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.single.yml up --wait || exit 1
docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.single.yml down
- name: Test docker-compose.local.yml before pushing
run: |
docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.local.yml up --wait || exit 1
docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.local.yml down
- name: Test docker-compose.yml before pushing
run: |
docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.yml up --wait || exit 1
docker compose -f ${{ env.DEFAULTS_DIR }}/docker-compose.yml down
- name: Login to DockerHub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Soramitsu Harbor
uses: docker/login-action@v3
with:
registry: docker.soramitsu.co.jp
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_TOKEN }}
- name: Build and push iroha2 image
uses: docker/build-push-action@v6
with:
context: .
push: true
tags: |
hyperledger/iroha:${{ env.TAG }}
docker.soramitsu.co.jp/iroha2/iroha:${{ env.TAG }}
labels: commit=${{ github.sha }}
registry-with-profiling:
runs-on: [self-hosted, Linux, iroha2]
needs: build_wasm_libs
container:
image: hyperledger/iroha2-ci:nightly-2024-09-09
steps:
- uses: actions/checkout@v4
- name: Download wasm libs
uses: actions/download-artifact@v4
with:
name: wasm-libs
path: ${{ env.DEFAULTS_DIR }}/libs
- name: Move the default executor
run: mv ${{ env.DEFAULTS_DIR }}/libs/default_executor.wasm ${{ env.DEFAULTS_DIR }}/executor.wasm
- name: Get the release tag
run: |
RELEASE_VERSION=${{ github.ref_name }}
PREFIX='v'
TAG=${RELEASE_VERSION#$PREFIX}
echo "TAG=$TAG" >>$GITHUB_ENV
- uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to Soramitsu Harbor
uses: docker/login-action@v3
with:
registry: docker.soramitsu.co.jp
username: ${{ secrets.HARBOR_USERNAME }}
password: ${{ secrets.HARBOR_TOKEN }}
- name: Set up Docker Buildx
id: buildx
if: always()
uses: docker/setup-buildx-action@v3
with:
install: true
- name: Build and push iroha2-profiling image
uses: docker/build-push-action@v6
if: always()
with:
push: true
tags: |
hyperledger/iroha:${{ env.TAG }}-${{ env.IROHA2_PROFILE }}
docker.soramitsu.co.jp/iroha2/iroha:${{ env.TAG }}-${{ env.IROHA2_PROFILE }}
labels: commit=${{ github.sha }}
build-args: |
"PROFILE=${{ env.IROHA2_PROFILE }}"
"RUSTFLAGS=${{ env.IROHA2_RUSTFLAGS }}"
"FEATURES=${{ env.IROHA2_FEATURES }}"
"CARGOFLAGS=${{ env.IROHA2_CARGOFLAGS }}"
context: .