@@ -13,29 +13,78 @@ jobs:
1313 runs-on : ubuntu-latest
1414 outputs :
1515 matrix : ${{ steps.generate.outputs.matrix }}
16+ images : ${{ steps.generate.outputs.images }}
1617
1718 steps :
1819
1920 - name : Setup repository
2021 uses : actions/checkout@v3
2122
22- - name : Generate examples matrix
23+ - name : Generate matrices
2324 id : generate
24- run : ./.github/scripts/generate_job_matrix .py '${{ github.repository }}'
25+ run : ./.github/scripts/generate_matrices .py '${{ github.repository }}'
2526
2627
27- Test :
28+ Packages :
2829 needs : Matrix
30+ runs-on : ubuntu-latest
31+ strategy :
32+ fail-fast : false
33+ matrix :
34+ include : ${{ fromJson(needs.Matrix.outputs.images) }}
35+ name : ' Image: ${{ matrix.image }}'
36+ env :
37+ DOCKER_BUILDKIT : 1
38+
39+ steps :
40+
41+ - name : Setup repository
42+ uses : actions/checkout@v2
43+ with :
44+ submodules : recursive
45+
46+ - name : Build container image
47+ run : |
48+ docker build -t ${{ matrix.registry }}/${{ matrix.image }} . -f- <<'EOF'
49+ FROM ${{ matrix.from }}
50+
51+ ENV LANG en_US.UTF-8
52+
53+ # Install utils
54+ RUN ${{ matrix.utils }}
55+
56+ # Install tuttest
57+ RUN wget https://github.com/antmicro/tuttest/releases/download/v0.2-beta/tuttest -O /usr/bin/tuttest \
58+ && chmod a+rx /usr/bin/tuttest
59+
60+ # Install F4PGA toolchain
61+ RUN --mount=type=bind,target=/tmp/ctx cp -vr /tmp/ctx /tmp/repo \
62+ && cd /tmp/repo && bash /tmp/repo/.github/scripts/install-toolchain.sh ${{ matrix.args }} \
63+ && cd .. && rm -rf /tmp/repo
64+ EOF
65+
66+ - name : Push container image
67+ if : ${{ github.event_name != 'pull_request' }}
68+ uses : pyTooling/Actions/with-post-step@r0
69+ with :
70+ main : |
71+ echo '${{ github.token }}' | docker login ghcr.io -u GitHub-Actions --password-stdin
72+ docker push ${{ matrix.registry }}/${{ matrix.image }}
73+ post : docker logout ghcr.io
74+
75+
76+ Test :
77+ needs :
78+ - Matrix
79+ - Packages
2980 strategy :
3081 fail-fast : false
3182 matrix :
3283 include : ${{ fromJson(needs.Matrix.outputs.matrix) }}
3384 runs-on : ${{ matrix.runs-on }}
34- name : ${{ matrix.fpga-fam }} | ${{ matrix.os }} ${{ matrix.os-version }} | ${{ matrix.example }}
85+ name : ${{ matrix.name }}
3586
3687 env :
37- LANG : " en_US.UTF-8"
38- DEBIAN_FRONTEND : " noninteractive"
3988 GHA_PREEMPTIBLE : " false"
4089 SURELOG_CMD : " "
4190
@@ -107,36 +156,25 @@ jobs:
107156 GHA_PREEMPTIBLE : " false"
108157 SURELOG_CMD : " -parse -DSYNTHESIS"
109158
110- container : ${{matrix.os}}:${{matrix.os-version}}
111-
112159 steps :
113- - name : Install utils
114- if : ${{matrix.os == 'ubuntu' || matrix.os == 'debian'}}
115- run : apt -qqy update && apt -qqy install git wget locales && locale-gen $LANG
116-
117- - name : Install utils
118- if : ${{matrix.os == 'centos'}}
119- run : yum -y install git wget
120-
121- - name : Install utils
122- if : ${{matrix.os == 'fedora'}}
123- run : dnf install -y git wget
124160
125161 - name : Setup repository
126162 uses : actions/checkout@v3
127163 with :
128164 submodules : recursive
129165
130- - name : Install tuttest
131- run : |
132- wget https://github.com/antmicro/tuttest/releases/download/v0.2-beta/tuttest -O /usr/bin/tuttest
133- chmod a+rx /usr/bin/tuttest
134-
135- - name : Install F4PGA toolchain
136- run : bash .github/scripts/install-toolchain.sh ${{matrix.fpga-fam}} ${{matrix.os}}
166+ - name : Pull container image
167+ run : docker pull ${{matrix.image}}
137168
138169 - name : Build examples
139- run : bash .github/scripts/build-examples.sh ${{matrix.fpga-fam}} ${{matrix.example}}
170+ # Workaround for 'uses: docker://${{matrix.image}}' not being supported.
171+ # See https://github.com/github/feedback/discussions/9049
172+ run : >-
173+ docker run --rm
174+ -v $(pwd):/wrk -w /wrk
175+ -e DEBIAN_FRONTEND="noninteractive"
176+ ${{matrix.image}}
177+ bash .github/scripts/build-examples.sh ${{matrix.fpga-fam}} ${{matrix.example}}
140178
141179 - uses : actions/upload-artifact@v2
142180 with :
0 commit comments