Skip to content

Commit 646cc81

Browse files
authored
Add GitHub Binary Release Pipeline for RustPython (RustPython#5456)
1 parent 01f7536 commit 646cc81

File tree

1 file changed

+106
-0
lines changed

1 file changed

+106
-0
lines changed

.github/workflows/release.yml

+106
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
on:
2+
push:
3+
branches: [main]
4+
5+
name: Release
6+
7+
permissions:
8+
contents: write
9+
10+
env:
11+
CARGO_ARGS: --no-default-features --features stdlib,zlib,importlib,encodings,sqlite,ssl
12+
13+
jobs:
14+
build:
15+
runs-on: ${{ matrix.platform.runner }}
16+
strategy:
17+
matrix:
18+
platform:
19+
- runner: ubuntu-latest
20+
target: x86_64-unknown-linux-gnu
21+
# - runner: ubuntu-latest
22+
# target: i686-unknown-linux-gnu
23+
# - runner: ubuntu-latest
24+
# target: aarch64-unknown-linux-gnu
25+
# - runner: ubuntu-latest
26+
# target: armv7-unknown-linux-gnueabi
27+
# - runner: ubuntu-latest
28+
# target: s390x-unknown-linux-gnu
29+
# - runner: ubuntu-latest
30+
# target: powerpc64le-unknown-linux-gnu
31+
- runner: macos-latest
32+
target: aarch64-apple-darwin
33+
# - runner: macos-latest
34+
# target: x86_64-apple-darwin
35+
- runner: windows-latest
36+
target: x86_64-pc-windows-msvc
37+
# - runner: windows-latest
38+
# target: i686-pc-windows-msvc
39+
# - runner: windows-latest
40+
# target: aarch64-pc-windows-msvc
41+
fail-fast: false
42+
steps:
43+
- uses: actions/checkout@v4
44+
- uses: dtolnay/rust-toolchain@stable
45+
46+
- name: Set up Environment
47+
shell: bash
48+
run: rustup target add ${{ matrix.platform.target }}
49+
- name: Set up Windows Environment
50+
shell: bash
51+
run: |
52+
cargo install --target-dir=target -v cargo-vcpkg
53+
cargo vcpkg -v build
54+
if: runner.os == 'Windows'
55+
- name: Set up MacOS Environment
56+
run: brew install autoconf automake libtool
57+
if: runner.os == 'macOS'
58+
59+
- name: Build RustPython
60+
run: cargo build --release --target=${{ matrix.platform.target }} --verbose --features=threading ${{ env.CARGO_ARGS }}
61+
if: runner.os == 'macOS'
62+
- name: Build RustPython
63+
run: cargo build --release --target=${{ matrix.platform.target }} --verbose --features=threading ${{ env.CARGO_ARGS }},jit
64+
if: runner.os != 'macOS'
65+
66+
- name: Rename Binary
67+
run: cp target/${{ matrix.platform.target }}/release/rustpython target/rustpython-release-${{ runner.os }}-${{ matrix.platform.target }}
68+
if: runner.os != 'Windows'
69+
- name: Rename Binary
70+
run: cp target/${{ matrix.platform.target }}/release/rustpython.exe target/rustpython-release-${{ runner.os }}-${{ matrix.platform.target }}.exe
71+
if: runner.os == 'Windows'
72+
73+
- name: Upload Binary Artifacts
74+
uses: actions/upload-artifact@v4
75+
with:
76+
name: rustpython-release-${{ runner.os }}-${{ matrix.platform.target }}
77+
path: target/rustpython-release-${{ runner.os }}-${{ matrix.platform.target }}*
78+
79+
release:
80+
runs-on: ubuntu-latest
81+
needs: build
82+
steps:
83+
- name: Download Binary Artifacts
84+
uses: actions/download-artifact@v4
85+
with:
86+
path: bin
87+
pattern: rustpython-release-*
88+
merge-multiple: true
89+
90+
- name: List Binaries
91+
run: |
92+
ls -lah bin/
93+
file bin/*
94+
- name: Create Release
95+
env:
96+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
97+
tag: ${{ github.ref_name }}
98+
run: ${{ github.run_number }}
99+
run: |
100+
today=$(date '+%Y-%m-%d')
101+
gh release create "$today-$tag-$run" \
102+
--repo="$GITHUB_REPOSITORY" \
103+
--title="RustPython Release $today-$tag #$run" \
104+
--target="$tag" \
105+
--generate-notes \
106+
bin/rustpython-release-*

0 commit comments

Comments
 (0)