Merge pull request #203 from GaloisInc/vr/improve-test_reopt_with_rel… #1096
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# This is set up to build both reopt, reopt-vcg, and the VSCode extension, as | |
# well as upload artifacts to relevant locations. However, currently we are | |
# only supporting reopt, so the other tasks are temporarily commented out to | |
# ease development. | |
name: CI | |
on: [push] | |
jobs: | |
# This task builds the Docker "reopt-dev" image used to build reopt. | |
dev-img: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Export DEV_HASH | |
run: echo "DEV_HASH=`shasum containers/dev/Dockerfile | cut -d' ' -f1`" >> $GITHUB_ENV | |
- name: Cache Developer environment | |
id: cache | |
uses: actions/cache@v3 | |
with: | |
path: cache | |
key: reopt-dev-${{ env.DEV_HASH }} | |
- name: Build | |
run: docker build -t galoisbinaryanalysis/reopt-dev containers/dev | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Push to Docker hub | |
run: | | |
echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u galoisbinaryanalysisbot --password-stdin | |
docker push galoisbinaryanalysis/reopt-dev | |
if: steps.cache.outputs.cache-hit != 'true' | |
- name: Create dummy directory for cache | |
run: mkdir -p cache | |
if: steps.cache.outputs.cache-hit != 'true' | |
# This task builds reopt on the reopt-dev container and | |
# generates the reopt artifact with the binary. | |
build: | |
needs: [dev-img] | |
runs-on: ubuntu-20.04 | |
container: galoisbinaryanalysis/reopt-dev | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
with: | |
submodules: true | |
- name: Set env.home and env.ghc | |
run: | | |
echo "home=$HOME" >> $GITHUB_ENV | |
echo "ghc=`ghc --numeric-version`" >> $GITHUB_ENV | |
- name: Restore cabal cache and dist-newstyle | |
uses: actions/cache/restore@v3 | |
id: haskell-cache | |
with: | |
path: | | |
${{ env.home }}/.local/state/cabal/store/ghc-${{ env.ghc }} | |
dist-newstyle | |
# Per-commit cache | |
key: haskell-cache-${{ env.ghc }}-${{ github.ref }}-${{ github.sha }} | |
# Per-branch and per-commit caches | |
restore-keys: | | |
haskell-cache-${{ env.ghc }}-${{ github.ref }} | |
haskell-cache-${{ env.ghc }} | |
- name: Cabal freeze and enable werror. | |
run: | | |
ln -s cabal.project.freeze.ghc.${{ env.ghc }} cabal.project.freeze | |
ln -s cabal.project.werror cabal.project.local | |
- name: Cabal update | |
run: cabal update | |
- name: Install | |
run: cabal install -j exe:reopt | |
- name: Unit Tests | |
run: cabal test -j reopt-tests | |
- name: CentOS7 reopt executable tests | |
run: | | |
./scripts/test_reopt.sh | |
./scripts/test_reopt.sh getopt | |
- name: CentOS7 reopt-explore executable tests | |
run: | | |
./scripts/test_reopt_explore.sh small | |
# ./scripts/test_reopt_explore.sh all-debug-info | |
# Disabled temporarily so we can update reopt | |
#- name: CentOS7 reopt-explore executable tests (long) | |
# run: ./scripts/test_reopt_explore.sh all | |
- name: reopt-explore CentOS7 Summary Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: centos7-bin-summary.txt | |
path: deps/reopt-benchmark-binaries/centos7-dev/centos7-bin-summary.txt | |
- name: Create archive | |
run: | | |
mkdir -p dist/reopt/bin | |
cp $HOME/.local/bin/reopt dist/reopt/bin | |
cp $HOME/.local/bin/reopt-explore dist/reopt/bin | |
cp $HOME/.local/bin/reopt-relink dist/reopt/bin | |
cd dist | |
tar cvfz reopt.tgz reopt | |
- name: Make reopt | |
uses: actions/upload-artifact@v4 | |
with: | |
name: reopt | |
path: dist/reopt.tgz | |
- name: Unconditionally save cabal store | |
uses: actions/cache/save@v3 | |
# c.f. https://github.com/actions/cache/issues/1154 | |
if: always() && !steps.haskell-cache.outputs.cache-hit | |
with: | |
path: | | |
${{ env.home }}/.local/state/cabal/store/ghc-${{ env.ghc }} | |
dist-newstyle | |
key: haskell-cache-${{ env.ghc }}-${{ github.ref }}-${{ github.sha }} | |
# # This builds the VSCode extension | |
# vscode-extension: | |
# runs-on: ubuntu-20.04 | |
# steps: | |
# - uses: actions/checkout@v3 | |
# - name: Install npm | |
# run: | | |
# sudo apt-get update | |
# sudo apt-get install --no-install-recommends -y npm | |
# - name: Install vsce | |
# run: sudo npm install -g --no-optional vsce | |
# - name: Install dependencies | |
# working-directory: vscode-plugin | |
# run: npm install | |
# - name: Package extension | |
# working-directory: vscode-plugin | |
# run: | | |
# vsce package | |
# mv reopt-0.0.1.vsix reopt.vsix | |
# - name: Upload extension artifact | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: vscode-extension | |
# path: vscode-plugin/reopt.vsix | |
# reopt-vcg: | |
# runs-on: ubuntu-20.04 | |
# steps: | |
# - name: Get reopt | |
# uses: actions/checkout@v3 | |
# - name: Dependencies | |
# run: sudo apt-get install -y --no-install-recommends llvm-8 llvm-8-dev clang-8 | |
# - name: Clone reopt-vcg | |
# run: | | |
# sed -i -e 's|git@github.com:|https://github.com/|' .gitmodules | |
# git submodule update --init --depth 1 deps/reopt-vcg | |
# cd deps/reopt-vcg | |
# sed -i -e 's|git@github.com:|https://github.com/|' .gitmodules | |
# git submodule update --init --depth 1 | |
# - name: Build | |
# working-directory: deps/reopt-vcg | |
# run: ./build.sh | |
# - name: Test | |
# working-directory: deps/reopt-vcg | |
# run: .github/ci.sh run-tests | |
# - name: Create archive | |
# run: | | |
# mkdir -p dist/reopt-vcg/bin | |
# cp deps/reopt-vcg/build/bin/reopt-vcg dist/reopt-vcg/bin/reopt-vcg | |
# cp deps/reopt-vcg/deps/cvc4-2020-09-16-x86_64-linux-opt dist/reopt-vcg/bin/cvc4 | |
# cd dist | |
# tar cvfz reopt-vcg.tgz reopt-vcg | |
# - name: Make reopt-vcg | |
# uses: actions/upload-artifact@v4 | |
# with: | |
# name: reopt-vcg | |
# path: dist/reopt-vcg.tgz | |
# integration-tests: | |
# needs: [build, reopt-vcg] | |
# runs-on: ubuntu-20.04 | |
# steps: | |
# - name: Install dependencies | |
# run: sudo apt-get update && sudo apt-get install -y gdb llvm-8 | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# - name: Download reopt artifact | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: reopt | |
# path: dist | |
# - name: Download reopt-vcg artifact | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: reopt-vcg | |
# path: dist | |
# - name: Unpack and add executables to PATH | |
# run: | | |
# tar xvfz reopt.tgz | |
# tar xvfz reopt-vcg.tgz | |
# echo "$PWD/reopt/bin" >> $GITHUB_PATH | |
# echo "$PWD/reopt-vcg/bin" >> $GITHUB_PATH | |
# working-directory: dist | |
# - name: Test nweb | |
# run: ./integration_test.sh | |
# working-directory: vcg-test-programs/nweb | |
# upload: | |
# needs: [build, vscode-extension, reopt-vcg] | |
# runs-on: ubuntu-20.04 | |
# steps: | |
# - name: Checkout | |
# uses: actions/checkout@v3 | |
# with: | |
# submodules: true | |
# - name: Download reopt artifact | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: reopt | |
# path: dist | |
# - name: Download reopt-vcg artifact | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: reopt-vcg | |
# path: dist | |
# - name: Copy files | |
# run: | | |
# cd containers/eval | |
# tar xvfz ../../dist/reopt.tgz | |
# tar xvfz ../../dist/reopt-vcg.tgz | |
# - name: Download extension artifact | |
# uses: actions/download-artifact@v2 | |
# with: | |
# name: vscode-extension | |
# path: containers/eval | |
# - name: Build docker image | |
# run: | | |
# docker build -t galoisbinaryanalysis/reopt:head -t galoisbinaryanalysis/reopt:latest containers/eval | |
# - name: Push to Docker hub | |
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
# run: | | |
# echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u galoisbinaryanalysisbot --password-stdin | |
# docker push galoisbinaryanalysis/reopt --all-tags | |
# - name: Build docker image with examples | |
# run: | | |
# docker build -t galoisbinaryanalysis/reopt:latest-with-examples -f containers/eval-with-examples/Dockerfile . | |
# - name: Push to Docker hub | |
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
# run: | | |
# echo '${{ secrets.DOCKER_PASSWORD }}' | docker login -u galoisbinaryanalysisbot --password-stdin | |
# docker push galoisbinaryanalysis/reopt:latest-with-examples |