Skip to content

Commit 572acbc

Browse files
committed
ci: add initial build config
1 parent e6c7721 commit 572acbc

1 file changed

Lines changed: 107 additions & 0 deletions

File tree

.github/workflows/main.yml

Lines changed: 107 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,107 @@
1+
name: Build
2+
3+
on:
4+
push: {}
5+
pull_request: {}
6+
7+
jobs:
8+
build:
9+
strategy:
10+
fail-fast: false
11+
matrix:
12+
include:
13+
- cpython: "3.10"
14+
arch: x64
15+
os: windows-2022
16+
- cpython: "3.10"
17+
arch: x86
18+
os: windows-2022
19+
- cpython: "3.8"
20+
arch: x64
21+
os: windows-2016
22+
- cpython: "3.8"
23+
arch: x86
24+
os: windows-2016
25+
runs-on: ${{ matrix.os }}
26+
steps:
27+
- name: Set up python
28+
uses: actions/setup-python@v2
29+
with:
30+
python-version: "3.10"
31+
- name: Check out cpython
32+
uses: actions/checkout@v3
33+
with:
34+
repository: python/cpython
35+
ref: ${{ matrix.cpython }}
36+
fetch-depth: 0
37+
path: cpython
38+
- name: Fetch tags
39+
shell: bash
40+
working-directory: ./cpython
41+
run: git fetch --tags --force
42+
- name: Get vars
43+
id: vars
44+
shell: pwsh
45+
working-directory: .\cpython
46+
run: |
47+
$d = (.\PCbuild\build.bat -V) | %{ if($_ -match '\s+(\w+):\s*(.+)\s*$') { @{$Matches[1] = $Matches[2];} }};
48+
echo ("::set-output name=python_version::" + $d.PythonVersion)
49+
echo ("::set-output name=git_version::" + (git describe --tags))
50+
# - name: Get external libs (sources)
51+
# shell: pwsh
52+
# run: |
53+
# .\cpython\PCbuild\get_externals.bat --no-tkinter --tkinter-src --no-openssl --openssl-src --no-libffi --libffi-src
54+
# # prepare_tcltk.bat (only build for the arch we're interested in)
55+
# - name: Build Tcl/Tk
56+
# shell: pwsh
57+
# run: |
58+
# $env:MSBUILD = (cmd /v:on /c "call .\cpython\PCbuild\find_msbuild.bat >nul && echo !MSBUILD!")
59+
# "& $env:MSBUILD .\cpython\PCbuild\tcl.vcxproj /p:Configuration=Release /p:Platform=$platform" | Invoke-Expression
60+
# "& $env:MSBUILD .\cpython\PCbuild\tk.vcxproj /p:Configuration=Release /p:Platform=$platform" | Invoke-Expression
61+
# "& $env:MSBUILD .\cpython\PCbuild\tix.vcxproj /p:Configuration=Release /p:Platform=$platform" | Invoke-Expression
62+
# # prepare_ssl.bat (only build for the arch we're interested in)
63+
# - name: Build OpenSSL
64+
# shell: pwsh
65+
# run: |
66+
# $platform = If ("${{ matrix.arch }}" -eq "x86") {"Win32"} else {"${{ matrix.arch }}"}
67+
# $env:MSBUILD = (cmd /v:on /c "call .\cpython\PCbuild\find_msbuild.bat >nul && echo !MSBUILD!")
68+
# $env:PYTHON = (Get-Command python.exe).Path
69+
# $env:PERL = (Get-Command perl.exe).Path
70+
# "& $env:MSBUILD .\cpython\PCbuild\openssl.vcxproj /p:Configuration=Release /p:Platform=$platform" | Invoke-Expression
71+
# - uses: cygwin/cygwin-install-action@ad81540ad7c2726e17c08401fbeca6380cc7f463
72+
# with:
73+
# platform: x86_64
74+
# packages: make,autoconf,automake,libtool,dejagnu
75+
# # prepare_libffi.bat
76+
# - name: Build libffi
77+
# shell: pwsh
78+
# run: |
79+
# $env:LIBFFI_SOURCE = (Resolve-Path .\cpython\externals\libffi-*).Path
80+
# $env:SH = "C:\cygwin\bin\sh.exe"
81+
# .\cpython\PCbuild\prepare_libffi.bat -${{ matrix.arch }} -license
82+
- name: Get external libs (pre-built binaries)
83+
shell: pwsh
84+
run: |
85+
.\cpython\PCbuild\get_externals.bat
86+
- name: Build
87+
shell: pwsh
88+
run: |
89+
$platform = If ("${{ matrix.arch }}" -eq "x86") {"Win32"} else {"${{ matrix.arch }}"}
90+
.\cpython\PCbuild\build.bat -v -c Release -p $platform
91+
- name: Package
92+
shell: pwsh
93+
run: |
94+
$platform = If ("${{ matrix.arch }}" -eq "x86") {"win32"} else {"amd64"}
95+
& (".\cpython\PCbuild\" + $platform + "\python.exe") `
96+
.\cpython\PC\layout `
97+
-vv `
98+
--source .\cpython `
99+
--build .\cpython\PCbuild\$platform `
100+
--arch $platform `
101+
--temp .\temp `
102+
--precompile `
103+
--zip "python-${{ steps.vars.outputs.git_version }}-windows-${{ matrix.arch }}-embed.zip"
104+
- uses: actions/upload-artifact@v2
105+
with:
106+
name: python-${{ steps.vars.outputs.git_version }}-windows-${{ matrix.arch }}-embed
107+
path: ./*.zip

0 commit comments

Comments
 (0)