Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
47 changes: 6 additions & 41 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,44 +39,6 @@ jobs:
- name: Pull map2check-dev image
run: docker pull ghcr.io/hbgit/map2check-dev:latest

# Build completo (KLEE + LibFuzzer) — mesmo padrão do job e2e-wasm do ci.yml
- name: Build + ninja install (release/) in container
run: |
docker run --rm \
-u root \
-v "${{ github.workspace }}:/workspace" \
-w /workspace \
-e CC=/usr/bin/clang-16 \
-e CXX=/usr/bin/clang++-16 \
ghcr.io/hbgit/map2check-dev:latest bash -c '
# WABT + wasi-sdk (a imagem publicada não os traz)
if [ ! -f /opt/wabt-1.0.41/include/wasm-rt.h ]; then
wget -q "https://github.com/WebAssembly/wabt/releases/download/1.0.41/wabt-1.0.41-linux-x64.tar.gz" -O /tmp/wabt.tar.gz
tar xzf /tmp/wabt.tar.gz -C /opt && rm /tmp/wabt.tar.gz
ln -sf /opt/wabt-1.0.41/bin/wasm2c /usr/local/bin/wasm2c
fi
if [ ! -d /opt/wasi-sdk-33.0-x86_64-linux ]; then
wget -q "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-33/wasi-sdk-33.0-x86_64-linux.tar.gz" -O /tmp/wasi-sdk.tar.gz
tar xzf /tmp/wasi-sdk.tar.gz -C /opt && rm /tmp/wasi-sdk.tar.gz
fi

rm -rf build release
mkdir -p build && cd build
cmake .. -G Ninja \
-DLLVM_DIR=/usr/lib/llvm-16/lib/cmake/llvm \
-DCMAKE_INSTALL_PREFIX=/workspace/release
ninja
ninja install

# KLEE runtime + clang headers ausentes das regras de install
# (cp -rL, não symlink: precisa sobreviver dentro do zip)
mkdir -p /workspace/release/lib/klee
cp -rL /opt/klee/lib/klee/runtime /workspace/release/lib/klee/runtime
[ -e /workspace/release/lib/clang ] || \
cp -rL /usr/lib/llvm-16/lib/clang /workspace/release/lib/clang
'
sudo chown -R "$(id -u):$(id -g)" release

- name: Setup Node.js
uses: actions/setup-node@v4
with:
Expand All @@ -85,9 +47,12 @@ jobs:
- name: Install semantic-release
run: npm install --no-save semantic-release@24 @semantic-release/exec@6

