Skip to content

Commit 7df89c1

Browse files
duanyangjingluchsh
authored andcommitted
make: Use cvm.mk to generate release artifacts
Also directly test these artifacts in CI
1 parent f38d7e4 commit 7df89c1

File tree

5 files changed

+70
-28
lines changed

5 files changed

+70
-28
lines changed

.github/workflows/build-linux.yml

Lines changed: 23 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,10 @@ jobs:
6868
- name: 'Checkout the JDK source'
6969
uses: actions/checkout@v3
7070

71+
- name: 'Determine version'
72+
id: version
73+
run: echo "::set-output name=version::$(cat ./cvm/conf/version)"
74+
7175
- name: 'Get JTReg'
7276
id: jtreg
7377
uses: ./.github/actions/get-jtreg
@@ -99,18 +103,34 @@ jobs:
99103
- name: 'Build'
100104
run: |
101105
make -f cvm.mk ${{ inputs.make-target }} MODE=${{ matrix.debug-level}}
106+
if [[ '${{ matrix.debug-level }}' == 'release' ]]; then
107+
make -f cvm.mk jvm-patch MODE=release SKIP_BUILD=true
108+
fi
102109
shell: bash
103110

104111
- name: 'Pack bundles'
112+
if: matrix.debug-level == 'release'
105113
run: |
106-
tar cvzf cvm8+17-${{ inputs.platform }}-${{ matrix.debug-level}}.tar.gz -C output jdk8
114+
tar czf CompoundVM_${{ steps.version.outputs.version }}_${{ inputs.platform }}.tar.gz -C output CompoundVM_${{ steps.version.outputs.version }}_${{ inputs.platform }}
115+
tar czf CompoundVM_${{ steps.version.outputs.version }}_jvm_patch_${{ inputs.platform }}.tar.gz -C output/CompoundVM_${{ steps.version.outputs.version }}_jvm_patch_${{ inputs.platform }} .
107116
shell: bash
108117

109118
- name: 'Upload bundles'
110119
uses: actions/upload-artifact@v4
120+
if: matrix.debug-level == 'release'
121+
with:
122+
name: CompoundVM_${{ steps.version.outputs.version }}_${{ inputs.platform }}.tar.gz
123+
path: CompoundVM_${{ steps.version.outputs.version }}_${{ inputs.platform }}.tar.gz
124+
retention-days: 1
125+
if-no-files-found: error
126+
overwrite: true
127+
128+
- name: 'Upload bundles jvm patch'
129+
uses: actions/upload-artifact@v4
130+
if: matrix.debug-level == 'release'
111131
with:
112-
name: cvm8+17-${{ inputs.platform }}-${{ matrix.debug-level}}.tar.gz
113-
path: cvm8+17-${{ inputs.platform }}-${{ matrix.debug-level}}.tar.gz
132+
name: CompoundVM_${{ steps.version.outputs.version }}_jvm_patch_${{ inputs.platform }}.tar.gz
133+
path: CompoundVM_${{ steps.version.outputs.version }}_jvm_patch_${{ inputs.platform }}.tar.gz
114134
retention-days: 1
115135
if-no-files-found: error
116136
overwrite: true

.github/workflows/main.yml

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ jobs:
110110
needs: select
111111
uses: ./.github/workflows/build-linux.yml
112112
with:
113-
platform: linux-x64
113+
platform: linux_x64
114114
apt-gcc-version: '9'
115115
# The linux-x64 jdk bundle is used as buildjdk for the cross-compile job
116116
if: needs.select.outputs.linux-x64 == 'true' || needs.select.outputs.linux-cross-compile == 'true'
@@ -125,8 +125,7 @@ jobs:
125125
- build-linux-x64
126126
uses: ./.github/workflows/test-cvm8+17.yml
127127
with:
128-
platform: linux-x64
129-
bootjdk-platform: linux-x64
128+
platform: linux_x64
130129
runs-on: ubuntu-22.04
131130
debug-level: release
132131

.github/workflows/test-cvm8+17.yml

Lines changed: 22 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,6 @@ on:
2525
platform:
2626
required: true
2727
type: string
28-
bootjdk-platform:
29-
required: true
30-
type: string
3128
runs-on:
3229
required: true
3330
type: string
@@ -66,28 +63,39 @@ jobs:
6663
- name: 'Checkout the JDK source'
6764
uses: actions/checkout@v3
6865

