mirror of
https://github.com/lifting-bits/remill
synced 2026-06-21 13:56:07 +00:00
CI: Auto-generate releases when pushing tags (#487)
This commit is contained in:
@@ -1,125 +0,0 @@
|
||||
name: CI
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
schedule:
|
||||
# run CI every day even if no PRs/merges occur
|
||||
- cron: '0 6 * * *'
|
||||
jobs:
|
||||
VersionFile:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
version: ${{ steps.bump.outputs.VERSION }}
|
||||
steps:
|
||||
- id: bump
|
||||
name: Bump Version Info For Release
|
||||
run: |
|
||||
curl -H "Authorization: token ${GITHUB_TOKEN}" -s https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/latest | jq -r '[.tag_name][0] | split(".") as $ver | $ver[-1]|tonumber as $last | $ver[:-1] as $first | $first + [$last+1] | map(tostring) | join(".")' > VERSION
|
||||
echo "::set-output name=VERSION::$(<VERSION)"
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
MacOS:
|
||||
runs-on: macos-latest
|
||||
needs: [VersionFile]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions/cache@v1
|
||||
name: Cache LLVM 4 artifacts
|
||||
with:
|
||||
path: ccache_llvm40
|
||||
key: ${{ runner.os }}-llvm4
|
||||
restore-keys: |
|
||||
${{ runner.os }}-llvm4
|
||||
- uses: actions/cache@v1
|
||||
name: Cache LLVM 5 artifacts
|
||||
with:
|
||||
path: ccache_llvm50
|
||||
key: ${{ runner.os }}-llvm5
|
||||
restore-keys: |
|
||||
${{ runner.os }}-llvm5
|
||||
- uses: actions/cache@v1
|
||||
name: Cache LLVM 6 artifacts
|
||||
with:
|
||||
path: ccache_llvm60
|
||||
key: ${{ runner.os }}-llvm6
|
||||
restore-keys: |
|
||||
${{ runner.os }}-llvm6
|
||||
- name: Run Tests
|
||||
run: |
|
||||
echo ${{needs.VersionFile.outputs.version}} > VERSION
|
||||
./scripts/travis.sh macos-latest initialize
|
||||
./scripts/travis.sh macos-latest build
|
||||
Docker_Linux:
|
||||
runs-on: ubuntu-latest
|
||||
needs: [VersionFile]
|
||||
strategy:
|
||||
matrix:
|
||||
llvm: ["900", "1000", "1100"]
|
||||
ubuntu: ["20.04", "18.04"]
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Build LLVM ${{ matrix.llvm }} on ${{ matrix.ubuntu }}
|
||||
run: |
|
||||
echo ${{needs.VersionFile.outputs.version}} > VERSION
|
||||
docker build . -t docker.pkg.github.com/lifting-bits/remill/llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64:latest -f Dockerfile --build-arg UBUNTU_VERSION=${{ matrix.ubuntu }} --build-arg ARCH=amd64 --build-arg LLVM_VERSION=${{ matrix.llvm }}
|
||||
- name: Test Remill with LLVM ${{ matrix.llvm }} on ${{ matrix.ubuntu }}
|
||||
run: |
|
||||
docker run --rm docker.pkg.github.com/lifting-bits/remill/llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64:latest --arch amd64 --ir_out /dev/stdout --bytes c704ba01000000
|
||||
docker run --rm docker.pkg.github.com/lifting-bits/remill/llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64:latest --arch aarch64 --ir_out /dev/stdout --address 0x400544 --bytes FD7BBFA90000009000601891FD030091B7FFFF97E0031F2AFD7BC1A8C0035FD6
|
||||
- name: Push Image for LLVM ${{ matrix.llvm }} on ${{ matrix.ubuntu }}
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
run: |
|
||||
docker login docker.pkg.github.com -u "${GH_USER}" -p "${GH_TOKEN}"
|
||||
for i in 1 2 3; do docker push docker.pkg.github.com/lifting-bits/remill/llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64:latest && break || sleep 10; done
|
||||
docker login -u "${DOCKER_HUB_USER}" -p "${DOCKER_HUB_TOKEN}"
|
||||
docker tag docker.pkg.github.com/lifting-bits/remill/llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64:latest trailofbits/remill:llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64
|
||||
docker push trailofbits/remill:llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64
|
||||
env:
|
||||
GH_USER: ${{ github.actor }}
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
DOCKER_HUB_USER: ${{ secrets.DOCKER_HUB_USER }}
|
||||
DOCKER_HUB_TOKEN: ${{ secrets.DOCKER_HUB_TOKEN }}
|
||||
- name: Compress Artifacts LLVM ${{ matrix.llvm }} on ${{ matrix.ubuntu }}
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
run: |
|
||||
mkdir -p artifacts
|
||||
cp -v scripts/emit-artifact.sh ./artifacts/
|
||||
docker run -v "$(pwd)/artifacts:/out" --rm --entrypoint /bin/bash docker.pkg.github.com/lifting-bits/remill/llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64:latest -c "/out/emit-artifact.sh /out/remill-llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64.tar.xz"
|
||||
ls -l artifacts/
|
||||
- uses: actions/upload-artifact@v1
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
with:
|
||||
name: remill-llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64.tar.xz
|
||||
path: artifacts/remill-llvm${{ matrix.llvm }}-ubuntu${{ matrix.ubuntu }}-amd64.tar.xz
|
||||
windows:
|
||||
needs: [VersionFile]
|
||||
runs-on: windows-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- name: Run Tests
|
||||
continue-on-error: true # for now
|
||||
run: |
|
||||
echo ${{needs.VersionFile.outputs.version}} > VERSION
|
||||
scripts/travis.bat
|
||||
CreateRelease:
|
||||
needs: [macOS, Docker_Linux, VersionFile]
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
uses: actions/download-artifact@v2
|
||||
with:
|
||||
path: releases
|
||||
- name: Verify Artifact Downloads
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
run: ls -R
|
||||
- name: Publish Release
|
||||
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
|
||||
uses: softprops/action-gh-release@v1
|
||||
with:
|
||||
tag_name: ${{ needs.VersionFile.outputs.version }}
|
||||
files: releases/*/*.xz
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
@@ -88,7 +88,7 @@ jobs:
|
||||
fail-fast: false
|
||||
matrix:
|
||||
os: [
|
||||
'macos-11.0'
|
||||
'macos-10.15'
|
||||
]
|
||||
llvm: [
|
||||
'11'
|
||||
@@ -126,5 +126,106 @@ jobs:
|
||||
- name: Store the TGZ package
|
||||
uses: actions/upload-artifact@v1
|
||||
with:
|
||||
name: macos-11.0_llvm${{ matrix.llvm }}_tgz_package
|
||||
path: ${{ steps.package_names.outputs.TGZ_PACKAGE_PATH }}
|
||||
name: ${{ matrix.os }}_llvm${{ matrix.llvm }}_tgz_package
|
||||
path: ${{ steps.package_names.outputs.TGZ_PACKAGE_PATH }}
|
||||
|
||||
|
||||
|
||||
|
||||
release_linux:
|
||||
# Do not run the release procedure if any of the builds has failed
|
||||
needs: [ build_linux, build_mac ]
|
||||
runs-on: ubuntu-20.04
|
||||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
|
||||
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
|
||||
- name: Draft the new release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Version ${{ github.ref }}
|
||||
draft: true
|
||||
prerelease: true
|
||||
|
||||
- name: Group the packages by platform
|
||||
run: |
|
||||
zip -r9 remill_ubuntu-18.04_packages.zip \
|
||||
ubuntu-18.04*
|
||||
|
||||
zip -r9 remill_ubuntu-20.04_packages.zip \
|
||||
ubuntu-20.04*
|
||||
|
||||
- name: Upload the Ubuntu 18.04 packages
|
||||
uses: actions/upload-release-asset@v1
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: remill_ubuntu-18.04_packages.zip
|
||||
asset_name: remill_ubuntu-18.04_packages.zip
|
||||
asset_content_type: application/gzip
|
||||
|
||||
- name: Upload the Ubuntu 20.04 packages
|
||||
uses: actions/upload-release-asset@v1
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: remill_ubuntu-20.04_packages.zip
|
||||
asset_name: remill_ubuntu-20.04_packages.zip
|
||||
asset_content_type: application/gzip
|
||||
|
||||
|
||||
|
||||
|
||||
release_macos:
|
||||
# Do not run the release procedure if any of the builds has failed
|
||||
needs: [ build_linux, build_mac ]
|
||||
runs-on: 'macos-10.15'
|
||||
if: github.event_name == 'push' && startsWith(github.event.ref, 'refs/tags')
|
||||
|
||||
steps:
|
||||
- name: Download all artifacts
|
||||
uses: actions/download-artifact@v2
|
||||
|
||||
- name: Draft the new release
|
||||
id: create_release
|
||||
uses: actions/create-release@v1
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
with:
|
||||
tag_name: ${{ github.ref }}
|
||||
release_name: Version ${{ github.ref }}
|
||||
draft: true
|
||||
prerelease: true
|
||||
|
||||
- name: Group the packages by platform
|
||||
run: |
|
||||
zip -r9 remill_macos-10.15_packages.zip \
|
||||
macos-10.15*
|
||||
|
||||
- name: Upload the macOS 10.15 packages
|
||||
uses: actions/upload-release-asset@v1
|
||||
|
||||
env:
|
||||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
|
||||
with:
|
||||
upload_url: ${{ steps.create_release.outputs.upload_url }}
|
||||
asset_path: remill_macos-10.15_packages.zip
|
||||
asset_name: remill_macos-10.15_packages.zip
|
||||
asset_content_type: application/gzip
|
||||
|
||||
+2
-1
@@ -27,6 +27,7 @@ LLVM_VERSION=llvm-9
|
||||
OS_VERSION=
|
||||
ARCH_VERSION=
|
||||
BUILD_FLAGS=
|
||||
CXX_COMMON_VERSION="v0.1.1"
|
||||
|
||||
# There are pre-build versions of various libraries for specific
|
||||
# Ubuntu releases.
|
||||
@@ -100,7 +101,7 @@ function GetArchVersion
|
||||
function DownloadVcpkgLibraries
|
||||
{
|
||||
local GITHUB_LIBS="${LIBRARY_VERSION}.tar.xz"
|
||||
local URL="https://github.com/trailofbits/cxx-common/releases/latest/download/${GITHUB_LIBS}"
|
||||
local URL="https://github.com/trailofbits/cxx-common/releases/download/${CXX_COMMON_VERSION}/${GITHUB_LIBS}"
|
||||
|
||||
mkdir -p "${DOWNLOAD_DIR}"
|
||||
pushd "${DOWNLOAD_DIR}" || return 1
|
||||
|
||||
Reference in New Issue
Block a user