From 6b32a381deaa1966279883a04ce6e4ceedf5e691 Mon Sep 17 00:00:00 2001 From: aurelf Date: Mon, 22 Apr 2024 01:30:21 +0200 Subject: [PATCH] DockerHub push (#168) * Pushing docker image to DockerHub, only if all tests pass --------- Co-authored-by: AndrewQuijano Co-authored-by: Andrew --- .github/workflows/check_style.yml | 2 +- .../workflows/create_push_docker_image.yml | 40 +++++++++++++++++++ .github/workflows/run_tests.yml | 13 ++++-- README.md | 16 ++++++-- 4 files changed, 63 insertions(+), 8 deletions(-) create mode 100644 .github/workflows/create_push_docker_image.yml diff --git a/.github/workflows/check_style.yml b/.github/workflows/check_style.yml index f3580388..891582be 100644 --- a/.github/workflows/check_style.yml +++ b/.github/workflows/check_style.yml @@ -4,7 +4,7 @@ jobs: coding_style: runs-on: ubuntu-22.04 steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: fetch-depth: 0 - name: Run clang-format diff --git a/.github/workflows/create_push_docker_image.yml b/.github/workflows/create_push_docker_image.yml new file mode 100644 index 00000000..0051557b --- /dev/null +++ b/.github/workflows/create_push_docker_image.yml @@ -0,0 +1,40 @@ +name: Publish SymCC Docker image +# for testing only +#on: [pull_request, workflow_dispatch] +# +# we want to push a docker image when the Compile and test SymCC +# workflow completed successfully +on: + workflow_run: + workflows: [Compile and test SymCC] + branches: master + types: + - completed + +jobs: + upload_dockerhub: + if: github.repository == 'eurecom-s3/symcc' && github.ref == 'refs/heads/master' + # not when testing + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + steps: + - + name: Checkout project sources + uses: actions/checkout@v4 + - + name: Login to Docker Hub + uses: docker/login-action@v3 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + - + name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - + name: Build and push + uses: docker/build-push-action@v5 + with: + context: . + file: ./Dockerfile + push: true + tags: ${{ secrets.DOCKER_USERNAME }}/symcc:latest diff --git a/.github/workflows/run_tests.yml b/.github/workflows/run_tests.yml index aedc742b..0242f1d0 100644 --- a/.github/workflows/run_tests.yml +++ b/.github/workflows/run_tests.yml @@ -1,6 +1,7 @@ name: Compile and test SymCC on: [pull_request, workflow_dispatch] jobs: + # Building and running the tests with Dockerfile build_and_test_symcc: runs-on: ubuntu-20.04 steps: @@ -15,13 +16,15 @@ jobs: run: docker build --target builder_qsym -t symcc . - name: Creation of the final SymCC docker image with Qsym backend and libcxx run: docker build -t symcc . + + # checking compatibility with ubuntu llvm packages llvm_compatibility: runs-on: ubuntu-22.04 strategy: matrix: llvm_version: [11, 12, 13, 14, 15] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Install dependencies @@ -29,7 +32,7 @@ jobs: sudo apt-get update sudo apt-get install -y \ llvm-${{ matrix.llvm_version }}-dev \ - libz3-dev \ + libz3-dev - name: Build SymCC with the QSYM backend run: | mkdir build @@ -41,13 +44,15 @@ jobs: -DLLVM_DIR=/usr/lib/llvm-${{ matrix.llvm_version }}/cmake \ .. make + + # checking compatibility (compilation only) with more recent packages llvm_compatibility_latest_llvm: runs-on: ubuntu-22.04 strategy: matrix: llvm_version: [16, 17, 18] steps: - - uses: actions/checkout@v3 + - uses: actions/checkout@v4 with: submodules: true - name: Add LLVM project deb repository @@ -62,7 +67,7 @@ jobs: sudo apt-get update sudo apt-get install -y \ llvm-${{ matrix.llvm_version }}-dev \ - libz3-dev \ + libz3-dev - name: Build SymCC with the QSYM backend run: | mkdir build diff --git a/README.md b/README.md index 7fd36cd4..4356d0b2 100644 --- a/README.md +++ b/README.md @@ -141,14 +141,16 @@ contains detailed instructions to replicate our experiments, as well as the raw results that we obtained. ### Video demonstration -On YouTube you can find [a practical introduction to SymCC](https://www.youtube.com/watch?v=htDrNBiL7Y8) as well as a video on [how to combine AFL and SymCC](https://www.youtube.com/watch?v=zmC-ptp3W3k) +On YouTube you can find [a practical introduction to +SymCC](https://www.youtube.com/watch?v=htDrNBiL7Y8) as well as a video on [how +to combine AFL and SymCC](https://www.youtube.com/watch?v=zmC-ptp3W3k) ## Building a Docker image If you prefer a Docker container over building SymCC natively, just tell Docker to build the image after pulling the QSYM code as above. (Be warned though: the -Docker image enables optional C++ support from source, so creating -the image can take quite some time!) +Docker image enables optional C++ support from source, so creating the image can +take quite some time!) ``` $ git submodule init @@ -157,6 +159,14 @@ $ docker build -t symcc . $ docker run -it --rm symcc ``` +Alternatively, you can pull an existing image (current master branch) from +Docker Hub: + +``` +$ docker pull eurecoms3/symcc +$ docker run -it --rm symcc +``` + This will build a Docker image and run an ephemeral container to try out SymCC. Inside the container, `symcc` is available as a drop-in replacement for `clang`, using the QSYM backend; similarly, `sym++` can be used instead of `clang++`. Now