# Lê os commits desde a última tag v*, calcula a versão, chama
# scripts/package-release.sh <versão> (via .releaserc.json), cria a
# tag e publica o Draft Release com o .zip anexado.
# Lê os commits desde a última tag v*, calcula a versão e, se houver
# release a fazer, roda scripts/prepare-release.sh <versão> (fase
# prepare, via .releaserc.json): build Docker completo com a versão
# injetada em -DMAP2CHECK_VERSION + empacotamento do zip. Por fim cria
# a tag e publica o Draft Release com o .zip anexado. Sem release
# necessária (só docs:/ci:/chore:), o build nem executa.
- name: Run semantic-release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .releaserc.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
["@semantic-release/exec", {
"prepareCmd": "bash scripts/package-release.sh ${nextRelease.version}"
"prepareCmd": "bash scripts/prepare-release.sh ${nextRelease.version}"
}],
["@semantic-release/github", {
"draftRelease": true,
Expand Down
14 changes: 14 additions & 0 deletions modules/frontend/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,18 @@
add_subdirectory(utils)
add_subdirectory(counter_example)
add_subdirectory(witness)
# Version string embedded in the binary (--version / help banner).
# The release pipeline overrides it with -DMAP2CHECK_VERSION=<semver>;
# regular builds fall back to the project() version.
if(NOT MAP2CHECK_VERSION)
set(MAP2CHECK_VERSION ${PROJECT_VERSION})
endif()
execute_process(COMMAND date -u +%Y-%m-%d
OUTPUT_VARIABLE MAP2CHECK_BUILD_DATE
OUTPUT_STRIP_TRAILING_WHITESPACE)
configure_file(map2check_version.hpp.in
"${CMAKE_CURRENT_BINARY_DIR}/map2check_version.hpp" @ONLY)

add_library(Caller OBJECT caller.cpp)
add_library(WasmLifter OBJECT wasm_lifter.cpp)
#set_target_properties(Caller PROPERTIES COMPILE_FLAGS ${CXX_FLAGS})
Expand All @@ -18,6 +30,8 @@ add_executable(map2check map2check.cpp
$<TARGET_OBJECTS:Node>
$<TARGET_OBJECTS:Witness>)

target_include_directories(map2check PRIVATE "${CMAKE_CURRENT_BINARY_DIR}")

#set_target_properties(map2check PROPERTIES COMPILE_FLAGS ${CPP_FLAGS})
#-lrt -ldl -ltinfo -lpthread -lz -lm
target_link_libraries(map2check ${Boost_LIBRARIES})
Expand Down
2 changes: 1 addition & 1 deletion modules/frontend/map2check.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@

namespace po = boost::program_options;
namespace fs = std::filesystem;
#define Map2CheckVersion "v8.0.0-Songbirds : Mon Jul 6 01:31:01 Etc 2026"
#include "map2check_version.hpp"

// TODO(hbgit): should get preprocessor flags from CMake

Expand Down
12 changes: 12 additions & 0 deletions modules/frontend/map2check_version.hpp.in
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
/**
* Template processed by CMake configure_file() — do not include this file
* directly; include the generated map2check_version.hpp instead.
* MAP2CHECK_VERSION defaults to the project() version and is overridden by
* the release pipeline with -DMAP2CHECK_VERSION=<semantic version>.
**/
#ifndef MAP2CHECK_VERSION_HPP
#define MAP2CHECK_VERSION_HPP

#define Map2CheckVersion "v@MAP2CHECK_VERSION@-Songbirds:@MAP2CHECK_BUILD_DATE@"

#endif // MAP2CHECK_VERSION_HPP
55 changes: 55 additions & 0 deletions scripts/prepare-release.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
#!/usr/bin/env bash
# Fase "prepare" do semantic-release: builda o Map2Check completo (KLEE 3.1 +
# LibFuzzer) dentro da imagem map2check-dev, injetando a versão calculada no
# binário via -DMAP2CHECK_VERSION, e empacota release/ em .zip.
# Chamado pelo @semantic-release/exec: scripts/prepare-release.sh 8.1.0
set -euo pipefail

VERSION="${1:?usage: prepare-release.sh <version>}"
REPO_ROOT="$(cd "$(dirname "$0")/.." && pwd)"
cd "$REPO_ROOT"

docker run --rm \
-u root \
-v "$REPO_ROOT:/workspace" \
-w /workspace \
-e CC=/usr/bin/clang-16 \
-e CXX=/usr/bin/clang++-16 \
-e MAP2CHECK_VERSION="$VERSION" \
ghcr.io/hbgit/map2check-dev:latest bash -c '
set -euo pipefail

# WABT + wasi-sdk (a imagem publicada não os traz)
if [ ! -f /opt/wabt-1.0.41/include/wasm-rt.h ]; then
wget -q "https://github.com/WebAssembly/wabt/releases/download/1.0.41/wabt-1.0.41-linux-x64.tar.gz" -O /tmp/wabt.tar.gz
tar xzf /tmp/wabt.tar.gz -C /opt && rm /tmp/wabt.tar.gz
ln -sf /opt/wabt-1.0.41/bin/wasm2c /usr/local/bin/wasm2c
fi
if [ ! -d /opt/wasi-sdk-33.0-x86_64-linux ]; then
wget -q "https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-33/wasi-sdk-33.0-x86_64-linux.tar.gz" -O /tmp/wasi-sdk.tar.gz
tar xzf /tmp/wasi-sdk.tar.gz -C /opt && rm /tmp/wasi-sdk.tar.gz
fi

rm -rf build release
mkdir -p build && cd build
cmake .. -G Ninja \
-DLLVM_DIR=/usr/lib/llvm-16/lib/cmake/llvm \
-DCMAKE_INSTALL_PREFIX=/workspace/release \
-DMAP2CHECK_VERSION="${MAP2CHECK_VERSION}"
ninja
ninja install

# KLEE runtime + clang headers ausentes das regras de install
# (cp -rL, não symlink: precisa sobreviver dentro do zip)
mkdir -p /workspace/release/lib/klee
cp -rL /opt/klee/lib/klee/runtime /workspace/release/lib/klee/runtime
[ -e /workspace/release/lib/clang ] || \
cp -rL /usr/lib/llvm-16/lib/clang /workspace/release/lib/clang
'

# O container roda como root; no CI, devolve a posse ao usuário do runner
if [ -n "${CI:-}" ]; then
sudo chown -R "$(id -u):$(id -g)" build release
fi

bash scripts/package-release.sh "$VERSION"
Loading