66+
- name: 'Determine version'
67+
id: version
68+
run: echo "::set-output name=version::$(cat ./cvm/conf/version)"
69+
6970
- name: 'Get bundles'
7071
uses: actions/download-artifact@v4
7172
with:
72-
name: cvm8+17-${{ inputs.platform }}-${{ inputs.debug-level }}.tar.gz
73+
name: CompoundVM_${{ steps.version.outputs.version }}_${{ inputs.platform }}.tar.gz
7374
path: .
7475

7576
- name: 'Unpack bundles'
7677
run: |
77-
mkdir -p cvm/build
78-
tar xzvf cvm8+17-${{ inputs.platform }}-${{ inputs.debug-level }}.tar.gz -C cvm/build
79-
shell: bash
80-
81-
- name: 'Get jdk8u src'
82-
id: jdk8u-src
83-
run: |
84-
wget -nc https://github.com/openjdk/jdk8u/archive/refs/tags/jdk8u382-b03.tar.gz
85-
mkdir -p cvm/jdk8u
86-
tar -xzf jdk8u382-b03.tar.gz -C cvm/jdk8u --strip-components=1
78+
rm -rf cvm/build/jdk8
79+
mkdir -p cvm/build/jdk8
80+
tar xzvf CompoundVM_${{ steps.version.outputs.version }}_${{ inputs.platform }}.tar.gz -C cvm/build/jdk8 --strip-components=1
8781
shell: bash
8882

8983
- name: 'Run tests'
9084
id: run-tests
9185
run: |
9286
make -f cvm.mk test_jtreg8_${{ matrix.test-suite }} SKIP_BUILD=true MODE=${{ inputs.debug-level }}
9387
shell: bash
88+
89+
- name: 'Get bundles jvm patch'
90+
uses: actions/download-artifact@v4
91+
with:
92+
name: CompoundVM_${{ steps.version.outputs.version }}_jvm_patch_${{ inputs.platform }}.tar.gz
93+
path: .
94+
95+
- name: 'Run sanity test jvm patch'
96+
run: |
97+
wget -nc https://github.com/adoptium/temurin8-binaries/releases/download/jdk8u372-b07/OpenJDK8U-jdk_x64_linux_hotspot_8u372b07.tar.gz
98+
tar xzf OpenJDK8U-jdk_x64_linux_hotspot_8u372b07.tar.gz
99+
tar xzf CompoundVM_${{ steps.version.outputs.version }}_jvm_patch_${{ inputs.platform }}.tar.gz -C jdk8u372-b07/
100+
jdk8u372-b07/bin/java -version 2>&1 | grep "CompoundVM"
101+
shell: bash

cvm.mk

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ SHELL := /bin/bash
2222
BOOTJDK17 := $(WORKSPACE)/.bootjdks/jdk-17.0.7+7
2323
BOOTJDK8 := $(WORKSPACE)/.bootjdks/jdk8u372-b07
2424
BUILDDIR := $(WORKSPACE)/cvm/build
25+
VERSION := $(shell cat $(WORKSPACE)/cvm/conf/version)
2526
OUTPUTDIR := $(WORKSPACE)/output
27+
DISTRO_NAME := CompoundVM_$(VERSION)_linux_x64
28+
DISTRO_JVM_PATCH_NAME := CompoundVM_$(VERSION)_jvm_patch_linux_x64
2629
CVM8DIR := $(BUILDDIR)/jdk8
2730
CVM8_JARDIR := $(CVM8DIR)/jre/lib
2831
CVM8_LIBDIR := $(CVM8DIR)/jre/lib/amd64
@@ -94,6 +97,8 @@ endef
9497
-init-dirs:
9598
[[ -d $(BUILDDIR) ]] || mkdir -p $(BUILDDIR)
9699
[[ -d $(OUTPUTDIR) ]] || mkdir -p $(OUTPUTDIR)
100+
[[ -d $(OUTPUTDIR)/$(DISTRO_NAME) ]] || mkdir -p $(OUTPUTDIR)/$(DISTRO_NAME)
101+
[[ -d $(OUTPUTDIR)/$(DISTRO_JVM_PATCH_NAME) ]] || mkdir -p $(OUTPUTDIR)/$(DISTRO_JVM_PATCH_NAME)
97102

