Skip to content

Commit 8f833f0

Browse files
authored
[CI] Revert to use HEAD for bochscpu-build (#17)
Since yrp604/bochscpu-build#4 was merged
1 parent 55aefcf commit 8f833f0

File tree

3 files changed

+38
-19
lines changed

3 files changed

+38
-19
lines changed

.github/build-bochscpu.bat

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,12 @@ mkdir bxbuild
1212
cd bxbuild
1313

1414
REM Use WSL to configure / clone the repositories.
15-
bash -c "git clone https://github.com/yrp604/bochscpu-build.git && git clone https://github.com/yrp604/bochscpu && git clone https://github.com/yrp604/bochscpu-ffi && cd bochscpu-build && BOCHS_REV=c48a50141b6ade6c6b0744280a598b55d906bb9e bash prep.sh && cd Bochs/bochs && bash .conf.cpu-msvc"
15+
bash -c "git clone https://github.com/yrp604/bochscpu-build.git && git clone https://github.com/hugsy/bochscpu.git && git clone https://github.com/yrp604/bochscpu-ffi.git && cd bochscpu-build && bash prep.sh && cd Bochs/bochs && bash .conf.cpu-msvc"
1616

1717
REM Build bochs; libinstrument.a is expected to fail to build so don't freak out.
1818
REM You can run nmake all-clean to clean up the build.
1919
cd bochscpu-build\Bochs\bochs
20+
set CL=/MP
2021
nmake
2122

2223
REM Remove old files in bochscpu.
@@ -38,8 +39,8 @@ REM Now its time to build it.
3839
cd ..\..\..\bochscpu-ffi
3940
REM cargo clean -p bochscpu shits its pants on my computer so rebuilding everything
4041
cargo clean
41-
cargo build
42-
cargo build --release
42+
cargo build -j %NB_CPU%
43+
cargo build -j %NB_CPU% --release
4344

4445
REM Get back to where we were.
4546
popd

.github/build-bochscpu.sh

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,27 +8,28 @@ set -e
88

99
pushd .
1010

11+
test -z $NB_CPU && NB_CPU=1
12+
1113
mkdir bxbuild
1214
cd bxbuild
1315

1416
git clone https://github.com/yrp604/bochscpu-build.git
15-
git clone https://github.com/yrp604/bochscpu
16-
git clone https://github.com/yrp604/bochscpu-ffi
17+
git clone https://github.com/hugsy/bochscpu.git
18+
git clone https://github.com/yrp604/bochscpu-ffi.git
1719

1820
cd bochscpu-build
19-
export BOCHS_REV=c48a50141b6ade6c6b0744280a598b55d906bb9e
20-
bash prep.sh && cd Bochs/bochs && sh .conf.cpu && make || true
21+
bash prep.sh && cd Bochs/bochs && sh .conf.cpu && make -j ${NB_CPU}|| true
2122

2223
# Remove old files in bochscpu.
2324
rm -rf ../../../bochscpu/bochs
2425
rm -rf ../../../bochscpu/lib
2526

2627
# Create the libs directory where we stuff all the libs.
2728
mkdir ../../../bochscpu/lib
28-
cp cpu/libcpu.a ../../../bochscpu/lib/libcpu.a
29-
cp cpu/fpu/libfpu.a ../../../bochscpu/lib/libfpu.a
30-
cp cpu/avx/libavx.a ../../../bochscpu/lib/libavx.a
31-
cp cpu/cpudb/libcpudb.a ../../../bochscpu/lib/libcpudb.a
29+
cp -v cpu/libcpu.a ../../../bochscpu/lib/libcpu.a
30+
cp -v cpu/fpu/libfpu.a ../../../bochscpu/lib/libfpu.a
31+
cp -v cpu/avx/libavx.a ../../../bochscpu/lib/libavx.a
32+
cp -v cpu/cpudb/libcpudb.a ../../../bochscpu/lib/libcpudb.a
3233
make all-clean
3334

3435
# Now we want to copy the bochs directory over there.
@@ -39,8 +40,8 @@ mv bochs ../../bochscpu/bochs
3940
cd ../../bochscpu-ffi
4041

4142
cargo clean
42-
cargo build
43-
cargo build --release
43+
cargo build -j ${NB_CPU}
44+
cargo build -j ${NB_CPU} --release
4445

4546
# Get back to where we were.
4647
popd

.github/workflows/build.yml

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,13 @@ on:
88
tags:
99
- 'v*'
1010

11+
env:
12+
NB_CPU: 1
13+
1114
jobs:
1215
bochscpu:
16+
env:
17+
BOCHS_REV: 8dd9649389c813a189e3f702d58cdedb93730343
1318
strategy:
1419
fail-fast: false
1520
matrix:
@@ -19,7 +24,7 @@ jobs:
1924
- {os: macos-latest, arch: x64}
2025
runs-on: ${{ matrix.variant.os }}
2126
name: bochscpu / ${{ matrix.variant.os }} / ${{ matrix.variant.arch }}
22-
steps:
27+
steps :
2328
- name: Checkout
2429
uses: actions/checkout@v3
2530

@@ -28,7 +33,19 @@ jobs:
2833
uses: actions/cache@v3
2934
with:
3035
path: artifact
31-
key: bochscpu-${{ matrix.variant.os }}-${{ matrix.variant.arch }}-artifact-win-lin
36+
key: bochscpu-libs-${{ matrix.variant.os }}-${{ matrix.variant.arch }}-${{ env.BOCHS_REV }}
37+
38+
- if: steps.cache-artifacts.outputs.cache-hit != 'true' && matrix.variant.os == 'windows-latest'
39+
run: |
40+
echo NB_CPU=$env:NUMBER_OF_PROCESSORS | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
41+
42+
- if: steps.cache-artifacts.outputs.cache-hit != 'true' && matrix.variant.os == 'ubuntu-latest'
43+
run: |
44+
echo "NB_CPU=$(grep -c ^processor /proc/cpuinfo)" >> $GITHUB_ENV
45+
46+
- if: steps.cache-artifacts.outputs.cache-hit != 'true' && matrix.variant.os == 'macos-latest'
47+
run: |
48+
echo NB_CPU=$(sysctl -n hw.ncpu) >> $GITHUB_ENV
3249
3350
- uses: microsoft/setup-msbuild@v1
3451
if: steps.cache-artifacts.outputs.cache-hit != 'true' && matrix.variant.os == 'windows-latest'
@@ -48,7 +65,7 @@ jobs:
4865
- name: Build BochsCPU (Linux & MacOS)
4966
if: steps.cache-artifacts.outputs.cache-hit != 'true' && matrix.variant.os != 'windows-latest'
5067
run: |
51-
chmod +x .github/build-bochscpu.sh; .github/build-bochscpu.sh
68+
bash .github/build-bochscpu.sh
5269
mkdir artifact artifact/Release artifact/Debug artifact/RelWithDebInfo
5370
cp -v bxbuild/bochscpu-ffi/target/release/lib*.a artifact/Release/
5471
cp -v bxbuild/bochscpu-ffi/target/debug/lib*.a artifact/Debug/
@@ -57,6 +74,7 @@ jobs:
5774
- name: Upload artifacts
5875
uses: actions/upload-artifact@v3
5976
with:
77+
if-no-files-found: error
6078
name: bochscpu-libs-${{ matrix.variant.os }}-${{ matrix.variant.arch }}
6179
path: artifact
6280

@@ -74,7 +92,6 @@ jobs:
7492
runs-on: ${{ matrix.variant.os }}
7593
name: bindings / ${{ matrix.variant.os }} / ${{ matrix.python-version }} / ${{ matrix.variant.config }}
7694
env:
77-
NB_CPU: 1
7895
CMAKE_FLAGS: ""
7996
steps:
8097
- name: Checkout
@@ -104,8 +121,8 @@ jobs:
104121
- name: Environment Setup (Windows)
105122
if: matrix.variant.os == 'windows-latest'
106123
run: |
107-
echo "NB_CPU=$env:NUMBER_OF_PROCESSORS" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
108-
echo "CMAKE_ARCH='-A ${{ matrix.variant.arch }}'" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
124+
echo NB_CPU=$env:NUMBER_OF_PROCESSORS | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
125+
echo CMAKE_ARCH='-A ${{ matrix.variant.arch }}' | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
109126
Import-Module .\.github\Invoke-VisualStudio.ps1
110127
Invoke-VisualStudio2022${{ matrix.variant.arch }}
111128

0 commit comments

Comments
 (0)