Skip to content

Commit

Permalink
CI: run-asic-flow/build-yosys-systemverilog: introduce cache action
Browse files Browse the repository at this point in the history
Signed-off-by: Pawel Czarnecki <[email protected]>
  • Loading branch information
lpawelcz committed Jul 5, 2023
1 parent 86824c5 commit 225fe11
Show file tree
Hide file tree
Showing 2 changed files with 49 additions and 20 deletions.
41 changes: 29 additions & 12 deletions .github/workflows/build-yosys-systemverilog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,29 +8,46 @@ jobs:
name: Build yosys-systemverilog
runs-on: ubuntu-latest
env:
TOOL_NAME: yosys-systemverilog
TOOL_NAME: yosys_systemverilog
DEBIAN_FRONTEND: "noninteractive"

steps:
- name: Setup Cache Metadata
id: cache_metadata
run: |
cache_date=$(date +"%Y_%m_%d")
cache_name=cache_${{ env.TOOL_NAME }}
echo "Cache date: "$cache_date
echo "Cache name: "$cache_name
echo "cache_date=$cache_date" >> "$GITHUB_ENV"
echo "cache_name=$cache_name" >> "$GITHUB_ENV"
- name: Setup cache
uses: actions/cache@v3
id: cache
timeout-minutes: 3
with:
path: |
/opt/yosys-systemverilog
key: ${{ env.cache_name }}_${{ env.cache_date }}
restore-keys: ${{ env.cache_name }}

- name: Setup repository
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
uses: actions/checkout@v3

- name: Install prerequisities
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
sudo apt -qqy update && sudo apt -qqy --no-install-recommends install \
gcc-9 g++-9 build-essential cmake tclsh ant default-jre swig google-perftools \
libunwind-dev libgoogle-perftools-dev python3 python3-dev python3-pip python3-six python3-orderedmultidict \
uuid uuid-dev tcl-dev flex libfl-dev git pkg-config libreadline-dev bison libffi-dev wget
- name: Setup repository
uses: actions/checkout@v3

- name: Build yosys-systemverilog
if: ${{ steps.cache.outputs.cache-hit != 'true' }}
run: |
make -j `nproc` synthesis-tools
cd third_party/yosys-systemverilog && mv image yosys-systemverilog && tar -czvf yosys-systemverilog.tar.gz yosys-systemverilog
- name: Store yosys-systemverilog binaries
uses: actions/upload-artifact@v3
with:
name: yosys-systemverilog
path: third_party/yosys-systemverilog/yosys-systemverilog.tar.gz
retention-days: 1
cd third_party/yosys-systemverilog && \
mv image /opt/yosys-systemverilog
28 changes: 20 additions & 8 deletions .github/workflows/run-asic-flow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,15 +18,27 @@ jobs:
git python3 python3-pip build-essential cpanminus
sudo cpanm Bit::Vector
- name: Download yosys-systemverilog binaries
uses: actions/download-artifact@v3
with:
name: yosys-systemverilog
path: /opt

- name: Unpack yosys-systemverilog binaries
- name: Setup Cache Metadata
id: cache_metadata
run: |
cd /opt && tar -zxvf yosys-systemverilog.tar.gz
date=$(date +"%Y_%m_%d")
time=$(date +"%Y%m%d_%H%M%S_%N")
cache_yosys_systemverilog_restore_key=cache_yosys_systemverilog
cache_yosys_systemverilog_key=${cache_yosys_systemverilog_restore_key}
echo "date=$date" | tee -a "$GITHUB_ENV"
echo "time=$time" | tee -a "$GITHUB_ENV"
echo "cache_yosys_systemverilog_restore_key=$cache_yosys_systemverilog_restore_key" | tee -a "$GITHUB_ENV"
echo "cache_yosys_systemverilog_key=$cache_yosys_systemverilog_key" | tee -a "$GITHUB_ENV"
- name: Restore Yosys SystemVerilog cache
id: cache-yosys-systemverilog-restore
uses: actions/cache/restore@v3
with:
path: |
/opt/yosys-systemverilog
key: ${{ env.cache_yosys_systemverilog_key }}
restore-keys: ${{ env.cache_yosys_systemverilog_restore_key }}

- name: Setup repository
uses: actions/checkout@v3
Expand Down

0 comments on commit 225fe11

Please sign in to comment.