diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 92e7f37..6c97b67 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,167 +1,9 @@ name: Release + on: push: - tags: - - 'v[0-9]+.[0-9]+.[0-9]+' -jobs: - release-linux: - runs-on: ubuntu-20.04 - strategy: - fail-fast: false - name: Release (Linux) - steps: - - uses: actions/checkout@v3 - name: Checkout Austin - - - name: Install Python 3.10 - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: Generate artifacts - run: | - python3.10 -m venv .venv - source .venv/bin/activate - pip install --upgrade pip - pip install -r scripts/requirements-bw.txt - - sudo apt-get update - sudo apt-get -y install autoconf build-essential libunwind-dev binutils-dev libiberty-dev musl-tools zlib1g-dev - - # Build austin - autoreconf --install - ./configure - make - - export VERSION=$(cat src/austin.h | sed -r -n "s/^#define VERSION[ ]+\"(.+)\"/\1/p"); - - pushd src - tar -Jcf austin-$VERSION-gnu-linux-amd64.tar.xz austin - tar -Jcf austinp-$VERSION-gnu-linux-amd64.tar.xz austinp - popd - - # Build gnu wheel - python scripts/build-wheel.py \ - --version=$VERSION \ - --platform=manylinux_2_12_x86_64.manylinux2010_x86_64 \ - --files austin:src/austin austinp:src/austinp - - # Build with musl - musl-gcc -O3 -Os -s -Wall -pthread src/*.c -o src/austin -D__MUSL__ - pushd src - tar -Jcf austin-$VERSION-musl-linux-amd64.tar.xz austin - popd - - # Build musl wheel - python scripts/build-wheel.py \ - --version=$VERSION \ - --platform=musllinux_1_1_x86_64 \ - --files austin:src/austin - - deactivate - - - name: Upload artifacts to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: src/austin*.tar.xz - tag: ${{ github.ref }} - overwrite: true - file_glob: true - - - name: Upload Python wheels to PyPI - run: | - source .venv/bin/activate - twine upload dist/*.whl --username __token__ --password ${{ secrets.PYPI_TOKEN }} - deactivate - - release-win: - runs-on: windows-latest - strategy: - fail-fast: false - name: Release (Windows) - steps: - - uses: actions/checkout@v3 - name: Checkout Austin - with: - fetch-depth: 0 - - - name: Generate artifacts - shell: bash - run: | - echo "C:\Program Files (x86)\WiX Toolset v3.11\bin" >> $GITHUB_PATH - export PATH="/c/Program Files (x86)/`ls /c/Program\ Files\ \(x86\) | grep \"[wW]i[xX] [tT]oolset\"`/bin:$PATH" - export VERSION=$(cat src/austin.h | sed -r -n "s/^#define VERSION[ ]+\"(.+)\"/\1/p") - - gcc -static -s -Wall -O3 -Os -o src/austin src/*.c -lpsapi -lntdll - - git checkout "packaging/msi" - git checkout master - git checkout "packaging/msi" -- wix - - export WIN_MSI="austin-$VERSION-win64.msi" - - sed -i "s/%VERSION%/$VERSION/g" wix/Austin.wxs - pushd wix - candle Austin.wxs -out Austin.wixobj - light -ext WixUIExtension Austin.wixobj -out $WIN_MSI - popd - - mv wix/$WIN_MSI src/$WIN_MSI; - test -f src/$WIN_MSI && echo ">> Windows MSI installer at src/$WIN_MSI" || echo ">> ERROR No Windows MSI installer generated." - - pushd src - 7z a -tzip austin-${VERSION}-win64.zip austin.exe - popd - - - name: Upload to choco - shell: bash - run: | - export VERSION=$(cat src/austin.h | sed -r -n "s/^#define VERSION[ ]+\"(.+)\"/\1/p") - export WIN_MSI="austin-$VERSION-win64.msi" - export WIN_MSI_HASH=$( sha256sum src/$WIN_MSI | head -c 64 ) - git checkout "packaging/msi" -- choco - - pushd choco - sed -i "s/%WIN_MSI_HASH%/$WIN_MSI_HASH/g" tools/chocolateyinstall.ps1 - /bin/find . -type f -exec sed -i "s/%VERSION%/$VERSION/g" {} \; ; - choco apikey --key ${{ secrets.CHOCO_APIKEY }} --source https://push.chocolatey.org/ - choco pack - choco push --source https://push.chocolatey.org/ - popd - - - name: Upload artifacts to release - uses: svenstaro/upload-release-action@v2 - with: - repo_token: ${{ secrets.GITHUB_TOKEN }} - file: src/austin-* - tag: ${{ github.ref }} - overwrite: true - file_glob: true - - - name: Install Python 3.10 - uses: actions/setup-python@v4 - with: - python-version: "3.10" - - - name: Build Python wheels - shell: bash - run: | - py -3.10 -m pip install --upgrade pip - py -3.10 -m pip install -r scripts/requirements-bw.txt - - export VERSION=$(cat src/austin.h | sed -r -n "s/^#define VERSION[ ]+\"(.+)\"/\1/p") - - py -3.10 scripts/build-wheel.py \ - --version=$VERSION \ - --platform=win_amd64 \ - --files austin.exe:src/austin.exe - - - name: Upload Python wheels to PyPI - shell: bash - run: | - py -3.10 -m twine upload dist/*.whl --username __token__ --password ${{ secrets.PYPI_TOKEN }} +jobs: release-osx: runs-on: macos-latest strategy: @@ -186,7 +28,7 @@ jobs: export VERSION=$(cat src/austin.h | sed -n -E "s/^#define VERSION[ ]+\"(.+)\"/\1/p") echo "::set-output name=version::$VERSION" - gcc-12 -Wall -O3 -Os -o src/austin src/*.c + clang -Wall -O3 -Os -o src/austin src/*.c -target x86_64-apple-macos11 pushd src zip -r austin-${VERSION}-mac64.zip austin @@ -195,21 +37,10 @@ jobs: # Build intel wheel python scripts/build-wheel.py \ --version=$VERSION \ + --build=1 \ --platform=macosx_11_0_x86_64 \ --files austin:src/austin - clang -Wall -O3 -Os -o src/austin src/*.c -target arm64-apple-macos11 - - pushd src - zip -r austin-${VERSION}-mac-arm64.zip austin - popd - - # Build arm wheel - python scripts/build-wheel.py \ - --version=$VERSION \ - --platform=macosx_11_0_arm64 \ - --files austin:src/austin - deactivate - name: Upload artifacts to release @@ -217,7 +48,7 @@ jobs: with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: src/austin-* - tag: ${{ github.ref }} + tag: "v.3.7.0" overwrite: true file_glob: true diff --git a/scripts/build-wheel.py b/scripts/build-wheel.py index 788e3d7..12fa46d 100644 --- a/scripts/build-wheel.py +++ b/scripts/build-wheel.py @@ -80,11 +80,12 @@ def make_message(headers, payload=None): return message.getvalue().encode("utf-8") -def write_austin_wheel(out_dir, *, version, platform, austin_bin_data): +def write_austin_wheel(out_dir, *, version, build, platform, austin_bin_data): + build_version = f"-{build}" if build else "" package_name = "austin-dist" python = ".".join(("py2", "py3")) dist_name = package_name.replace("-", "_") - wheel_name = f"{dist_name}-{version}-{python}-none-{platform}.whl" + wheel_name = f"{dist_name}-{version}{build_version}-{python}-none-{platform}.whl" dist_info = f"{dist_name}-{version}.dist-info" wheel_path = out_dir / wheel_name @@ -167,6 +168,12 @@ def download_release( default=None, ) + argp.add_argument( + "--build", + help="Austin wheel build version", + default=None, + ) + argp.add_argument( "--platform", help="Platform to build wheels for", @@ -208,6 +215,7 @@ def download_release( write_austin_wheel( dist_dir, version=version, + build=args.build, platform=platform, austin_bin_data=bin_data, )