Skip to content

Commit 2b56fbf

Browse files
authored
ci: improve compile and release workflow (#961)
Several improvements to the CI and release workflows: - Move compilation scripts from scripts/ to workflow files for better maintainability. - Remove useless scripts related to Docker and shared object generation. - Compile difftest shared objects only on Ubuntu 20.04 to ensure compatibility with CentOS 7. - Rename deconfig from dual-xs to xs-dual for better clarity.
1 parent 481de63 commit 2b56fbf

File tree

8 files changed

+34
-80
lines changed

8 files changed

+34
-80
lines changed

.github/workflows/build.yml

Lines changed: 15 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,14 @@ jobs:
66
compile-difftest-so:
77
strategy:
88
matrix:
9-
container-version: ['ubuntu-20.04', 'ubuntu-22.04', 'ubuntu-24.04']
9+
cpu: ['xs', 'xs-dual']
10+
type: ['ref', 'ref-debug']
1011
fail-fast: false
1112
runs-on: ubuntu-latest
1213
container:
13-
image: ghcr.io/openxiangshan/xs-env:${{ matrix.container-version }}
14+
image: ghcr.io/openxiangshan/xs-env:ubuntu-20.04
1415
continue-on-error: false
15-
name: Compile difftest-so
16+
name: Compile NEMU for (${{ matrix.cpu }}-${{ matrix.type }})
1617
timeout-minutes: 30
1718
steps:
1819
- name: Checkout repository
@@ -22,13 +23,19 @@ jobs:
2223
run: |
2324
echo "NEMU_HOME=$GITHUB_WORKSPACE" >> $GITHUB_ENV
2425
25-
- name: compile dynamic libraries
26+
- name: Compile dynamic library
2627
run: |
27-
bash ./scripts/generate_so_for_difftest.sh
28+
make riscv64-${{ matrix.cpu }}-${{ matrix.type }}_defconfig
29+
make -j
2830
29-
- name: archive difftest-so artifacts
31+
- name: Prepare artifact
32+
run: |
33+
mkdir -p artifact
34+
cp build/riscv64-nemu-interpreter-so artifact/nemu-${{ matrix.cpu }}-${{ matrix.type }}.so
35+
36+
- name: Archive artifacts
3037
uses: actions/upload-artifact@v4
3138
with:
32-
name: difftest-so-${{ matrix.container-version }}
39+
name: nemu-${{ matrix.cpu }}-${{ matrix.type }}.so
3340
path: |
34-
artifact
41+
artifact/nemu-${{ matrix.cpu }}-${{ matrix.type }}.so

.github/workflows/ci.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -371,5 +371,6 @@ jobs:
371371
run: |
372372
./build/riscv64-nemu-interpreter -b --diff ${SPIKE_SO} ${CI_WORKLOADS}/linux/rvv-bench/fw_payload.bin -I 400000000
373373
374-
build:
374+
build-so:
375+
name: Build NEMU Difftest Shared Objects
375376
uses: ./.github/workflows/build.yml

.github/workflows/release.yml

Lines changed: 17 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -95,20 +95,22 @@ jobs:
9595
- name: Download all artifacts
9696
uses: actions/download-artifact@v4
9797
with:
98-
pattern: difftest-so-*
98+
pattern: nemu-*.so
9999
path: release-artifacts
100100

101-
- name: Prepare release assets
101+
- name: Rename artifacts with version
102102
run: |
103-
mkdir -p release-files
104-
cd release-artifacts
105-
ls -l
106103
new_tag="${{ needs.check-and-release.outputs.new_tag }}"
107-
for dir in difftest-so-*; do
104+
cd release-artifacts
105+
for dir in nemu-*; do
108106
if [ -d "$dir" ]; then
109-
container_version=$(echo "$dir" | sed 's/difftest-so-//')
110107
cd "$dir"
111-
tar -czf "../../release-files/difftest-so-${new_tag}-${container_version}.tar.gz" .
108+
for file in nemu-*.so; do
109+
# Extract parts: nemu-{os}-{cpu}-{type}.so
110+
# Insert version after 'nemu-': nemu-{version}-{os}-{cpu}-{type}.so
111+
new_name=$(echo "$file" | sed "s/^nemu-/nemu-${new_tag}-/")
112+
mv "$file" "$new_name"
113+
done
112114
cd ..
113115
fi
114116
done
@@ -128,10 +130,12 @@ jobs:
128130
Release ${new_tag} is the ${micro}th release in ${month_name} ${year}, released on ${release_date}.
129131
130132
## Artifacts
131-
The release includes pre-compiled difftest shared objects for different Ubuntu versions:
132-
- \`difftest-so-${new_tag}-ubuntu-20.04.tar.gz\`: Compiled on Ubuntu 20.04, good for CentOS 7.
133-
- \`difftest-so-${new_tag}-ubuntu-22.04.tar.gz\`: Compiled on Ubuntu 22.04
134-
- \`difftest-so-${new_tag}-ubuntu-24.04.tar.gz\`: Compiled on Ubuntu 24.04
133+
The release includes pre-compiled NEMU shared objects for different configurations:
134+
- Compilation Platform: Ubuntu 20.04 (compatible with CentOS 7)
135+
- CPU: xs, xs-dual
136+
- Purpose: ref, ref-debug
137+
138+
Each artifact is named as: \`nemu-{version}-{cpu}-{type}.so\`
135139
EOF
136140
137141
- name: Create Release
@@ -144,6 +148,6 @@ jobs:
144148
prerelease: false
145149
generate_release_notes: true
146150
files: |
147-
release-files/*.tar.gz
151+
release-artifacts/*/*.so
148152
env:
149153
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
File renamed without changes.

scripts/Dockerfile

Lines changed: 0 additions & 18 deletions
This file was deleted.

scripts/generate_so_for_difftest.sh

Lines changed: 0 additions & 37 deletions
This file was deleted.

scripts/generate_so_from_docker.sh

Lines changed: 0 additions & 3 deletions
This file was deleted.

0 commit comments

Comments
 (0)