Skip to content

Commit 64941de

Browse files
committed
ci: optimize and reformat workflow
1 parent 7033ae1 commit 64941de

1 file changed

Lines changed: 60 additions & 29 deletions

File tree

.github/workflows/main.yml

Lines changed: 60 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -10,55 +10,79 @@ jobs:
1010
fail-fast: false
1111
matrix:
1212
include:
13-
- cpython: "3.10"
14-
arch: x64
13+
- arch: x64
14+
cpython_branch: "3.10"
15+
cpython_commit: d8ba5c102c54a5f0944638df4b6cda689faba7fa
1516
os: windows-2022
16-
- cpython: "3.10"
17-
arch: x86
17+
- arch: x86
18+
cpython_branch: "3.10"
19+
cpython_commit: d8ba5c102c54a5f0944638df4b6cda689faba7fa
1820
os: windows-2022
19-
- cpython: "3.8"
20-
arch: x64
21+
- arch: x64
22+
cpython_branch: "3.8"
23+
cpython_commit: ccbc31ecf3a08ef626be9bbb099f0ce801142fc8
2124
os: windows-2019
22-
- cpython: "3.8"
23-
arch: x86
25+
- arch: x86
26+
cpython_branch: "3.8"
27+
cpython_commit: ccbc31ecf3a08ef626be9bbb099f0ce801142fc8
2428
os: windows-2019
2529
runs-on: ${{ matrix.os }}
2630
steps:
2731
- name: Set up python
2832
uses: actions/setup-python@v2
2933
with:
3034
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
35+
36+
- name: Get cpython
3937
shell: bash
40-
working-directory: ./cpython
41-
run: git fetch --tags --force
38+
run: |
39+
git init cpython
40+
git -C cpython remote add origin https://github.com/python/cpython.git
41+
git -C cpython fetch \
42+
--depth=1000 \
43+
--progress \
44+
origin \
45+
'+refs/heads/${{ matrix.cpython_branch }}:refs/remotes/origin/${{ matrix.cpython_branch }}' \
46+
'+refs/tags/v${{ matrix.cpython_branch }}.*:refs/tags/v${{ matrix.cpython_branch }}.*'
47+
git -C cpython checkout '${{ matrix.cpython_commit }}'
48+
4249
- name: Get vars
4350
id: vars
4451
shell: pwsh
45-
working-directory: .\cpython
4652
run: |
47-
$d = (.\PCbuild\build.bat -V) | %{ if($_ -match '\s+(\w+):\s*(.+)\s*$') { @{$Matches[1] = $Matches[2];} }};
53+
$d = (.\cpython\PCbuild\build.bat -V) | %{ if($_ -match '\s+(\w+):\s*(.+)\s*$') { @{$Matches[1] = $Matches[2];} }};
4854
echo ("::set-output name=python_version::" + $d.PythonVersion)
49-
echo ("::set-output name=git_version::" + (git describe --tags))
55+
echo ("::set-output name=git_version::" + (git -C cpython describe --tags --long))
56+
5057
# - name: Get external libs (sources)
5158
# shell: pwsh
5259
# run: |
53-
# .\cpython\PCbuild\get_externals.bat --no-tkinter --tkinter-src --no-openssl --openssl-src --no-libffi --libffi-src
60+
# .\cpython\PCbuild\get_externals.bat `
61+
# --no-tkinter `
62+
# --tkinter-src `
63+
# --no-openssl `
64+
# --openssl-src `
65+
# --no-libffi `
66+
# --libffi-src
67+
#
5468
# # prepare_tcltk.bat (only build for the arch we're interested in)
5569
# - name: Build Tcl/Tk
5670
# shell: pwsh
5771
# run: |
5872
# $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
73+
# & $env:MSBUILD `
74+
# .\cpython\PCbuild\tcl.vcxproj `
75+
# /p:Configuration=Release `
76+
# /p:Platform=$platform
77+
# & $env:MSBUILD `
78+
# .\cpython\PCbuild\tk.vcxproj `
79+
# /p:Configuration=Release `
80+
# /p:Platform=$platform
81+
# & $env:MSBUILD `
82+
# .\cpython\PCbuild\tix.vcxproj `
83+
# /p:Configuration=Release `
84+
# /p:Platform=$platform
85+
#
6286
# # prepare_ssl.bat (only build for the arch we're interested in)
6387
# - name: Build OpenSSL
6488
# shell: pwsh
@@ -67,31 +91,38 @@ jobs:
6791
# $env:MSBUILD = (cmd /v:on /c "call .\cpython\PCbuild\find_msbuild.bat >nul && echo !MSBUILD!")
6892
# $env:PYTHON = (Get-Command python.exe).Path
6993
# $env:PERL = (Get-Command perl.exe).Path
70-
# "& $env:MSBUILD .\cpython\PCbuild\openssl.vcxproj /p:Configuration=Release /p:Platform=$platform" | Invoke-Expression
94+
# & $env:MSBUILD `
95+
# .\cpython\PCbuild\openssl.vcxproj `
96+
# /p:Configuration=Release `
97+
# /p:Platform=$platform
98+
#
99+
# # prepare_libffi.bat
71100
# - uses: cygwin/cygwin-install-action@ad81540ad7c2726e17c08401fbeca6380cc7f463
72101
# with:
73102
# platform: x86_64
74103
# packages: make,autoconf,automake,libtool,dejagnu
75-
# # prepare_libffi.bat
76104
# - name: Build libffi
77105
# shell: pwsh
78106
# run: |
79107
# $env:LIBFFI_SOURCE = (Resolve-Path .\cpython\externals\libffi-*).Path
80108
# $env:SH = "C:\cygwin\bin\sh.exe"
81109
# .\cpython\PCbuild\prepare_libffi.bat -${{ matrix.arch }} -license
110+
82111
- name: Get external libs (pre-built binaries)
83112
shell: pwsh
84113
run: |
85114
.\cpython\PCbuild\get_externals.bat
115+
86116
- name: Build
87117
shell: pwsh
88118
run: |
89-
$platform = If ("${{ matrix.arch }}" -eq "x86") {"Win32"} else {"${{ matrix.arch }}"}
119+
$platform = "${{ matrix.arch }}" -eq "x86" ? "Win32" : "${{ matrix.arch }}"
90120
.\cpython\PCbuild\build.bat -v -c Release -p $platform
121+
91122
- name: Package
92123
shell: pwsh
93124
run: |
94-
$platform = If ("${{ matrix.arch }}" -eq "x86") {"win32"} else {"amd64"}
125+
$platform = "${{ matrix.arch }}" -eq "x86" ? "win32" : "amd64"
95126
& (".\cpython\PCbuild\" + $platform + "\python.exe") `
96127
.\cpython\PC\layout `
97128
-vv `

0 commit comments

Comments
 (0)