Skip to content

Commit eb2b127

Browse files
committed
Cleanup CI and windows build on mingw
1 parent 8f66fee commit eb2b127

2 files changed

Lines changed: 113 additions & 80 deletions

File tree

.github/workflows/ci.yml

Lines changed: 85 additions & 79 deletions
Original file line numberDiff line numberDiff line change
@@ -2,109 +2,115 @@ name: CI
22

33
on:
44
push:
5-
branches: [ main, master ]
5+
branches: [main]
66
pull_request:
7-
branches: [ main, master ]
7+
branches: [main]
88

99
jobs:
10-
format:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@v4
14-
15-
- name: Check format
16-
run: make format-check
17-
1810
build-linux:
1911
runs-on: ubuntu-latest
2012
strategy:
21-
fail-fast: false
2213
matrix:
23-
compiler: [gcc, clang]
24-
14+
compiler: [g++, clang++]
2515
steps:
26-
- uses: actions/checkout@v4
27-
with:
28-
submodules: recursive
16+
- uses: actions/checkout@v4
17+
with:
18+
submodules: recursive
2919

30-
- name: Build
31-
run: make CXX=${{ matrix.compiler == 'gcc' && 'g++' || 'clang++' }} CC=${{ matrix.compiler }}
20+
- name: Build
21+
run: make CXX=${{ matrix.compiler }} -j$(nproc)
3222

33-
- name: Run tests
34-
run: make check
35-
36-
- name: Run examples
37-
run: make run-examples
23+
- name: Run tests
24+
run: make check
3825

3926
build-macos:
4027
runs-on: macos-latest
4128
steps:
42-
- uses: actions/checkout@v4
43-
with:
44-
submodules: recursive
45-
46-
- name: Build
47-
run: make
29+
- uses: actions/checkout@v4
30+
with:
31+
submodules: recursive
4832

49-
- name: Run tests
50-
run: make check
33+
- name: Build
34+
run: make -j$(sysctl -n hw.ncpu)
5135

52-
- name: Run examples
53-
run: make run-examples
36+
- name: Run tests
37+
run: make check
5438

55-
build-windows:
39+
build-windows-mingw:
5640
runs-on: windows-latest
41+
defaults:
42+
run:
43+
shell: msys2 {0}
5744
steps:
58-
- uses: actions/checkout@v4
59-
with:
60-
submodules: recursive
61-
62-
- name: Build (MinGW)
63-
shell: bash
64-
run: make
45+
- uses: actions/checkout@v4
46+
with:
47+
submodules: recursive
48+
49+
- uses: msys2/setup-msys2@v2
50+
with:
51+
msystem: MINGW64
52+
update: true
53+
install: >-
54+
mingw-w64-x86_64-gcc
55+
mingw-w64-x86_64-make
56+
make
57+
58+
- name: Show environment
59+
run: |
60+
echo "uname -s: $(uname -s)"
61+
echo "CXX: $(which g++)"
62+
g++ --version
6563
66-
- name: Run tests
67-
shell: bash
68-
run: make check
64+
- name: Build
65+
run: make -j$(nproc)
6966

70-
- name: Run examples
71-
shell: bash
72-
run: make run-examples
67+
- name: Run tests
68+
run: make check
7369

74-
build-freebsd:
75-
runs-on: ubuntu-latest
70+
build-windows-mingw32:
71+
runs-on: windows-latest
72+
defaults:
73+
run:
74+
shell: msys2 {0}
7675
steps:
77-
- uses: actions/checkout@v4
78-
79-
- name: Build and test on FreeBSD
80-
uses: vmactions/freebsd-vm@v1
81-
with:
82-
usesh: true
83-
prepare: |
84-
pkg install -y gmake git
76+
- uses: actions/checkout@v4
77+
with:
78+
submodules: recursive
79+
80+
- uses: msys2/setup-msys2@v2
81+
with:
82+
msystem: MINGW32
83+
update: true
84+
install: >-
85+
mingw-w64-i686-gcc
86+
mingw-w64-i686-make
87+
make
88+
89+
- name: Show environment
8590
run: |
86-
git config --global --add safe.directory /home/runner/work/archspec_cpp/archspec_cpp
87-
git submodule update --init --recursive
88-
gmake
89-
gmake check
90-
gmake run-examples
91-
92-
# Verify the library compiles with different C++ standards
93-
standards:
94-
runs-on: ubuntu-latest
95-
strategy:
96-
matrix:
97-
std: [17, 20, 23]
98-
steps:
99-
- uses: actions/checkout@v4
100-
with:
101-
submodules: recursive
91+
echo "uname -s: $(uname -s)"
92+
echo "CXX: $(which g++)"
93+
g++ --version
10294
103-
- name: Build with C++${{ matrix.std }}
104-
run: make CXXFLAGS="-std=c++${{ matrix.std }} -Wall -Wextra -Werror -O2"
95+
- name: Build
96+
run: make -j$(nproc)
10597

106-
- name: Run tests
107-
run: make check
98+
- name: Run tests
99+
run: make check
108100

109-
- name: Run examples
110-
run: make run-examples
101+
build-freebsd:
102+
runs-on: ubuntu-latest
103+
steps:
104+
- uses: actions/checkout@v4
105+
with:
106+
submodules: recursive
107+
108+
- name: Build and test on FreeBSD
109+
uses: vmactions/freebsd-vm@v1
110+
with:
111+
usesh: true
112+
prepare: |
113+
pkg install -y gmake
114+
run: |
115+
gmake -j$(sysctl -n hw.ncpu)
116+
gmake check

Makefile

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,39 @@ else ifeq ($(UNAME),FreeBSD)
3939
SHARED_FLAGS = -shared -fPIC
4040
STATIC_EXT = .a
4141
else ifeq ($(UNAME),Windows)
42-
# Windows (MinGW)
42+
# Windows (native or cmd.exe)
4343
LDFLAGS ?=
4444
SHARED_EXT = .dll
4545
SHARED_FLAGS = -shared
4646
STATIC_EXT = .a
4747
EXE_EXT = .exe
48+
else ifneq (,$(findstring MINGW,$(UNAME)))
49+
# MinGW (MSYS2 MINGW64/MINGW32 environment)
50+
LDFLAGS ?=
51+
SHARED_EXT = .dll
52+
SHARED_FLAGS = -shared
53+
STATIC_EXT = .a
54+
EXE_EXT = .exe
55+
else ifneq (,$(findstring MSYS,$(UNAME)))
56+
# MSYS2 MSYS environment
57+
LDFLAGS ?=
58+
SHARED_EXT = .dll
59+
SHARED_FLAGS = -shared
60+
STATIC_EXT = .a
61+
EXE_EXT = .exe
62+
else ifneq (,$(findstring CYGWIN,$(UNAME)))
63+
# Cygwin
64+
LDFLAGS ?=
65+
SHARED_EXT = .dll
66+
SHARED_FLAGS = -shared
67+
STATIC_EXT = .a
68+
EXE_EXT = .exe
69+
else
70+
# Unknown Unix-like (fallback to Linux-like settings)
71+
LDFLAGS ?=
72+
SHARED_EXT = .so
73+
SHARED_FLAGS = -shared -fPIC
74+
STATIC_EXT = .a
4875
endif
4976

5077
# Directories

0 commit comments

Comments
 (0)