diff --git a/.github/actions/setup-build-env/action.yml b/.github/actions/setup-build-env/action.yml new file mode 100644 index 000000000..e1b550e5c --- /dev/null +++ b/.github/actions/setup-build-env/action.yml @@ -0,0 +1,32 @@ +name: Build environment setup +description: Configure build env for Yosys builds +runs: + using: composite + steps: + - name: Install Linux Dependencies + if: runner.os == 'Linux' + shell: bash + run: | + sudo apt-get update + sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev + + - name: Install macOS Dependencies + if: runner.os == 'macOS' + run: | + brew install bison flex gawk libffi pkg-config bash + + - name: Linux runtime environment + if: runner.os == 'Linux' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "procs=$(nproc)" >> $GITHUB_ENV + + - name: macOS runtime environment + if: runner.os == 'macOS' + shell: bash + run: | + echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH + echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH + echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH + echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV \ No newline at end of file diff --git a/.github/workflows/test-build.yml b/.github/workflows/test-build.yml index 8ad44f0b5..373228831 100644 --- a/.github/workflows/test-build.yml +++ b/.github/workflows/test-build.yml @@ -35,33 +35,8 @@ jobs: os: [ubuntu-20.04, macos-13] fail-fast: false steps: - - name: Install Linux Dependencies - if: runner.os == 'Linux' - shell: bash - run: | - sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - - - name: Install macOS Dependencies - if: runner.os == 'macOS' - run: | - brew install bison flex gawk libffi pkg-config bash - - - name: Linux runtime environment - if: runner.os == 'Linux' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "procs=$(nproc)" >> $GITHUB_ENV - - - name: macOS runtime environment - if: runner.os == 'macOS' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + - name: Setup environment + uses: ./.github/actions/setup-build-env - name: Checkout Yosys uses: actions/checkout@v4 @@ -105,33 +80,8 @@ jobs: matrix: os: [ubuntu-20.04, macos-13] steps: - - name: Install Linux Dependencies - if: runner.os == 'Linux' - shell: bash - run: | - sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - - - name: Install macOS Dependencies - if: runner.os == 'macOS' - run: | - brew install bison flex gawk libffi pkg-config bash - - - name: Linux runtime environment - if: runner.os == 'Linux' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "procs=$(nproc)" >> $GITHUB_ENV - - - name: macOS runtime environment - if: runner.os == 'macOS' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV + - name: Setup environment + uses: ./.github/actions/setup-build-env - name: Checkout Yosys uses: actions/checkout@v4 diff --git a/.github/workflows/test-compile.yml b/.github/workflows/test-compile.yml index 9c25874bb..6a0b69c8b 100644 --- a/.github/workflows/test-compile.yml +++ b/.github/workflows/test-compile.yml @@ -60,39 +60,14 @@ jobs: cpp_std: 'c++11' fail-fast: false steps: - - name: Install Linux Dependencies - if: runner.os == 'Linux' - shell: bash - run: | - sudo apt-get update - sudo apt-get install gperf build-essential bison flex libreadline-dev gawk tcl-dev libffi-dev git graphviz xdot pkg-config python python3 libboost-system-dev libboost-python-dev libboost-filesystem-dev zlib1g-dev - - - name: Install macOS Dependencies - if: runner.os == 'macOS' - run: | - brew install bison flex gawk libffi pkg-config bash + - name: Setup environment + uses: ./.github/actions/setup-build-env - name: Setup Cpp uses: aminya/setup-cpp@v1 with: compiler: ${{ matrix.compiler }} - - name: Linux runtime environment - if: runner.os == 'Linux' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "procs=$(nproc)" >> $GITHUB_ENV - - - name: macOS runtime environment - if: runner.os == 'macOS' - shell: bash - run: | - echo "${{ github.workspace }}/.local/bin" >> $GITHUB_PATH - echo "$(brew --prefix bison)/bin" >> $GITHUB_PATH - echo "$(brew --prefix flex)/bin" >> $GITHUB_PATH - echo "procs=$(sysctl -n hw.ncpu)" >> $GITHUB_ENV - - name: Tool versions shell: bash run: |