-
Notifications
You must be signed in to change notification settings - Fork 143
118 lines (109 loc) · 4.26 KB
/
test.yaml
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
# Copyright the Hyperledger Fabric contributors. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
name: Test
on:
workflow_call:
jobs:
setup:
runs-on: ubuntu-24.04
outputs:
PACKAGE_VERSION: ${{ steps.builddata.outputs.PACKAGE_VERSION }}
MINOR_PACKAGE_VERSION: ${{ steps.builddata.outputs.MINOR_PACKAGE_VERSION }}
BUILD_DATE: ${{ steps.builddata.outputs.BUILD_DATE }}
steps:
- uses: actions/checkout@v4
- name: BuildData
id: builddata
run: |
set -ex -o pipefail
env | sort
# handle full version number
VERSION=$(jq '.version' docker/fabric-nodeenv/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9]\.[0-9]?[0-9]).*/\1/")
echo Current version in code is :${VERSION}:
echo "PACKAGE_VERSION=${VERSION}" >> $GITHUB_OUTPUT
# handle minor version
MINOR_VERSION=$(jq '.version' docker/fabric-nodeenv/package.json | sed -r "s/\"([0-9]?[0-9]\.[0-9]?[0-9])\.[0-9]?[0-9].*/\1/")
echo Current minor version in code is :${MINOR_VERSION}:
echo "MINOR_PACKAGE_VERSION=${MINOR_VERSION}" >> $GITHUB_OUTPUT
# get the current date for using in dev builds
BUILD_DATE=$(date '+%Y%m%d')
echo Build date is :${BUILD_DATE}
echo "BUILD_DATE=${BUILD_DATE}" >> $GITHUB_OUTPUT
build:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18.x"
- name: Install/Rebuild/UnitTest
run: |
set -xev
node common/scripts/install-run-rush.js install
node common/scripts/install-run-rush.js rebuild
- name: Pre-process Artifacts
run: |
npx cobertura-merge -o merged_coverage.xml shim=./libraries/fabric-shim/coverage/cobertura-coverage.xml contractapi=./apis/fabric-contract-api/coverage/cobertura-coverage.xml -p
- uses: actions/upload-artifact@v4
name: Upload test results
if: ${{ !cancelled() }}
with:
name: TestResults
path: ./**/test-results.xml
- name: Build Binaries
run: |
set -xev
node common/scripts/install-run-rush.js publish --include-all --pack --release-folder tgz --publish
docker image save hyperledger/fabric-nodeenv | gzip > fabric-nodeenv.tar.gz
- uses: actions/upload-artifact@v4
name: Binaries
with:
name: node-tgzs
path: tgz/
- uses: actions/upload-artifact@v4
name: Docker
with:
name: nodeenv-docker-image
path: fabric-nodeenv.tar.gz
fvtest:
runs-on: ubuntu-24.04
needs: build
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "18.x"
- uses: actions/download-artifact@v4
with:
name: nodeenv-docker-image
path: build/
- uses: actions/download-artifact@v4
with:
name: node-tgzs
path: build/
- name: Setup the fv build
env:
PIPELINE_WORKSPACE: workspace
run: |
set -xev
./tools/getEdgeDocker.sh # essential to get main docker images of peer etc.
docker image load --input build/fabric-nodeenv.tar.gz # gets the build image of nodeenv
docker tag hyperledger/fabric-nodeenv:latest hyperledger/fabric-nodeenv:2.5
docker images
node common/scripts/install-run-rush.js install
node common/scripts/install-run-rush.js update # should the tests need 'building' this will need to go here
node common/scripts/install-run-rush.js start-fabric
node common/scripts/install-run-rush.js start-verdaccio # script will check for the ci variable and use built images
- name: Run the FV Tests
run: |
set -xev
export TLS=true
docker images | grep hyperledger && docker ps -a
node common/scripts/install-run-rush.js test:fv --verbose
node common/scripts/install-run-rush.js test:e2e --verbose
- uses: actions/upload-artifact@v4
if: ${{ !cancelled() }}
name: TestLogs
with:
name: TestLogs
path: "**/*.build.log"