98103
# Setup bootstrap JDK from a given URL
99104
# $1 URL of JDK in tar.gz format
@@ -129,9 +134,18 @@ cvm8default17: jdk8vm17
129134
echo "-server17 KNOWN" > $(CVM8_LIBDIR)/jvm.cfg
130135
echo "-server KNOWN" >> $(CVM8_LIBDIR)/jvm.cfg
131136
echo "-client IGNORE" >> $(CVM8_LIBDIR)/jvm.cfg
132-
echo "-server17 KNOWN" > $(OUTPUTDIR)/jdk8/jre/lib/amd64/jvm.cfg
133-
echo "-server KNOWN" >> $(OUTPUTDIR)/jdk8/jre/lib/amd64/jvm.cfg
134-
echo "-client IGNORE" >> $(OUTPUTDIR)/jdk8/jre/lib/amd64/jvm.cfg
137+
echo "-server17 KNOWN" > $(OUTPUTDIR)/$(DISTRO_NAME)/jre/lib/amd64/jvm.cfg
138+
echo "-server KNOWN" >> $(OUTPUTDIR)/$(DISTRO_NAME)/jre/lib/amd64/jvm.cfg
139+
echo "-client IGNORE" >> $(OUTPUTDIR)/$(DISTRO_NAME)/jre/lib/amd64/jvm.cfg
140+
141+
JVM_PATCH_ARTIFACTS := jre/lib/rt17.jar jre/lib/rt8.jar jre/lib/amd64/libjava17.so jre/lib/amd64/libjimage17.so jre/lib/amd64/libjdwp17.so jre/lib/amd64/server17 jre/lib/amd64/jvm.cfg
142+
143+
jvm-patch: cvm8default17
144+
@echo "###### Composing CVM8 jvm patch ######"
145+
mkdir -p $(OUTPUTDIR)/$(DISTRO_JVM_PATCH_NAME)
146+
for file in $(JVM_PATCH_ARTIFACTS); do \
147+
cd $(OUTPUTDIR)/$(DISTRO_NAME) && cp -rf --parents $$file $(OUTPUTDIR)/$(DISTRO_JVM_PATCH_NAME)/; \
148+
done
135149

136150
-clean-jdk8vm17:
137151
rm -fr $(BUILDDIR)/alt_kernel
@@ -167,13 +181,13 @@ jdk8vm17: -clean-jdk8vm17 -bootstrap build_jdk8u build_jdk17u altkernel
167181
cp -f $(SRC_BUILDDIR_17)/jdk/lib/libjdwp.debuginfo $(CVM8_LIBDIR)/libjdwp17.debuginfo && \
168182
cp -f $(SRC_BUILDDIR_17)/jdk/lib/server/libjvm.debuginfo $(CVM8_LIBDIR)/server17/libjvm.debuginfo && \
169183
[[ "x$$(grep server17 $(CVM8_LIBDIR)/jvm.cfg)" = "x" ]] && echo "-server17 KNOWN" >> $(CVM8_LIBDIR)/jvm.cfg && \
170-
cp -rf $(CVM8DIR) $(OUTPUTDIR)/; \
184+
cp -rf $(CVM8DIR)/* $(OUTPUTDIR)/$(DISTRO_NAME)/; \
171185
}
172186
ifeq ($(MODE), release)
173187
# Remove unwanted files from release build
174-
find $(OUTPUTDIR)/jdk8 -name '*.debuginfo' -execdir rm -f {} +
175-
find $(OUTPUTDIR)/jdk8 -name '*.diz' -execdir rm -f {} +
176-
rm -fr $(OUTPUTDIR)/jdk8/demo
188+
find $(OUTPUTDIR)/$(DISTRO_NAME) -name '*.debuginfo' -execdir rm -f {} +
189+
find $(OUTPUTDIR)/$(DISTRO_NAME) -name '*.diz' -execdir rm -f {} +
190+
rm -fr $(OUTPUTDIR)/$(DISTRO_NAME)/demo
177191
endif
178192
@echo "###### Done ######"
179193
@echo
@@ -208,7 +222,7 @@ build_jdk17u: -bootstrap
208222
--with-vendor-vm-bug-url="https://github.com/bytedance/CompoundVM/issues" \
209223
--without-version-pre \
210224
--without-version-opt \
211-
--with-cvm-version-string="8.0.0" \
225+
--with-cvm-version-string=$(VERSION) \
212226
--with-vendor-name="CompoundVM" \
213227
; \
214228
fi; \

cvm/conf/version

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
8.0.1

0 commit comments

Comments
 (0)