-
Notifications
You must be signed in to change notification settings - Fork 58
140 lines (121 loc) · 4.59 KB
/
Copy pathbuild.yml
File metadata and controls
140 lines (121 loc) · 4.59 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
# This workflow builds codecov-cli on push to a release/* branch. The artifacts
# are later picked up and released by Craft.
name: Build release
on:
push:
branches:
- "release/**"
permissions:
contents: read
jobs:
build_for_pypi:
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
with:
persist-credentials: false
- name: Install dependencies
run: pip install uv
- name: Build codecov-cli sdist and bdist
run: uv build
- name: Upload codecov-cli artifacts
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: codecov-cli_wheel
path: ./dist/*
build_assets:
name: Build ${{ matrix.os }} binaries
runs-on: ${{ matrix.os }}
strategy:
fail-fast: true
matrix:
include:
- os: macos-14
TARGET: macos
CMD_BUILD: >
uv run pyinstaller --target-arch universal2 -F ./codecov_cli/main.py &&
mv ./dist/main ./dist/codecovcli_macos
OUT_FILE_SUFFIX: _macos
ASSET_MIME: application/octet-stream
- os: windows-2022
TARGET: windows
CMD_BUILD: >
uv run pyinstaller -F .\codecov_cli\main.py &&
Move-Item -Path ".\dist\main.exe" -Destination ".\dist\codecovcli_windows.exe"
OUT_FILE_SUFFIX: _windows.exe
ASSET_MIME: application/vnd.microsoft.portable-executable
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- name: Set up Python 3.9
uses: actions/setup-python@a26af69be951a213d495a4c3e4e4022e16d87065 # v5.6.0
with:
python-version: "3.9"
- name: Install dependencies
run: |
pip install uv
# Need to build pyyaml and ijson from sdists to get universal2 macos build to work
uv sync --no-binary-package pyyaml --no-binary-package ijson
- name: Build with pyinstaller for ${{matrix.TARGET}}
run: ${{matrix.CMD_BUILD}}
- name: Upload codecovcli binary for ${{matrix.TARGET}}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: codecovcli${{matrix.OUT_FILE_SUFFIX}}
path: ./dist/codecovcli${{matrix.OUT_FILE_SUFFIX}}
build_linux_assets:
name: Build ${{ matrix.distro_name }}_${{ matrix.arch }} binary
runs-on: ${{ matrix.runs-on }}
strategy:
matrix:
include:
- distro: "alpine:3.14" # alpine 3.14 needed for musl 1.2.2/python 3.9 compatibility
arch: arm64
distro_name: alpine
runs-on: ubuntu-24.04-arm
- distro: "alpine:3.14"
arch: x86_64
distro_name: alpine
runs-on: ubuntu-24.04
- distro: "ubuntu:20.04" # ubuntu 20.04 needed for glibc 2.31/python 3.9 compatibility
arch: arm64
distro_name: linux
runs-on: ubuntu-24.04-arm
- distro: "ubuntu:20.04"
distro_name: linux
arch: x86_64
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- 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 }}.sh ${{ matrix.distro_name }}_${{ matrix.arch }}
- name: Upload codecovcli binary for ${{matrix.distro_name}}_${{ matrix.arch}}
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: codecovcli_${{ matrix.distro_name }}_${{ matrix.arch }}
path: ./dist/codecovcli_*
package_artifacts:
# Craft requires one artifact named after the long commit sha of the release.
name: Package assets for Craft
runs-on: ubuntu-latest
needs: [build_for_pypi, build_assets, build_linux_assets]
steps:
- name: Download artifacts
uses: actions/download-artifact@d3f86a106a0bac45b974a628896c90dbdf5c8093 # v4.3.0
with:
pattern: "{codecov-,codecov}cli*"
- name: Upload release artifact
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
with:
name: ${{ github.sha }}
path: |
codecovcli*
codecov-cli_wheel/*