Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Convert release pipeline to github actions #50

Merged
merged 35 commits into from
May 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
affbc2c
Update cibuildwheel config to build py310 wheels
twizmwazin May 15, 2024
1329808
Add arm wheel targets
twizmwazin May 15, 2024
3bf40ad
Convert release pipeline to github actions
twizmwazin May 16, 2024
f89a27a
Fix dry run params
twizmwazin May 16, 2024
05367eb
Add a pull_request trigger to CI the release process
twizmwazin May 16, 2024
09914b1
Configure git globally
twizmwazin May 16, 2024
a398614
Checkout repo in build step
twizmwazin May 16, 2024
0de0725
Add setup python step to verify
twizmwazin May 16, 2024
7d12016
Setup python in build step
twizmwazin May 16, 2024
9cb9b84
Fix trying to setup qemu on non-linux
twizmwazin May 16, 2024
eb3726a
Run shell scripts with bash and error if artifacts are not uploaded
twizmwazin May 16, 2024
d873e56
Call vcvars64 on windows
twizmwazin May 16, 2024
3b0a500
Fix syntax
twizmwazin May 17, 2024
87ea1f0
Fix incorrect comparison
twizmwazin May 17, 2024
11c4b7e
Quote vcvars64.bat call
twizmwazin May 17, 2024
7fb5e37
Add a call
twizmwazin May 17, 2024
77609d0
Redo wheel downloading in verify step
twizmwazin May 17, 2024
4229be7
Remove release artifact
twizmwazin May 17, 2024
f0707c2
Specify CIBW_ARCHS_*
twizmwazin May 17, 2024
fd7c919
Add a find
twizmwazin May 17, 2024
6686a86
Specify to build universal2 wheels on macos
twizmwazin May 17, 2024
f015a4f
Fix ubuntu wheel path
twizmwazin May 17, 2024
2b42b8e
Fix wheel installation on macos
twizmwazin May 17, 2024
6ea30b6
Specify arch on linux too
twizmwazin May 17, 2024
e3f3b53
Do [[ instead of [
twizmwazin May 17, 2024
2a3677f
Add a sed
twizmwazin May 17, 2024
b6bd3a2
Try to fix macos arm64 build
twizmwazin May 21, 2024
4c8dcb6
Ignore capstone wheel
twizmwazin May 21, 2024
bfdee6e
Publish repos artifact
twizmwazin May 21, 2024
283359d
Use https for git clones
twizmwazin May 21, 2024
8eb9f6f
Configure git in release step
twizmwazin May 21, 2024
52d6d2f
Fix wheel copying
twizmwazin May 22, 2024
e1c4e99
Format
twizmwazin May 22, 2024
dac623c
Add debug echo
twizmwazin May 22, 2024
6eeafe2
Invert skip logic
twizmwazin May 22, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
214 changes: 214 additions & 0 deletions .github/workflows/angr-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,214 @@
name: angr Release

on:
pull_request:
paths:
- .github/workflows/angr-release.yml
- release-scripts/*
schedule:
- cron: "0 17 * * 2"
workflow_dispatch:
inputs:
dry_run:
description: "Dry run"
default: true
type: boolean
required: false

defaults:
run:
shell: bash

jobs:
create:
name: Create release
runs-on: ubuntu-22.04
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"
- name: Checkout repos
run: release-scripts/checkout_repos.sh
- name: Create release commits
run: release-scripts/create_release_commits.sh
- name: Create sdists
run: release-scripts/create_sdist.sh
- name: Publish repo artifacts
uses: actions/upload-artifact@v4
with:
name: repos
path: repos
if-no-files-found: error
- name: Publish sdist artifacts
uses: actions/upload-artifact@v4
with:
name: sdist
path: sdist
if-no-files-found: error
- name: Check artifacts are valid for PyPI
run: |
pip install twine
twine check sdist/*

build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-12, macos-14]
needs: create

steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up QEMU
if: startsWith(matrix.os, 'ubuntu')
uses: docker/setup-qemu-action@v3
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"
- name: Download sdists
uses: actions/download-artifact@v4
with:
name: sdist
path: sdist
- name: Build wheels
if: startsWith(matrix.os, 'windows') != true
run: release-scripts/build_wheels.sh sdist
- name: Build wheels
if: startsWith(matrix.os, 'windows')
run: |
call "C:\Program Files\Microsoft Visual Studio\2022\Enterprise\VC\Auxiliary\Build\vcvars64.bat"
bash release-scripts/build_wheels.sh sdist
shell: cmd
- name: Upload wheel artifact
uses: actions/upload-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: wheels
if-no-files-found: error
- name: Check artifacts are valid for PyPI
run: |
pip install twine
twine check sdist/*

verify:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, windows-2022, macos-12, macos-14]
needs: build

steps:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: "3.10"

- name: Download wheels artifact
uses: actions/download-artifact@v4
with:
name: wheels-${{ matrix.os }}
path: wheels

- name: Download ubuntu wheels artifact
if: startsWith(matrix.os, 'windows') || startsWith(matrix.os, 'macos')
uses: actions/download-artifact@v4
with:
name: wheels-ubuntu-22.04
path: wheels-ubuntu

- name: Find
run: find .

- name: Test wheel install
run: |
python -m venv angr_venv
source angr_venv/bin/activate &> /dev/null || source angr_venv/Scripts/activate
export PIP_FIND_LINKS="wheels wheels-ubuntu"
if [[ $(uname) == "Darwin" || $(uname) == "Linux" ]]; then
pip install --no-binary capstone wheels/angr*$(arch | sed s/i386/x86_64/g).whl
else
pip install wheels/angr*.whl
fi

- name: Test angr import
run: |
source angr_venv/bin/activate &> /dev/null || source angr_venv/Scripts/activate
python -c "import angr; print('angr imports!')"

publish:
runs-on: ubuntu-22.04
needs: verify
permissions:
id-token: write

steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Configure git
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "41898282+github-actions[bot]@users.noreply.github.com"

# Git release commits
- name: Download repos artifact
uses: actions/download-artifact@v4
with:
name: repos
path: repos

- name: Publish release commits
run: release-scripts/publish_release_commits.sh
env:
DRY_RUN: ${{ github.event_name == 'schedule' || github.event.inputs.dry_run == false }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}

- name: Bump versions on master
run: release-scripts/bump_versions.sh
env:
DRY_RUN: ${{ github.event_name == 'schedule' || github.event.inputs.dry_run == false }}
GH_TOKEN: ${{ secrets.GH_TOKEN }}

# PyPI artifacts
- name: Create artifacts and dist directories
run: mkdir artifacts dist

- name: Download sdist artifact
uses: actions/download-artifact@v4
with:
name: sdist
path: artifacts/sdist
- name: Download Ubuntu wheels artifact
uses: actions/download-artifact@v4
with:
name: wheels-ubuntu-22.04
path: artifacts/wheels-ubuntu-22.04
- name: Download Windows wheels artifact
uses: actions/download-artifact@v4
with:
name: wheels-windows-2022
path: artifacts/wheels-windows-2022
- name: Download macOS x86_64 wheels artifact
uses: actions/download-artifact@v4
with:
name: wheels-macos-12
path: artifacts/wheels-macos-12
- name: Download macOS arm64 wheels artifact
uses: actions/download-artifact@v4
with:
name: wheels-macos-14
path: artifacts/wheels-macos-14

- name: Collect all packages to upload
run: find artifacts \( -name "*.tar.gz" -o -name "*.whl" \) -exec mv {} dist/ \;

- name: Publish distribution to PyPI
if: (github.event_name == 'schedule' || github.event.inputs.dry_run == false) != true
uses: pypa/gh-action-pypi-publish@release/v1
with:
verbose: true
12 changes: 10 additions & 2 deletions scripts/build_wheels.sh → release-scripts/build_wheels.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ function realpath() {

sdist_path="$(realpath "$1")"

python -m pip install build cibuildwheel==2.11.2
python -m pip install build cibuildwheel==2.18.0
if [ "$(uname)" == "Linux" ]; then
pip install auditwheel
elif [ "$(uname)" == "Darwin" ]; then
Expand All @@ -29,7 +29,15 @@ done

export PIP_FIND_LINKS="$sdist_path"
export CIBW_ENVIRONMENT_LINUX="PIP_FIND_LINKS=/host$PIP_FIND_LINKS"
export CIBW_BUILD="cp38-manylinux_x86_64 cp38-win_amd64 cp38-macosx_x86_64"
export CIBW_BUILD="
cp310-manylinux_x86_64
cp310-manylinux_aarch64
cp310-win_amd64
cp310-macosx_x86_64
cp310-macosx_arm64
"
export CIBW_ARCHS_WINDOWS="AMD64"
export CIBW_ARCHS_LINUX="x86_64 aarch64"
export CIBW_REPAIR_WHEEL_COMMAND=""
for dist in $(ls); do
package=$(cat $dist/PKG-INFO | grep '^Name: [a-zA-Z0-9-]\+$' | head -n 1 | cut -d' ' -f2)
Expand Down
4 changes: 2 additions & 2 deletions scripts/bump_versions.sh → release-scripts/bump_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ pip install packaging

export CHECKOUT_DIR=$(mktemp -d)
for r in $REPOS $REPOS_LINUX_ONLY; do
git clone git@github.com:angr/$r.git $CHECKOUT_DIR/$r --depth=1 --recursive
git clone https://github.com/angr/$r.git $CHECKOUT_DIR/$r --depth=1 --recursive
done

for i in $(ls $CHECKOUT_DIR); do
Expand Down Expand Up @@ -54,7 +54,7 @@ for i in $(ls $CHECKOUT_DIR); do
git push origin bump/$VERSION
gh pr create \
--project angr/$CHECKOUT_DIR \
--assignees "@twizmwazin" \
--assignees "twizmwazin" \
--title "Bump version to $VERSION" \
--body "Release pipeline failed to automatically push commit" \
--head "bump/$VERSION" \
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,5 @@ mkdir -p "repos"
echo "!.git" > repos/.artifactignore

for r in $REPOS $REPOS_LINUX_ONLY; do
git clone git@github.com:angr/$r.git $CHECKOUT_DIR/$r --depth=1 --recursive
git clone https://github.com/angr/$r.git $CHECKOUT_DIR/$r --depth=1 --recursive
done
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -ex

source $(dirname $0)/vars.sh
Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#!/bin/bash
set -ex

source $(dirname $0)/vars.sh
Expand Down
File renamed without changes.
File renamed without changes.
33 changes: 0 additions & 33 deletions resources/jobs/release/build-wheels.yml

This file was deleted.

44 changes: 0 additions & 44 deletions resources/jobs/release/create-release-commits.yml

This file was deleted.

42 changes: 0 additions & 42 deletions resources/jobs/release/publish-pypi.yml

This file was deleted.

Loading