-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (74 loc) · 2.73 KB
/
python-publish.yml
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
name: Build and Publish Python Wheel
# Trigger on every push to any branch
on:
push:
branches:
- '**' # Triggers on every branch push
jobs:
build:
runs-on: ubuntu-latest
steps:
# Step 1: Checkout the code
- name: Checkout the code
uses: actions/checkout@v3
# Step 2: Set up Python 3.12
- name: Set up Python 3.12
uses: actions/setup-python@v4
with:
python-version: '3.12'
# Step 3: Install GCC 9
- name: Install GCC 9
run: |
sudo apt-get update
sudo apt-get install -y g++-9 gcc-9
sudo update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-9 50
sudo update-alternatives --install /usr/bin/g++ g++ /usr/bin/g++-9 50
# Step 4: Install pybind11 and build dependencies
- name: Install build dependencies
run: |
python -m pip install --upgrade pip
pip install setuptools wheel pybind11
# Step 5: Build the wheel
- name: Build the wheel
run: |
if [ ! -d "past-0.7.2" ]; then
wget https://master.dl.sourceforge.net/project/pocc/1.6/testing/modules/past-0.7.2.tar.gz
tar -xvf past-0.7.2.tar.gz
cp setup.py ./past-0.7.2/
cp bindings.cpp ./past-0.7.2/src/
cp Makefile.am ./past-0.7.2/src/
sed -i 's/\<restrict\>/__restrict__/g' ./past-0.7.2/past/include/past/abstract_interpretation_memory.h
fi
cd past-0.7.2
python setup.py bdist_wheel
mv dist ../
# Step 6: Upload the wheel as an artifact
- name: Upload the wheel
uses: actions/upload-artifact@v3
with:
name: dist
path: dist/
release:
# if: github.ref_type == 'tag' # Only trigger release if the commit is tagged
needs: build
runs-on: ubuntu-latest
steps:
# Step 7: Download artifact
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: dist
path: dist/ # This will ensure the artifact is downloaded to the dist/ folder
# Step 8: Get short commit SHA (first 7 characters)
- name: Get short commit SHA
run: echo "COMMIT_HASH=$(echo ${GITHUB_SHA} | cut -c1-7)" >> $GITHUB_ENV
# Step 9: Publish release
- name: Publish release
uses: ncipollo/release-action@v1
with:
artifacts: 'dist/*'
token: ${{ secrets.GITHUB_TOKEN }} # Automatically available GitHub token
tag: ${{ env.COMMIT_HASH }} # Use the shortened commit hash
name: Release ${{ github.event.head_commit.message }} # Optional: Use commit message as the release name
draft: false
prerelease: false