From bdf03c8b269fd2e20fbf9cf3bc66a92a47b18b23 Mon Sep 17 00:00:00 2001 From: ganeshgore Date: Fri, 29 Jan 2021 11:16:57 -0700 Subject: [PATCH] Bug fix on Docker build and upload on master (#202) * [CI/CD] Added force master image update option * [CI/CD] Fixed .dockerignore while master image building * [Test] checking correctness of source_modified flag * [Bugfix] Fixed openfpga_flow in dockerignore * [CICD] Added more context in dockerignore * [CICD] Updated Dockerfile.master * [CICD] Reverted test variables --- .dockerignore | 19 ++++++++++++++++++- .github/workflows/build.yml | 9 +++++++-- docker/Dockerfile.master | 19 +++++++------------ 3 files changed, 32 insertions(+), 15 deletions(-) diff --git a/.dockerignore b/.dockerignore index 8801107ae..93af49793 100644 --- a/.dockerignore +++ b/.dockerignore @@ -3,4 +3,21 @@ # Allow files and directories !/.github/** -!/*.* \ No newline at end of file +!/*.* +!/abc/abc +!/abc/libabc.a +!/ace2/ace +!/ace2/libace.a +!/openfpga/libopenfpga.a +!/openfpga/openfpga +!/vpr/libvpr.a +!/vpr/vpr +!/yosys/share/ +!/yosys/yosys +!/yosys/yosys-abc +!/yosys/yosys-config +!/yosys/yosys-filterlib +!/yosys/yosys-smtbmc +!/openfpga_flow +!/openfpga.sh +!/openfpga_flow/ diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index cee8938ff..079e286e5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -21,7 +21,8 @@ jobs: runs-on: ubuntu-18.04 outputs: # this is output as string, see https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#jobsjob_idoutputs - source_modified: ${{ steps.changes.outputs.status_code == '0' }} + source_modified: ${{ steps.changes.outputs.status_code == '1' }} + force_upload: false steps: - name: Checkout OpenFPGA repo uses: actions/checkout@v2 @@ -31,6 +32,7 @@ jobs: - name: Check for source code changes id: changes run: | + git diff origin/master HEAD --name-status -- . ':!openfpga_flow' ':!docs' if git diff origin/master HEAD --name-status --exit-code -- . ':!openfpga_flow' ':!docs'; then echo "::set-output name=status_code::0" else @@ -159,7 +161,7 @@ jobs: openfpga.sh docker_distribution: name: Build docker image for distribution - if: ${{ github.ref == 'refs/heads/master' }} + if: ${{ github.ref == 'refs/heads/master' || fromJSON(needs.change_detect.outputs.force_upload) }} runs-on: ubuntu-latest needs: linux_build steps: @@ -169,6 +171,9 @@ jobs: uses: actions/download-artifact@v2 with: name: openfpga + - name: Update dockerignore to add openfpga_flow + run: | + cat .dockerignore - name: Set up QEMU uses: docker/setup-qemu-action@v1 - name: Set up Docker Buildx diff --git a/docker/Dockerfile.master b/docker/Dockerfile.master index 866f8b51b..872ce07a8 100644 --- a/docker/Dockerfile.master +++ b/docker/Dockerfile.master @@ -1,14 +1,9 @@ FROM ghcr.io/lnis-uofu/openfpga-env -RUN mkdir /opt/openfpga /opt/openfpga/openfpga /opt/openfpga/abc /opt/openfpga/ace2 /opt/openfpga/vpr /opt/openfpga/yosys -COPY openfpga/openfpga /opt/openfpga/openfpga/openfpga -COPY abc/abc /opt/openfpga/abc/ -COPY ace2/ace /opt/openfpga/ace2/ -COPY vpr/vpr /opt/openfpga/vpr/ -COPY yosys/yosys yosys/yosys-abc yosys/yosys-config yosys/yosys-filterlib yosys/yosys-smtbmc /opt/openfpga/yosys/ -COPY yosys/share /opt/openfpga/yosys/share -RUN cd /opt/openfpga && chmod +x abc/abc ace2/ace openfpga/openfpga vpr/vpr yosys/yosys yosys/yosys-abc yosys/yosys-config yosys/yosys-filterlib yosys/yosys-smtbmc -COPY openfpga_flow /opt/openfpga/openfpga_flow -COPY openfpga.sh /opt/openfpga/openfpga.sh -ENV PATH="/opt/openfpga/openfpga:/opt/openfpga/yosys:/opt/openfpga/ace2:/opt/openfpga/abc:/opt/openfpga/vpr:${PATH}" -ENV OPENFPGA_PATH="/opt/openfpga" +RUN mkdir -p /opt/openfpga WORKDIR /opt/openfpga +COPY . /opt/openfpga +RUN chmod +x abc/abc ace2/ace openfpga/openfpga vpr/vpr +RUN chmod +x yosys/yosys yosys/yosys-abc yosys/yosys-config yosys/yosys-filterlib yosys/yosys-smtbmc +ENV PATH="/opt/openfpga/openfpga:/opt/openfpga/yosys:${PATH}" +ENV PATH="/opt/openfpga/ace2:/opt/openfpga/abc:/opt/openfpga/vpr:${PATH}" +ENV OPENFPGA_PATH="/opt/openfpga"