-
Notifications
You must be signed in to change notification settings - Fork 56
173 lines (168 loc) · 5.96 KB
/
build_assets.yml
File metadata and controls
173 lines (168 loc) · 5.96 KB
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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
---
name: Build Compiled Assets
on:
workflow_call:
inputs:
release:
type: boolean
default: false
description: "Attach artifacts to a release"
jobs:
build_assets:
name: Build packages - ${{ matrix.os }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: macos-latest
TARGET: macos
# currently, wrapt pulls the arm64 version instead of the universal one, so the below is a hack
CMD_REQS: >
mkdir -p pip-packages && cd pip-packages && pip wheel --no-cache-dir --no-binary ijson,charset_normalizer,PyYAML .. &&
rm $(ls | grep wrapt) && pip download wrapt --platform=universal2 --only-binary=:all: && pip install $(ls | grep wrapt) --force-reinstall && cd .. &&
pip install --no-deps --no-index --find-links=pip-packages pip-packages/*
CMD_BUILD: >
pyinstaller --copy-metadata codecov-cli --target-arch universal2 -F codecov_cli/main.py &&
mv dist/main dist/codecovcli_macos &&
lipo -archs dist/codecovcli_macos | grep 'x86_64 arm64'
OUT_FILE_NAME: codecovcli_macos
ASSET_MIME: application/octet-stream
- os: ubuntu-22.04
TARGET: ubuntu
CMD_REQS: >
pip install -r requirements.txt && pip install .
CMD_BUILD: >
pyinstaller --copy-metadata codecov-cli -F codecov_cli/main.py &&
cp ./dist/main ./dist/codecovcli_linux
OUT_FILE_NAME: codecovcli_linux
ASSET_MIME: application/octet-stream
- os: windows-latest
TARGET: windows
CMD_REQS: >
pip install -r requirements.txt && pip install .
CMD_BUILD: >
pyinstaller --copy-metadata codecov-cli -F codecov_cli\main.py &&
Copy-Item -Path ".\dist\main.exe" -Destination ".\dist\codecovcli_windows.exe"
OUT_FILE_NAME: codecovcli_windows.exe
ASSET_MIME: application/vnd.microsoft.portable-executable
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up Python 3.11
uses: actions/setup-python@v3
with:
python-version: "3.11"
- name: Install dependencies
run: |
${{matrix.CMD_REQS}}
python setup.py build
- name: Install pyinstaller
run: pip install pyinstaller
- name: Build with pyinstaller for ${{matrix.TARGET}}
run: ${{matrix.CMD_BUILD}}
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
if: inputs.release == false
with:
name: ${{ matrix.OUT_FILE_NAME }}
path: ./dist/${{ matrix.OUT_FILE_NAME }}
- name: Upload Release Asset
if: inputs.release == true
id: upload-release-asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./dist/${{ matrix.OUT_FILE_NAME }}
asset_name: ${{ matrix.OUT_FILE_NAME }}
tag: ${{ github.ref }}
overwrite: true
build_assets_alpine_arm:
name: Build assets - Alpine and ARM
runs-on: ubuntu-latest
strategy:
matrix:
include:
- distro: "python:3.11-alpine3.18"
arch: arm64
distro_name: alpine
- distro: "python:3.11-alpine3.18"
arch: x86_64
distro_name: alpine
- distro: "python:3.11-bullseye"
arch: arm64
distro_name: linux
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Set up QEMU
uses: docker/setup-qemu-action@v1
with:
platforms: ${{ matrix.arch }}
- name: Run in Docker
run: |
docker run \
--rm \
-v $(pwd):/${{ github.workspace }} \
-w ${{ github.workspace }} \
--platform linux/${{ matrix.arch }} \
${{ matrix.distro }} \
./scripts/build_${{ matrix.distro_name }}_arm.sh ${{ matrix.distro_name }}_${{ matrix.arch }}
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
if: inputs.release == false
with:
name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
path: ./dist/codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
- name: Upload Release Asset
if: inputs.release == true
id: upload-release-asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./dist/codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
asset_name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
tag: ${{ github.ref }}
overwrite: true
build_assets_freebsd:
name: Build assets - FreeBSD
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Run in VM
uses: vmactions/freebsd-vm@v1
with:
release: "13.5"
usesh: true
prepare: |
pkg update
pkg install -y python311
run: |
python3.11 -m venv .venv --upgrade-deps
. .venv/bin/activate
pip install -r requirements.txt
pip install .
python setup.py build
pip install pyinstaller
pyinstaller --copy-metadata codecov-cli -F codecov_cli/main.py
cp ./dist/main ./dist/codecovcli_freebsd
- name: Upload a Build Artifact
uses: actions/upload-artifact@v4
if: inputs.release == false
with:
name: codecovcli_freebsd
path: ./dist/codecovcli_freebsd
- name: Upload Release Asset
if: inputs.release == true
id: upload-release-asset
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ./dist/codecovcli_freebsd
asset_name: codecovcli_freebsd
tag: ${{ github.ref }}
overwrite: true