forked from myhdl/myhdl
-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (58 loc) · 1.92 KB
/
setup_ghdl.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Setup GHDL
on:
workflow_call:
inputs:
githash:
description: "Allow a githash/tag/branch to be passed as an input"
required: false
type: string
outputs:
cache_dir:
description: "The Cache Directory"
value: ${{ jobs.build.outputs.output0 }}
cache_key:
description: "The Cache Key"
value: ${{ jobs.build.outputs.output1 }}
jobs:
build:
runs-on: ubuntu-latest
outputs:
output0 : ${{ steps.step0.outputs.cache_dir }}
output1 : ${{ steps.step1.outputs.cache_key }}
steps:
- name: Test for GITHASH input
if: ${{ inputs.githash != '' }}
run: |
echo "GITHEAD=${{ inputs.githash }}" >> $GITHUB_ENV
- name: Setup GHDL
run: |
export GITPATH=https://github.com/ghdl/ghdl.git
if [ -z ${GITHEAD+x} ]; then
export GITHEAD=`git ls-remote $GITPATH HEAD | head -1 | awk '{print $1}'`
echo "GITHEAD=${GITHEAD}" >> $GITHUB_ENV
fi
echo "GITPATH=${GITPATH}" >> $GITHUB_ENV
echo "CACHE_DIR=${{ github.workspace }}/.cache/ghdl" >> $GITHUB_ENV
echo "CACHE_KEY=ghdl-${GITHEAD}" >> $GITHUB_ENV
- name: Cache Environment
id: git-cache
uses: actions/cache@v3
with:
path: ${{ env.CACHE_DIR }}
key: ${{ env.CACHE_KEY }}
- if: ${{ steps.git-cache.outputs.cache-hit != 'true' }}
name: Compile GHDL
run: |
mkdir -p ${{ env.CACHE_DIR }}
git clone ${{ env.GITPATH }}
cd ghdl
git checkout ${{ env.GITHEAD }}
sudo apt install gnat
./configure --prefix=${{ env.CACHE_DIR }}
make -j$(nproc)
sudo make install
cd ..
- id: step0
run: echo "cache_dir=${{ env.CACHE_DIR }}" >> $GITHUB_OUTPUT
- id: step1
run: echo "cache_key=${{ env.CACHE_KEY }}" >> $GITHUB_OUTPUT