This repository has been archived by the owner on Feb 17, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 6
114 lines (109 loc) · 3.88 KB
/
python.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Python
on:
push:
paths:
- 'python/**'
- '.github/workflows/python.yaml'
permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
- name: Build docker image
working-directory: python
run: |
docker build -t builder .
- name: Compile
working-directory: python
run: |
docker run -v `pwd`:/src -w /src -e NO_OPT=true builder ./build.sh
- name: Check for output
run: |
find . -name python.wasm
find . -name python311.zip
- name: Archive build output
uses: actions/upload-artifact@v3
with:
name: python-wasm-stdlib
path: |
python/cpython/python.wasm
python/cpython/usr/local/lib/python311.zip
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
- name: Copy build output to public S3
run: |
aws s3 cp python/cpython/python.wasm s3://timecraft/python/$GITHUB_SHA/python.wasm
aws s3 cp python/cpython/usr/local/lib/python311.zip s3://timecraft/python/$GITHUB_SHA/python311.zip
- name: Copy build output to public S3 main
if: ${{ github.ref == 'refs/heads/main' }}
run: |
aws s3 cp python/cpython/python.wasm s3://timecraft/python/main/python.wasm
aws s3 cp python/cpython/usr/local/lib/python311.zip s3://timecraft/python/main/python311.zip
build_vanilla:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
- name: Build docker image
working-directory: python
run: |
docker build -t builder .
- name: Compile
working-directory: python
run: |
docker run -v `pwd`:/src -w /src -e NO_OPT=true -e NO_WASMEDGE=true builder ./build.sh
- name: Check for output
run: |
find . -name python.wasm
find . -name python311.zip
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v2
with:
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
aws-region: us-east-1
- name: Copy build output to public S3
run: |
aws s3 cp python/cpython/python.wasm s3://timecraft/python-vanilla/$GITHUB_SHA/python.wasm
aws s3 cp python/cpython/usr/local/lib/python311.zip s3://timecraft/python-vanilla/$GITHUB_SHA/python311.zip
- name: Copy build output to public S3 main
if: ${{ github.ref == 'refs/heads/main' }}
run: |
aws s3 cp python/cpython/python.wasm s3://timecraft/python-vanilla/main/python.wasm
aws s3 cp python/cpython/usr/local/lib/python311.zip s3://timecraft/python-vanilla/main/python311.zip
docker-build:
runs-on: ubuntu-latest
env:
PAT_PACKAGES: ${{ secrets.PAT_PACKAGES }}
needs: build_and_test
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: true
fetch-depth: 0
- name: Download build output
uses: actions/download-artifact@v3
with:
name: python-wasm-stdlib
path: python/cpython
- run: echo $PAT_PACKAGES | docker login ghcr.io -u USERNAME --password-stdin
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
- name: Set up Docker Buildx
id: buildx
uses: docker/setup-buildx-action@v1
- name: Build and push
working-directory: python
run: |
echo "noop: make docker-buildx"