-
Notifications
You must be signed in to change notification settings - Fork 0
95 lines (82 loc) · 3.18 KB
/
generate-binaries-2.yml
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
name: Generate Binaries-2
on:
workflow_call:
concurrency:
group: generate-binaries
cancel-in-progress: true
jobs:
build_binaries:
name: ${{ matrix.build_linux }} • ${{ matrix.build_arch }}
runs-on: ubuntu-latest
strategy:
fail-fast: true
matrix:
build_arch: [ "arm64", "amd64" ]
build_linux: [ manylinux, musllinux ]
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v3
with:
repository: cloud-py-api/py_bundler
path: py_bundler
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Setup Docker Buildx
uses: docker/setup-buildx-action@v2
- name: Get Bin Prefix
run: |
APP_ID="$(sed -n "s/<id>\(.*\)<\/id>/\\1/p" ./appinfo/info.xml | tr -d '\t' | sed -n 1p)"
echo BIN_NAME="$APP_ID"_"$BIN_SUFFIX" >> $GITHUB_ENV
env:
BIN_SUFFIX: ${{ matrix.build_linux }}_${{ matrix.build_arch }}
- name: ManyLinux prepare
if: matrix.build_linux == 'manylinux'
run: echo TEST_DISTRO_NAME="debian:10" >> $GITHUB_ENV
- name: MuslLinux prepare
if: matrix.build_linux == 'musllinux'
run: echo TEST_DISTRO_NAME="alpine:3.17" >> $GITHUB_ENV
- name: Build Image
uses: docker/build-push-action@v4
with:
context: .
file: py_bundler/docker/bundle_release.Dockerfile
build-args: |
BUILD_IMG=ghcr.io/cloud-py-api/py_bundler/${{ matrix.build_linux }}_${{ matrix.build_arch }}:latest
platforms: linux/${{ matrix.build_arch }}
push: false
cache-from: type=gha,scope=binaries-${{ matrix.build_linux }}-${{ matrix.build_arch }}
outputs: type=docker
tags: binaries-${{ matrix.build_linux }}-${{ matrix.build_arch }}:latest
- name: Nuitka cache
uses: actions/cache@v3
with:
path: ${{ github.workspace }}/nu_cache
key: nu-cache-${{ matrix.build_linux }}-${{ matrix.build_arch }}-${{ hashFiles('requirements.txt') }}
- name: Build binary
run: |
mkdir -p nu_cache
docker run \
--mount type=bind,src=${{ github.workspace }}/nu_cache,dst=/root/.cache/Nuitka \
--mount type=bind,src=${{ github.workspace }},dst=/project \
--workdir /project \
binaries-${{ matrix.build_linux }}-${{ matrix.build_arch }}:latest \
/bin/sh -c "python3 -m nuitka --plugin-enable=numpy --standalone main.py"
mv main.dist ${{ env.BIN_NAME }}
tar czf ${{ env.BIN_NAME }}.tar.gz ${{ env.BIN_NAME }}
python3 py_bundler/generate_hashes.py ${{ env.BIN_NAME }}
- name: Uploading binary
uses: actions/upload-artifact@v3
with:
name: cp_binaries
path: ./${{ env.BIN_NAME }}.*
if-no-files-found: error
- name: Test binary
uses: docker/build-push-action@v4
with:
context: .
platforms: linux/${{ matrix.build_arch }}
push: false
file: py_bundler/docker/release_info.Dockerfile
build-args: |
BIN_NAME=${{ env.BIN_NAME }}
DISTRO_NAME=${{ env.TEST_DISTRO_NAME }}