diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index b59cdb386..6426f4bd3 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -18,6 +18,11 @@ env: CCACHE_DIR: ${{ github.workspace }}/.ccache CCACHE_LIMIT_MULTIPLE: 0.95 +defaults: + run: + shell: bash + working-directory: repo + jobs: @@ -27,9 +32,8 @@ jobs: outputs: matrix: ${{ steps.generate.outputs.matrix }} steps: - - uses: actions/checkout@v2 - id: generate - name: Run 'generate_matrix.sh' + working-directory: ${{ github.workspace }} run: | if [ '${{ github.event_name }}' = 'pull_request' ]; then matrix='[ "ubuntu-20.04" ]' @@ -45,27 +49,25 @@ jobs: fail-fast: false matrix: os: ${{ fromJson(needs.Matrix.outputs.matrix) }} - target: - - { name: opt, ccache_size: 48M } - - { name: dbg, ccache_size: 208M } compiler: - { cc: clang, cxx: clang++ } - { cc: gcc, cxx: g++ } runs-on: ${{ matrix.os }} - name: Build | ${{ matrix.os }} | ${{ matrix.compiler.cc }} | ${{ matrix.target.name }} + name: Build | ${{ matrix.os }} | ${{ matrix.compiler.cc }} env: CI_BUILD_STAGE_NAME: build CI_RUNS_ON: ${{ matrix.os }} - CI_MAKE_SRC_TARGET: ${{ matrix.target.name }} CC: ${{ matrix.compiler.cc }} CXX: ${{ matrix.compiler.cxx }} - CACHE_BASE_KEY: build-${{ matrix.os }}-${{ matrix.compiler.cc }}-${{ matrix.target.name }} - CCACHE_MAXSIZE: ${{ matrix.target.ccache_size }} # Per build matrix entry (1G in total) - VERILATOR_ARCHIVE: verilator-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}-${{ matrix.target.name }}.tar.gz + CACHE_BASE_KEY: build-${{ matrix.os }}-${{ matrix.compiler.cc }} + CCACHE_MAXSIZE: 250M # Per build matrix entry (1500M in total) + VERILATOR_ARCHIVE: verilator-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz steps: - name: Checkout uses: actions/checkout@v2 + with: + path: repo - name: Cache $CCACHE_DIR uses: actions/cache@v2 @@ -81,17 +83,17 @@ jobs: run: ./ci/ci-install.bash - name: Build - run: | - ccache -z - ./ci/ci-script.bash - ccache -s - tar cvzf ${{ env.VERILATOR_ARCHIVE }} bin + run: ./ci/ci-script.bash - - name: Upload Verilator artifact + - name: Tar up repository + working-directory: ${{ github.workspace }} + run: tar --posix -c -z -f ${{ env.VERILATOR_ARCHIVE }} repo + + - name: Upload tar archive uses: actions/upload-artifact@v2 with: + path: ${{ github.workspace }}/${{ env.VERILATOR_ARCHIVE }} name: ${{ env.VERILATOR_ARCHIVE }} - path: ${{ env.VERILATOR_ARCHIVE }} Test: @@ -118,11 +120,18 @@ jobs: CXX: ${{ matrix.compiler.cxx }} CACHE_BASE_KEY: test-${{ matrix.os }}-${{ matrix.compiler.cc }}-${{ matrix.suite }} CCACHE_MAXSIZE: 64M # Per build matrix entry (1920M in total) - VERILATOR_ARCHIVE_BASE: verilator-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }} + VERILATOR_ARCHIVE: verilator-${{ github.sha }}-${{ matrix.os }}-${{ matrix.compiler.cc }}.tar.gz steps: - - name: Checkout - uses: actions/checkout@v2 + - name: Download tar archive + uses: actions/download-artifact@v2 + with: + name: ${{ env.VERILATOR_ARCHIVE }} + path: ${{ github.workspace }} + + - name: Unpack tar archive + working-directory: ${{ github.workspace }} + run: tar -x -z -f ${{ env.VERILATOR_ARCHIVE }} - name: Cache $CCACHE_DIR uses: actions/cache@v2 @@ -134,29 +143,10 @@ jobs: restore-keys: | ${{ env.CACHE_KEY }}- - - name: Download Verilator artifact (opt) - uses: actions/download-artifact@v2 - with: - name: ${{ env.VERILATOR_ARCHIVE_BASE }}-opt.tar.gz - - - name: Download Verilator artifact (dbg) - uses: actions/download-artifact@v2 - with: - name: ${{ env.VERILATOR_ARCHIVE_BASE }}-dbg.tar.gz - - - name: Unpack Verilator artifacts - run: | - tar xvzf ${{ env.VERILATOR_ARCHIVE_BASE }}-opt.tar.gz - tar xvzf ${{ env.VERILATOR_ARCHIVE_BASE }}-dbg.tar.gz - - name: Install test dependencies - run: | - ./ci/ci-install.bash + run: ./ci/ci-install.bash - name: Test env: TESTS: ${{ matrix.suite }} - run: | - ccache -z - ./ci/ci-script.bash - ccache -s + run: ./ci/ci-script.bash diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index fdbe90e85..9fc5e94f2 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -14,6 +14,11 @@ env: COVERAGE: 1 VERILATOR_ARCHIVE: verilator-coverage-${{ github.sha }}.tar.gz +defaults: + run: + shell: bash + working-directory: repo + jobs: @@ -26,22 +31,24 @@ jobs: - name: Checkout uses: actions/checkout@v2 + with: + path: repo - name: Install packages for build - env: - CI_BUILD_STAGE_NAME: build run: ./ci/ci-install.bash - name: Build - run: | - ./ci/ci-script.bash - tar cvzf ${{ env.VERILATOR_ARCHIVE }} bin src/obj*/*.o src/obj*/*.gcno + run: ./ci/ci-script.bash - - name: Upload Verilator artifact + - name: Tar up repository + working-directory: ${{ github.workspace }} + run: tar --posix -c -z -f ${{ env.VERILATOR_ARCHIVE }} repo + + - name: Upload tar archive uses: actions/upload-artifact@v2 with: + path: ${{ github.workspace }}/${{ env.VERILATOR_ARCHIVE }} name: ${{ env.VERILATOR_ARCHIVE }} - path: ${{ env.VERILATOR_ARCHIVE }} Test: @@ -72,25 +79,20 @@ jobs: CI_RUNS_ON: ubuntu-20.04 steps: - - name: Checkout - uses: actions/checkout@v2 - - - name: Download Verilator artifact + - name: Download tar archive uses: actions/download-artifact@v2 with: name: ${{ env.VERILATOR_ARCHIVE }} + path: ${{ github.workspace }} - - name: Unapack Verilator artifact - run: | - tar xvzf ${{ env.VERILATOR_ARCHIVE }} - touch src/obj*/*.o src/obj*/*.gcno + - name: Unpack tar archive + working-directory: ${{ github.workspace }} + run: tar -x -z -f ${{ env.VERILATOR_ARCHIVE }} - name: Install test dependencies - run: | - ./ci/ci-install.bash + run: ./ci/ci-install.bash - name: Test env: TESTS: coverage-${{ matrix.test }}${{ matrix.num }} - run: | - ./ci/ci-script.bash + run: ./ci/ci-script.bash diff --git a/Makefile.in b/Makefile.in index d6b9fd70e..07e3731ef 100644 --- a/Makefile.in +++ b/Makefile.in @@ -230,7 +230,7 @@ all_nomsg: verilator_exe $(VL_INST_MAN_FILES) verilator_exe verilator_bin$(EXEEXT) verilator_bin_dbg$(EXEEXT) verilator_coverage_bin_dbg$(EXEEXT): @echo ------------------------------------------------------------ @echo "making verilator in src" - $(MAKE) -C src $(OBJCACHE_JOBS) $(CI_MAKE_SRC_TARGET) + $(MAKE) -C src $(OBJCACHE_JOBS) .PHONY:msg_test msg_test: all_nomsg diff --git a/ci/ci-install.bash b/ci/ci-install.bash index ff0719f4e..6b4e517ff 100755 --- a/ci/ci-install.bash +++ b/ci/ci-install.bash @@ -101,9 +101,6 @@ elif [ "$CI_BUILD_STAGE_NAME" = "test" ]; then fi yes yes | sudo cpan -M $CI_CPAN_REPO -fi Parallel::Forker install-vcddiff - - autoconf - ./configure --enable-longtests --enable-ccwarn else ############################################################################## # Unknown build stage diff --git a/ci/ci-script.bash b/ci/ci-script.bash index 70ded6d2c..6ff282a78 100755 --- a/ci/ci-script.bash +++ b/ci/ci-script.bash @@ -41,7 +41,9 @@ if [ "$CI_BUILD_STAGE_NAME" = "build" ]; then if [ "$COVERAGE" != 1 ]; then autoconf ./configure --enable-longtests --enable-ccwarn + ccache -z "$MAKE" -j "$NPROC" -k + ccache -s if [ "$CI_OS_NAME" = "osx" ]; then file bin/verilator_bin file bin/verilator_bin_dbg @@ -83,6 +85,7 @@ elif [ "$CI_BUILD_STAGE_NAME" = "test" ]; then [ "$CI_RUNS_ON" = 'ubuntu-20.04' ] && sanitize='--sanitize' || sanitize='' # Run the specified test + ccache -z case $TESTS in dist-vlt-0) "$MAKE" -C test_regress SCENARIOS="--dist --vlt $sanitize" DRIVER_HASHSET=--hashset=0/3 @@ -169,6 +172,8 @@ elif [ "$CI_BUILD_STAGE_NAME" = "test" ]; then fatal "Unknown test: $TESTS" ;; esac + ccache -s + # Upload coverage data if [[ $TESTS == coverage-* ]]; then bash <(cat ci/coverage-upload.sh) -f nodist/obj_dir/coverage/app_total.info