Skip to content

Commit 49e0030

Browse files
authored
Merge pull request emmatyping#24 from tiran/ci
Add rudimentary CI with GHA
2 parents 0f947dd + 488f4e5 commit 49e0030

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

.github/workflows/ci.yml

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
---
2+
name: CI
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
pull_request:
9+
branches:
10+
- main
11+
schedule:
12+
- cron: '30 2 * * *'
13+
workflow_dispatch:
14+
inputs:
15+
git-ref:
16+
required: false
17+
18+
jobs:
19+
emscripten:
20+
name: "Emscripten build"
21+
runs-on: "ubuntu-latest"
22+
steps:
23+
- name: "checkout python-wasm"
24+
uses: "actions/checkout@v2"
25+
- name: "checkout CPython"
26+
uses: "actions/checkout@v2"
27+
with:
28+
repository: python/cpython
29+
path: cpython
30+
ref: main
31+
- name: "Verify checkout"
32+
run: |
33+
test -x build-python-build.sh || exit 1
34+
test -x cpython/configure || exit 2
35+
- name: "Pull build image"
36+
run: docker pull quay.io/tiran/cpythonbuild:ubuntu-impish-wasm
37+
- name: "Build build Python"
38+
run: docker run --rm -v $(pwd):/build -w /build quay.io/tiran/cpythonbuild:ubuntu-impish-wasm ./build-python-build.sh
39+
- name: "Build emscripten Python"
40+
run: docker run --rm -v $(pwd):/build -w /build quay.io/tiran/cpythonbuild:ubuntu-impish-wasm ./build-python-host-emscripten.sh
41+
- name: "Check artifacts"
42+
run: |
43+
ls -la --si cpython/builddir/host/python*
44+
ls -la cpython/builddir/host/Modules/
45+
test -e cpython/builddir/host/python.data || exit 1
46+
- name: "Upload wasm artifacts"
47+
uses: actions/upload-artifact@v2
48+
with:
49+
name: wasm
50+
path: |
51+
cpython/builddir/host/python.wasm
52+
cpython/builddir/host/python.html
53+
cpython/builddir/host/python.js
54+
cpython/builddir/host/python.data
55+
if-no-files-found: error
56+
- name: "Upload build artifacts"
57+
uses: actions/upload-artifact@v2
58+
with:
59+
name: build
60+
path: |
61+
cpython/builddir/host/config.log
62+
cpython/builddir/host/config.cache
63+
cpython/builddir/host/Makefile
64+
cpython/builddir/host/pyconfig.h
65+
cpython/builddir/host/libpython*.a
66+
cpython/builddir/host/Modules/Setup.local
67+
cpython/builddir/host/Modules/Setup.stdlib
68+
cpython/builddir/host/Modules/config.c
69+
cpython/builddir/host/Modules/_decimal/libmpdec/libmpdec.a
70+
cpython/builddir/host/Modules/expat/libexpat.a
71+
cpython/builddir/host/Programs/python.o
72+
if-no-files-found: error

build-python-host-emscripten.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,15 @@ embuilder build zlib
1111
pushd cpython/builddir/host
1212
cp ../../../config.site-wasm config.site-wasm
1313
CONFIG_SITE=config.site-wasm READELF=true ZLIB_LIBS="-s USE_ZLIB" emconfigure ../../configure -C --without-pymalloc --enable-big-digits=30 --with-pydebug --with-ensurepip=no --disable-ipv6 --host=wasm32-unknown-emscripten --build=$(../../config.guess) --with-build-python=$(pwd)/../build/python --with-freeze-module=$(pwd)/../build/Programs/_freeze_module
14+
15+
# Use Setup.stdlib and force rebuild of Makefile
1416
ln -sfr Modules/Setup.stdlib Modules/Setup.local
17+
rm Modules/config.c
18+
make Modules/config.c
19+
1520
emmake make -j$(nproc)
1621
make altinstall prefix=../usr/local
22+
1723
pushd ../usr/local
1824
# not needed, as the binary is already loaded by the .html
1925
# includes aren't need for distribution, various libraries

0 commit comments

Comments
 (0)