-
Notifications
You must be signed in to change notification settings - Fork 0
123 lines (107 loc) · 3.93 KB
/
Copy pathrelease-binaries.yml
File metadata and controls
123 lines (107 loc) · 3.93 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
name: Release binaries
# Build and publish standalone db2sql executables (Windows x64, Linux x64
# built on Debian 12 for wide glibc compatibility, macOS arm64) whenever a
# version tag is pushed. Also available on demand from the Actions tab.
on:
push:
tags:
- "v*"
workflow_dispatch:
inputs:
# When a tag is pushed, the default value will be true in order to attach artifacts to the release
attach-to-release:
description: "Attach built artifacts to the GitHub release matching the current ref (if any)"
type: boolean
default: false
permissions:
contents: write # needed to upload assets to the matching release
concurrency:
group: release-binaries-${{ github.ref }}
cancel-in-progress: false
jobs:
build:
name: Build (${{ matrix.label }})
runs-on: ${{ matrix.os }}
# Linux job runs inside a Debian 12 (bookworm) container so the binary
# only links against glibc 2.36 and remains runnable on Debian 12,
# Ubuntu 22.10+, RHEL/Rocky 9, and any newer distro. For Windows and
# macOS this evaluates to an empty string, which GitHub interprets as
# "run on the host runner, no container".
container: ${{ matrix.container }}
strategy:
fail-fast: false
matrix:
include:
- label: windows-x86_64
os: windows-latest
python: "3.12"
archive-glob: "installer/dist/db2sql-*-windows-*.zip"
container: ""
- label: linux-x86_64
os: ubuntu-latest
python: "3.12"
archive-glob: "installer/dist/db2sql-*-linux-*.tar.gz"
container: "python:3.12-bookworm"
- label: macos-arm64
os: macos-14 # Apple Silicon runner
python: "3.12"
archive-glob: "installer/dist/db2sql-*-macos-*.tar.gz"
container: ""
steps:
- uses: actions/checkout@v4
# The Debian 12 container already ships with the right Python; only
# call setup-python on bare host runners (Windows / macOS).
- name: Set up Python (host runners only)
if: matrix.container == ''
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python }}
cache: pip
cache-dependency-path: |
pyproject.toml
requirements*.txt
- name: Install OS build prerequisites (Debian 12)
if: matrix.container == 'python:3.12-bookworm'
run: |
apt-get update
apt-get install -y --no-install-recommends \
build-essential ca-certificates git
rm -rf /var/lib/apt/lists/*
- name: Show toolchain info
run: |
python --version
python -c "import platform; print('platform:', platform.platform()); print('machine:', platform.machine())"
- name: Show glibc version (Linux)
if: runner.os == 'Linux'
run: ldd --version | head -1
- name: Install build dependencies
run: |
python -m pip install --upgrade pip wheel
python -m pip install -e ".[all]"
python -m pip install "pyinstaller>=6"
- name: Build standalone binary
run: python installer/build.py --archive
- name: Upload build artifact
uses: actions/upload-artifact@v4
with:
name: db2sql-${{ matrix.label }}
path: ${{ matrix.archive-glob }}
if-no-files-found: error
retention-days: 30
publish:
name: Attach binaries to release
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v') || inputs.attach-to-release == true
steps:
- uses: actions/download-artifact@v8
with:
path: artifacts
merge-multiple: true
- name: List artifacts
run: ls -la artifacts/
- name: Upload to GitHub release
uses: softprops/action-gh-release@v2
with:
files: artifacts/*
fail_on_unmatched_files: true