Skip to content

Commit

Permalink
windows pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
xansec committed Aug 21, 2024
1 parent 93ba2f7 commit 2edf286
Show file tree
Hide file tree
Showing 4 changed files with 23 additions and 98 deletions.
22 changes: 12 additions & 10 deletions .github/workflows/bazel.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,12 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest]
os: [windows-latest]
shared: [false]
build_type: [Release]
include:
- os: ubuntu-latest
triplet: x64-linux
- os: windows-latest
triplet: x64-windows

steps:
- uses: actions/checkout@v4
Expand All @@ -54,23 +54,25 @@ jobs:

- name: Get dependencies
run: |
sudo apt-get update && sudo apt-get install -yq \
curl
choco install curl -y
- name: Download and Install Clang
run: |
./scripts/install_llvm.bat
- name: Download Mayhem
- name: Download and Install Mayhem
run: |
echo "MAYHEM_URL: ${{ env.MAYHEM_URL }}"
pushd /tmp
curl --fail -L ${{ env.MAYHEM_URL }}/cli/Linux/install.sh | sh
$installerPath = "$env:TEMP\mayhem.msi"
Invoke-WebRequest -Uri "https://app.mayhem.security/cli/Windows/mayhem.msi" -OutFile $installerPath
Start-Process msiexec.exe -ArgumentList "/i", $installerPath, "/quiet", "/norestart" -NoNewWindow -Wait
mayhem login --url ${{ env.MAYHEM_URL }} --token ${{ secrets.MAYHEM_TOKEN }}
popd
env:
MAYHEM_URL: ${{ env.MAYHEM_URL }}
MAYHEM_TOKEN: ${{ secrets.MAYHEM_TOKEN }}

- name: Run Bazel commands
run: |
bazel run --define=MAYHEM_URL=${{ env.MAYHEM_URL }} //mayhem:push_fuzz_calculator_image
bazel build --define=MAYHEM_URL=${{ env.MAYHEM_URL }} //mayhem:mayhem_fuzz_calculator
46 changes: 9 additions & 37 deletions mayhem/BUILD
Original file line number Diff line number Diff line change
@@ -1,49 +1,21 @@
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_oci//oci:defs.bzl", "oci_image", "oci_push", "oci_tarball")

load("@rules_mayhem//mayhem:mayhem.bzl", "mayhem")

pkg_tar(
name = "fuzz_calculator_tar",
genrule(
name = "mayhem_package",
srcs = ["//fuzz:fuzz_calculator_bin"],
mode = "0755",
testonly = True,
)

oci_image(
name = "fuzz_calculator_image",
base = "@ubuntu",
entrypoint = ["/fuzz_calculator_bin"],
tars = [":fuzz_calculator_tar"],
testonly = True,
user = "root",
workdir = "/",
outs = ["fuzz_calculator_root"],
cmd = "mayhem package -o ./fuzz_calculator_root $(location: //fuzz:fuzz_calculator_bin)"
)

oci_tarball(
name = "fuzz_calculator_tarball",
image = ":fuzz_calculator_image",
repo_tags = ["mayhem-bazel-example:latest"],
testonly = True,
)

oci_push(
name = "push_fuzz_calculator_image",
image = ":fuzz_calculator_image",
remote_tags = ["latest"],
#repository = "$(MAYHEM_URL):5000/mayhem-bazel-example",
repository = "ghcr.io/forallsecure/mayhem-bazel-example",
testonly = True,
)

mayhem(
name = "mayhem_fuzz_calculator",
run = True,
project = "mayhem-bazel-example",
target = "fuzz_calculator",
command = "/fuzz_calculator_bin @@",
target = "fuzz_calculator_win",
command = "$(location: //fuzz:fuzz_calculator_bin) @@",
duration = "90",
sanitizer = "true",
libfuzzer = "false",
#image = "$MAYHEM_DOCKER_REGISTRY/mayhem-bazel-example:latest",
image = "ghcr.io/forallsecure/mayhem-bazel-example:latest",
sanitizer = "false",
libfuzzer = "true",
)
42 changes: 0 additions & 42 deletions mayhem/Dockerfile

This file was deleted.

11 changes: 2 additions & 9 deletions mayhem/Mayhemfile
Original file line number Diff line number Diff line change
@@ -1,20 +1,13 @@
project: mayhem-bazel-example

# Target name (should be unique within the project)
target: fuzz-calculator

# Base image to run the binary in.
image: ghcr.io/<YOUR_ORG>/mayhem-bazel-example
target: fuzz-calculator-win

# Turns on extra test case processing (completing a run will take longer)
advanced_triage: false

# List of commands used to test the target
cmds:
- cmd: /fuzz_calculator_libfuzzer
- cmd: /fuzz_calculator_libfuzzer.exe
libfuzzer: true
sanitizer: true
- cmd: /fuzz_calculator_uninstrumented @@
libfuzzer: false
sanitizer: false

0 comments on commit 2edf286

Please sign in to comment.