From a288b5e37e016c4b1c116484716425aef5b6da2b Mon Sep 17 00:00:00 2001 From: caballa Date: Sat, 16 Sep 2023 14:43:38 -0600 Subject: [PATCH] ci: split into more actions --- .github/workflows/nightly-crab-docker.yaml | 61 +++++++++++++++++++++ .github/workflows/test-crab-dev-docker.yaml | 32 +++++++++++ .github/workflows/test-crab-docker.yml | 28 ++-------- docker/crab.Dockerfile | 10 ++-- docker/crab.apron.Dockerfile | 10 ++-- docker/crab.elina.Dockerfile | 9 ++- docker/crab.pplite.Dockerfile | 10 ++-- 7 files changed, 115 insertions(+), 45 deletions(-) create mode 100644 .github/workflows/nightly-crab-docker.yaml create mode 100644 .github/workflows/test-crab-dev-docker.yaml diff --git a/.github/workflows/nightly-crab-docker.yaml b/.github/workflows/nightly-crab-docker.yaml new file mode 100644 index 00000000..bc35d33e --- /dev/null +++ b/.github/workflows/nightly-crab-docker.yaml @@ -0,0 +1,61 @@ +# Workflow to build and test crab and push images to dockerhub + +name: Nightly + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the master branch + schedule: + - cron: 0 0 * * * # run every day at UTC 00:00 + workflow_dispatch: + branches: master + inputs: + Triggerer: + description: 'Triggered by:' + required: true + default: '' + + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "test" + test: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Check out Repo + uses: actions/checkout@v2 + with: + ref: master + + - name: Build crab without external libraries + run tests + run: docker build --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab:bionic -f docker/crab.Dockerfile . + + #- name: Build crab without external libraries + run tests + # run: docker build --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Coverage -t seahorn/crab:bionic -f docker/crab.Dockerfile . + #- name: Generate coverage report and upload to codecov + # run: docker run -v $(pwd):/host -it seahorn/crab:bionic /bin/sh -c "bash /crab/tests/run_coverage.sh /crab/build /crab && mv /crab/build/all.info /host" && bash <(curl -s https://codecov.io/bash) -Z -f all.info -t ${{ secrets.CODECOV_TOKEN }} + + - name: Build crab+apron+ldd-boxes and run tests + run: docker build --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab_apron_boxes:bionic -f docker/crab.apron.Dockerfile . + + - name: Build crab+elina and run tests + run: docker build --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab_elina:bionic -f docker/crab.elina.Dockerfile . + + #- name: Build crab+pplite and run tests + # run: docker build --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab_pplite:bionic -f docker/crab.pplite.Dockerfile . + + - name: Login to DockerHub Registry + if: ${{ github.event_name == 'schedule' }} # only push if nightly run + run: echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin + + - name: Tag and push crab (nightly) to DockerHub + if: ${{ github.event_name == 'schedule' }} # only push if nightly run + run: | + docker push seahorn/crab:bionic + docker push seahorn/crab_apron_boxes:bionic + docker push seahorn/crab_elina:bionic + #docker push seahorn/crab_pplite:bionic diff --git a/.github/workflows/test-crab-dev-docker.yaml b/.github/workflows/test-crab-dev-docker.yaml new file mode 100644 index 00000000..05f48c6a --- /dev/null +++ b/.github/workflows/test-crab-dev-docker.yaml @@ -0,0 +1,32 @@ +# Workflow to build and test crab dev branch + +name: CI-dev + +# Controls when the action will run. +on: + # Triggers the workflow on push or pull request events but only for the dev branch + push: + branches: dev + pull_request: + branches: dev + +# A workflow run is made up of one or more jobs that can run sequentially or in parallel +jobs: + # This workflow contains a single job called "test" + test: + # The type of runner that the job will run on + runs-on: ubuntu-latest + + # Steps represent a sequence of tasks that will be executed as part of the job + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Check out Repo + uses: actions/checkout@v2 + with: + ref: dev + - name: Build crab without external libraries + run tests + run: docker build --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab:bionic -f docker/crab.Dockerfile . + - name: Build crab+apron+ldd-boxes and run tests + run: docker build --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab_apron_boxes:bionic -f docker/crab.apron.Dockerfile . + - name: Build crab+elina and run tests + run: docker build --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab_elina:bionic -f docker/crab.elina.Dockerfile . diff --git a/.github/workflows/test-crab-docker.yml b/.github/workflows/test-crab-docker.yml index 5ab1e1ee..6962763d 100644 --- a/.github/workflows/test-crab-docker.yml +++ b/.github/workflows/test-crab-docker.yml @@ -1,4 +1,4 @@ -# workflow to build and test crab +# Workflow to build and test crab master branch name: CI @@ -9,8 +9,6 @@ on: branches: master pull_request: branches: master - schedule: - - cron: 0 0 * * * # run every day at UTC 00:00 # A workflow run is made up of one or more jobs that can run sequentially or in parallel jobs: @@ -25,26 +23,10 @@ jobs: - name: Check out Repo uses: actions/checkout@v2 with: - ref: master # only checkout master + ref: master - name: Build crab without external libraries + run tests - run: docker build --build-arg BRANCH=master --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab:bionic -f docker/crab.Dockerfile . - #- name: Build crab without external libraries + run tests - # run: docker build --build-arg BRANCH=master --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Coverage -t seahorn/crab:bionic -f docker/crab.Dockerfile . - #- name: Generate coverage report and upload to codecov - # run: docker run -v $(pwd):/host -it seahorn/crab:bionic /bin/sh -c "bash /crab/tests/run_coverage.sh /crab/build /crab && mv /crab/build/all.info /host" && bash <(curl -s https://codecov.io/bash) -Z -f all.info -t ${{ secrets.CODECOV_TOKEN }} + run: docker build --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab:bionic -f docker/crab.Dockerfile . - name: Build crab+apron+ldd-boxes and run tests - run: docker build --build-arg BRANCH=master --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab_apron_boxes:bionic -f docker/crab.apron.Dockerfile . + run: docker build --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab_apron_boxes:bionic -f docker/crab.apron.Dockerfile . - name: Build crab+elina and run tests - run: docker build --build-arg BRANCH=master --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab_elina:bionic -f docker/crab.elina.Dockerfile . - #- name: Build crab+pplite and run tests - # run: docker build --build-arg BRANCH=master --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab_pplite:bionic -f docker/crab.pplite.Dockerfile . - - name: Login to DockerHub Registry - if: ${{ github.event_name == 'schedule' }} # only push if nightly run - run: echo ${{ secrets.DOCKER_HUB_ACCESS_TOKEN }} | docker login -u ${{ secrets.DOCKER_HUB_USERNAME }} --password-stdin - - name: Tag and push crab (nightly) to DockerHub - if: ${{ github.event_name == 'schedule' }} # only push if nightly run - run: | - docker push seahorn/crab:bionic - docker push seahorn/crab_apron_boxes:bionic - docker push seahorn/crab_elina:bionic - #docker push seahorn/crab_pplite:bionic + run: docker build --build-arg UBUNTU=bionic --build-arg BUILD_TYPE=Release -t seahorn/crab_elina:bionic -f docker/crab.elina.Dockerfile . diff --git a/docker/crab.Dockerfile b/docker/crab.Dockerfile index 9cafad64..d39f445f 100644 --- a/docker/crab.Dockerfile +++ b/docker/crab.Dockerfile @@ -5,7 +5,6 @@ # Arguments: # - UBUNTU: xenial, bionic (default) # - BUILD_TYPE: Debug, Release (default) -# - BRANCH: master (default) # ARG UBUNTU @@ -13,10 +12,11 @@ ARG UBUNTU # Pull base image. FROM seahorn/buildpack-deps-crab:$UBUNTU -ARG BRANCH=master -RUN cd / && rm -rf /crab && \ - git clone -b $BRANCH https://github.com/seahorn/crab crab --depth=10 ; \ - mkdir -p /crab/build +# Assume that docker-build is ran in the top-level Crab directory +COPY . /crab +# Re-create the build directory that might have been present in the source tree +RUN rm -rf /crab/build /crab/debug /crab/release && mkdir /crab/build + WORKDIR /crab/build ARG BUILD_TYPE diff --git a/docker/crab.apron.Dockerfile b/docker/crab.apron.Dockerfile index 17d9cc55..8448f87b 100644 --- a/docker/crab.apron.Dockerfile +++ b/docker/crab.apron.Dockerfile @@ -5,7 +5,6 @@ # Arguments: # - UBUNTU: xenial, bionic (default) # - BUILD_TYPE: Debug, Release (default) -# - BRANCH: master (default) # ARG UBUNTU @@ -13,11 +12,10 @@ ARG UBUNTU # Pull base image. FROM seahorn/buildpack-deps-crab:$UBUNTU -ARG BRANCH=master -RUN cd / && rm -rf /crab && \ - git clone -b $BRANCH https://github.com/seahorn/crab crab --depth=10 ; \ - mkdir -p /crab/build -WORKDIR /crab/build +# Assume that docker-build is ran in the top-level Crab directory +COPY . /crab +# Re-create the build directory that might have been present in the source tree +RUN rm -rf /crab/build /crab/debug /crab/release && mkdir /crab/build ARG BUILD_TYPE # Build configuration. diff --git a/docker/crab.elina.Dockerfile b/docker/crab.elina.Dockerfile index ad34557f..f3c57eeb 100644 --- a/docker/crab.elina.Dockerfile +++ b/docker/crab.elina.Dockerfile @@ -13,11 +13,10 @@ ARG UBUNTU # Pull base image. FROM seahorn/buildpack-deps-crab:$UBUNTU -ARG BRANCH=master -RUN cd / && rm -rf /crab && \ - git clone -b $BRANCH https://github.com/seahorn/crab crab --depth=10 ; \ - mkdir -p /crab/build -WORKDIR /crab/build +# Assume that docker-build is ran in the top-level Crab directory +COPY . /crab +# Re-create the build directory that might have been present in the source tree +RUN rm -rf /crab/build /crab/debug /crab/release && mkdir /crab/build ARG BUILD_TYPE # Build configuration. diff --git a/docker/crab.pplite.Dockerfile b/docker/crab.pplite.Dockerfile index 9de8f637..53d9f8c3 100644 --- a/docker/crab.pplite.Dockerfile +++ b/docker/crab.pplite.Dockerfile @@ -5,7 +5,6 @@ # Arguments: # - UBUNTU: xenial, bionic (default) # - BUILD_TYPE: Debug, Release (default) -# - BRANCH: master (default) # ARG UBUNTU @@ -13,11 +12,10 @@ ARG UBUNTU # Pull base image. FROM seahorn/buildpack-deps-crab:$UBUNTU -ARG BRANCH=master -RUN cd / && rm -rf /crab && \ - git clone -b $BRANCH https://github.com/seahorn/crab crab --depth=10 ; \ - mkdir -p /crab/build -WORKDIR /crab/build +# Assume that docker-build is ran in the top-level Crab directory +COPY . /crab +# Re-create the build directory that might have been present in the source tree +RUN rm -rf /crab/build /crab/debug /crab/release && mkdir /crab/build ARG BUILD_TYPE # Build configuration.