Skip to content
This repository was archived by the owner on Jul 16, 2025. It is now read-only.

Commit 47651d7

Browse files
Merge pull request #336 from codecov/joseph/build-alpine-arm
build: add CI job for building Alpine and ARM64 linux images
2 parents 145701f + 57fffe7 commit 47651d7

File tree

3 files changed

+67
-2
lines changed

3 files changed

+67
-2
lines changed

.github/workflows/build_assets.yml

Lines changed: 49 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,8 +17,6 @@ jobs:
1717
matrix:
1818
include:
1919
- os: macos-latest
20-
env:
21-
CFLAGS: -arch arm64 -arch x86_64
2220
TARGET: macos
2321
CMD_REQS: >
2422
mkdir -p pip-packages && cd pip-packages && pip wheel --no-cache-dir --no-binary tree_sitter,ijson,charset_normalizer,PyYAML .. && cd .. &&
@@ -83,5 +81,54 @@ jobs:
8381
tag: ${{ github.ref }}
8482
overwrite: true
8583

84+
build_assets_alpine_arm:
85+
name: Build assets - Alpine and ARM
86+
runs-on: ubuntu-latest
87+
strategy:
88+
matrix:
89+
include:
90+
- distro: "python:3.11-alpine3.18"
91+
arch: arm64
92+
distro_name: alpine
93+
- distro: "python:3.11-alpine3.18"
94+
arch: x86_64
95+
distro_name: alpine
96+
- distro: "python:3.11"
97+
arch: arm64
98+
distro_name: linux
99+
100+
steps:
101+
- uses: actions/checkout@v4
102+
with:
103+
submodules: true
104+
- name: Set up QEMU
105+
uses: docker/setup-qemu-action@v1
106+
with:
107+
platforms: ${{ matrix.arch }}
108+
- name: Run in Docker
109+
run: |
110+
docker run \
111+
--rm \
112+
-v $(pwd):/${{ github.workspace }} \
113+
-w ${{ github.workspace }} \
114+
--platform linux/${{ matrix.arch }} \
115+
${{ matrix.distro }} \
116+
./scripts/build_${{ matrix.distro_name }}_arm.sh ${{ matrix.distro_name }}_${{ matrix.arch }}
117+
- name: Upload a Build Artifact
118+
uses: actions/[email protected]
119+
if: inputs.release == false
120+
with:
121+
path: ./dist/codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
122+
- name: Upload Release Asset
123+
if: inputs.release == true
124+
id: upload-release-asset
125+
uses: svenstaro/upload-release-action@v2
126+
with:
127+
repo_token: ${{ secrets.GITHUB_TOKEN }}
128+
file: ./dist/codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
129+
asset_name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
130+
tag: ${{ github.ref }}
131+
overwrite: true
132+
86133

87134

scripts/build_alpine_arm.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
apk add musl-dev build-base
3+
pip install -r requirements.txt
4+
pip install .
5+
python setup.py build
6+
STATICCODECOV_LIB_PATH=$(find build/ -maxdepth 1 -type d -name 'lib.*' -print -quit | xargs -I {} sh -c "find {} -type f -name 'staticcodecov*' -print -quit | sed 's|^./||'")
7+
pip install pyinstaller
8+
pyinstaller --add-binary ${STATICCODECOV_LIB_PATH}:. --copy-metadata codecov-cli --hidden-import staticcodecov_languages -F codecov_cli/main.py
9+
cp ./dist/main ./dist/codecovcli_$1

scripts/build_linux_arm.sh

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
apt install build-essential
3+
pip install -r requirements.txt
4+
pip install .
5+
python setup.py build
6+
STATICCODECOV_LIB_PATH=$(find build/ -maxdepth 1 -type d -name 'lib.*' -print -quit | xargs -I {} sh -c "find {} -type f -name 'staticcodecov*' -print -quit | sed 's|^./||'")
7+
pip install pyinstaller
8+
pyinstaller --add-binary ${STATICCODECOV_LIB_PATH}:. --copy-metadata codecov-cli --hidden-import staticcodecov_languages -F codecov_cli/main.py
9+
cp ./dist/main ./dist/codecovcli_$1

0 commit comments

Comments
 (0)