Skip to content

Commit a9b32e3

Browse files
authored
Merge pull request #40 from myd7349/add-ci-support
add CI support
2 parents e49b0de + 72b139b commit a9b32e3

File tree

1 file changed

+130
-0
lines changed

1 file changed

+130
-0
lines changed

.github/workflows/build.yml

Lines changed: 130 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,130 @@
1+
name: PyStand
2+
3+
on: [ push, pull_request ]
4+
5+
env:
6+
PYSTAND_VERSION: v1.0.6
7+
BUILD_TYPE: Release
8+
9+
jobs:
10+
build-msvc:
11+
if: >-
12+
! contains(toJSON(github.event.commits.*.message), '[skip ci]') &&
13+
github.event.pull_request.draft == false
14+
15+
runs-on: windows-latest
16+
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
include:
21+
- { generator: Visual Studio 17 2022, arch: Win32, subsystem: GUI }
22+
- { generator: Visual Studio 17 2022, arch: Win32, subsystem: CLI }
23+
- { generator: Visual Studio 17 2022, arch: x64, subsystem: GUI }
24+
- { generator: Visual Studio 17 2022, arch: x64, subsystem: CLI }
25+
26+
steps:
27+
- name: Checkout
28+
uses: actions/checkout@v3
29+
30+
- name: Configure
31+
run: >
32+
cmake
33+
-G "${{ matrix.generator }}"
34+
-A ${{ matrix.arch }}
35+
-B build
36+
${{ matrix.subsystem == 'GUI' && '-DPYSTAND_CONSOLE=OFF' || '-DPYSTAND_CONSOLE=ON' }}
37+
38+
- name: Build
39+
run: |
40+
cmake --build build --config ${{ env.BUILD_TYPE }}
41+
42+
- name: Upload artifacts
43+
uses: actions/upload-artifact@v3
44+
with:
45+
name: PyStand-${{ env.PYSTAND_VERSION }}-${{ matrix.arch }}-${{ matrix.subsystem }}
46+
path: build/${{ env.BUILD_TYPE }}
47+
48+
build-gcc:
49+
if: >-
50+
! contains(toJSON(github.event.commits.*.message), '[skip ci]') &&
51+
github.event.pull_request.draft == false
52+
53+
runs-on: windows-latest
54+
55+
strategy:
56+
fail-fast: false
57+
matrix:
58+
include:
59+
- { sys: mingw32, arch: i686, subsystem: GUI }
60+
- { sys: mingw32, arch: i686, subsystem: CLI }
61+
- { sys: mingw64, arch: x86_64, subsystem: GUI }
62+
- { sys: mingw64, arch: x86_64, subsystem: CLI }
63+
64+
steps:
65+
- name: Checkout
66+
uses: actions/checkout@v3
67+
68+
- name: Setup MinGW-w64
69+
run: |
70+
if ( '${{ matrix.arch }}' -eq 'i686' )
71+
{
72+
Invoke-WebRequest -Uri https://github.com/brechtsanders/winlibs_mingw/releases/download/7.5.0-7.0.0-r1/winlibs-i686-posix-dwarf-gcc-7.5.0-mingw-w64-7.0.0-r1.7z -OutFile ${{ matrix.sys }}.7z
73+
}
74+
else
75+
{
76+
Invoke-WebRequest -Uri https://github.com/brechtsanders/winlibs_mingw/releases/download/7.5.0-7.0.0-r1/winlibs-x86_64-posix-seh-gcc-7.5.0-mingw-w64-7.0.0-r1.7z -OutFile ${{ matrix.sys }}.7z
77+
}
78+
7z x ${{ matrix.sys }}.7z
79+
"${{ github.workspace }}\${{ matrix.sys }}\bin" >> $env:GITHUB_PATH
80+
81+
- name: Configure
82+
run: >
83+
cmake
84+
-G "MinGW Makefiles"
85+
-B build
86+
-DCMAKE_BUILD_TYPE=${{ env.BUILD_TYPE }}
87+
${{ matrix.subsystem == 'GUI' && '-DPYSTAND_CONSOLE=OFF' || '-DPYSTAND_CONSOLE=ON' }}
88+
89+
- name: Build
90+
run: |
91+
cmake --build build --config ${{ env.BUILD_TYPE }}
92+
93+
- name: Upload artifacts
94+
uses: actions/upload-artifact@v3
95+
with:
96+
name: PyStand-${{ env.PYSTAND_VERSION }}-${{ matrix.sys }}-${{ matrix.subsystem }}
97+
path: build\PyStand.exe
98+
99+
release:
100+
needs: [ build-msvc, build-gcc ]
101+
102+
runs-on: windows-latest
103+
104+
steps:
105+
- name: Download artifacts
106+
uses: actions/download-artifact@v3
107+
108+
- name: List downloaded files
109+
run: ls -R
110+
111+
- name: Create archives
112+
run: |
113+
7z a PyStand-${{ env.PYSTAND_VERSION }}-Win32-CLI.zip .\PyStand-${{ env.PYSTAND_VERSION }}-Win32-CLI\*
114+
7z a PyStand-${{ env.PYSTAND_VERSION }}-Win32-GUI.zip .\PyStand-${{ env.PYSTAND_VERSION }}-Win32-GUI\*
115+
7z a PyStand-${{ env.PYSTAND_VERSION }}-x64-CLI.zip .\PyStand-${{ env.PYSTAND_VERSION }}-x64-CLI\*
116+
7z a PyStand-${{ env.PYSTAND_VERSION }}-x64-GUI.zip .\PyStand-${{ env.PYSTAND_VERSION }}-x64-GUI\*
117+
7z a PyStand-${{ env.PYSTAND_VERSION }}-mingw32-CLI.zip .\PyStand-${{ env.PYSTAND_VERSION }}-mingw32-CLI\*
118+
7z a PyStand-${{ env.PYSTAND_VERSION }}-mingw32-GUI.zip .\PyStand-${{ env.PYSTAND_VERSION }}-mingw32-GUI\*
119+
7z a PyStand-${{ env.PYSTAND_VERSION }}-mingw64-CLI.zip .\PyStand-${{ env.PYSTAND_VERSION }}-mingw64-CLI\*
120+
7z a PyStand-${{ env.PYSTAND_VERSION }}-mingw64-GUI.zip .\PyStand-${{ env.PYSTAND_VERSION }}-mingw64-GUI\*
121+
122+
- name: Release
123+
uses: softprops/action-gh-release@v1
124+
if: startsWith(github.ref, 'refs/tags/')
125+
env:
126+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
127+
with:
128+
generate_release_notes: true
129+
files: |
130+
PyStand*.zip

0 commit comments

Comments
 (0)