Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

treewide: Improve docker container build, CI caching and python dependencies #192

Merged
merged 130 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
130 commits
Select commit Hold shift + click to select a range
ac99545
py: Consolidate python requirements into `pyproject.toml` file
fischeti Aug 29, 2024
9eb222a
py: Remove previous requirement files
fischeti Aug 29, 2024
ae5aad9
ci: Remove doc generation in internal CI
fischeti Aug 29, 2024
c0f2809
docs: Update guide
fischeti Aug 29, 2024
1a3e2f3
container: Copy `pyproject.toml`
fischeti Aug 29, 2024
ca2bf6f
container: Only install dependencies
fischeti Aug 30, 2024
5172c76
container: Get rid of deprecated `spike-dasm`
fischeti Aug 30, 2024
ebf36c5
container: Update actions
fischeti Aug 30, 2024
5261493
container: Copy necessary sources
fischeti Aug 30, 2024
40a8783
container: Fix minor warnings
fischeti Aug 30, 2024
6f9d7e4
REVERT: Use custom container
fischeti Aug 30, 2024
290193a
container: Install `docs` dependencies
fischeti Aug 30, 2024
c3892d6
py: Merge dependencies
fischeti Aug 30, 2024
6993529
Revert "ci: Remove doc generation in internal CI"
fischeti Aug 30, 2024
f68307d
ci: Don't run CI on draft PRs (twice)
fischeti Sep 2, 2024
0422633
ci: Build docker container on all branches
fischeti Sep 2, 2024
b317b15
ci: Cache docker container build
fischeti Sep 2, 2024
8a446f3
container: Install verilator with apt
fischeti Sep 2, 2024
28ff9b9
ci: Don't free up space
fischeti Sep 2, 2024
a170979
container: Clean up container
fischeti Sep 2, 2024
592e769
container: Clean up
fischeti Sep 2, 2024
f80178a
container: debug build
fischeti Sep 2, 2024
686a955
REVERT: Disable CI
fischeti Sep 2, 2024
f9eead1
container: debug
fischeti Sep 2, 2024
f389d5e
container: debug
fischeti Sep 2, 2024
e7f6b51
container: debug
fischeti Sep 2, 2024
d0b3c6c
container: Bump `verilator` to `5.020`
fischeti Sep 2, 2024
eb6f33d
container: Add `build-essential` again
fischeti Sep 2, 2024
938ed86
container: Clean up rust/banshee dependencies
fischeti Sep 2, 2024
ba5f7dc
container: Revert to ubuntu 22.04 again
fischeti Sep 2, 2024
b3b1caf
container: Install cmake like a normal human being
fischeti Sep 2, 2024
b06e96c
container: Use `noninteractive` flag again
fischeti Sep 2, 2024
d345b6a
container: Clean up
fischeti Sep 2, 2024
9293972
container: Revert back verilator install to source
fischeti Sep 2, 2024
959c4c2
container: Try again with Ubuntu 24.04
fischeti Sep 2, 2024
7160b7d
Revert "container: Revert back verilator install to source"
fischeti Sep 2, 2024
62d9cff
container: Use LLVM 15 for banshee
fischeti Sep 2, 2024
b560121
container: Try with env variable
fischeti Sep 2, 2024
01ac201
container: Fix banshee dependencies
fischeti Sep 2, 2024
0a16c41
container: Try setting environment variable for banshee
fischeti Sep 2, 2024
4d93d6f
container: Debug
fischeti Sep 2, 2024
6cff79b
container: Debug
fischeti Sep 2, 2024
f0dd9aa
container: Try installing cmake
fischeti Sep 2, 2024
7e7a99c
container: Some more dependencies for banshee
fischeti Sep 2, 2024
9b666b2
container: Debug
fischeti Sep 2, 2024
9eb8e97
container: Clean up
fischeti Sep 2, 2024
2eabffc
container: Try to copy python over
fischeti Sep 2, 2024
9160783
container: Move stuff around
fischeti Sep 2, 2024
09c299f
container: Move it around again
fischeti Sep 2, 2024
ed8d44f
container: Debug
fischeti Sep 2, 2024
e211e45
container: Use correct python and activate environment
fischeti Sep 2, 2024
d32f521
container: Use default python version
fischeti Sep 2, 2024
c539baf
container: Use `python3`
fischeti Sep 2, 2024
2ca3345
container: Revert back a lot of stuff
fischeti Sep 2, 2024
bfe20e2
container: Clean up
fischeti Sep 2, 2024
f3ecc11
container: banshee deps
fischeti Sep 2, 2024
24b497b
container: python deps
fischeti Sep 2, 2024
02a4e26
container: More python deps
fischeti Sep 2, 2024
1f22ab9
container: Install python with `apt` (again)
fischeti Sep 3, 2024
0299f32
container: Verilator dependencies
fischeti Sep 3, 2024
13856ec
container: More dependencies for verilator
fischeti Sep 3, 2024
be013ac
container: Fix python version
fischeti Sep 3, 2024
cccc555
ci: Try freeing up disk space before
fischeti Sep 3, 2024
b7fe2c0
container: Try verilator container
fischeti Sep 3, 2024
8b663d0
Revert "ci: Try freeing up disk space before"
fischeti Sep 3, 2024
549df75
container: Specify ubuntu version
fischeti Sep 3, 2024
03310f1
container: Banshee dependencies
fischeti Sep 3, 2024
30de53e
container: Debug verilator
fischeti Sep 3, 2024
c149641
container: Clean up
fischeti Sep 3, 2024
52dbf68
container: Install python with `venv`
fischeti Sep 3, 2024
b2f6f03
container: Add additional stage for python files
fischeti Sep 3, 2024
f5ef89a
container: Also install pip
fischeti Sep 3, 2024
fd0e4ab
container: Debug
fischeti Sep 3, 2024
ed15660
container: Debug
fischeti Sep 3, 2024
46dcb25
contaienr: Debug
fischeti Sep 3, 2024
45a916c
container: Debug
fischeti Sep 3, 2024
5cb109f
container: Disable cache for the moment
fischeti Sep 3, 2024
21e3edb
container: Debug
fischeti Sep 4, 2024
78448d4
container: Debug
fischeti Sep 4, 2024
d80a42f
Revert "Revert "ci: Try freeing up disk space before""
fischeti Sep 4, 2024
5bfca71
Revert "container: Disable cache for the moment"
fischeti Sep 4, 2024
a4ada4c
Revert "Revert "Revert "ci: Try freeing up disk space before"""
fischeti Sep 4, 2024
fe1686e
Revert "REVERT: Disable CI"
fischeti Sep 4, 2024
f9c0b5c
container: Set PATH variables correctly
fischeti Sep 4, 2024
46a08a6
ci: Update clang-lint action
fischeti Sep 4, 2024
48d21da
container: Move LLLM install to previous stage
fischeti Sep 4, 2024
3db37c8
ci: Don't run pip install anymore
fischeti Sep 4, 2024
4d0b2b6
ci: Build container before running verilator CI
fischeti Sep 4, 2024
d8eabaa
ci: Don't use container for linting
fischeti Sep 4, 2024
e7a4839
ci: Cache verilator build
fischeti Sep 4, 2024
a7efc65
ci: Free up disk space when building the container
fischeti Sep 4, 2024
a4d029b
ci: Don't run for draft requests
fischeti Sep 4, 2024
bdf23f8
lint: YAML sources
fischeti Sep 4, 2024
dd1315f
ci: Remove unused `bender vendor init`
fischeti Sep 4, 2024
b0d4001
Revert "ci: Don't run pip install anymore"
fischeti Sep 4, 2024
2ef9503
container: Add LLVM to path for `clang-format`
fischeti Sep 5, 2024
eb40790
container: Don't set `tools` as workdir
fischeti Sep 5, 2024
533696f
ci: Bump python and verilator version for IIS setup
fischeti Sep 5, 2024
05e9fdd
ci: fix syntax mistake
fischeti Sep 5, 2024
4a35a9c
container: Install `device-tree-compiler`
fischeti Sep 5, 2024
923b15b
container: Use verilator as base image for last stage
fischeti Sep 5, 2024
f33109c
sim: Fix verilator flags
fischeti Sep 5, 2024
87578a9
ci: Fix typo
fischeti Sep 5, 2024
9a6f4c8
ci: Fix working directory
fischeti Sep 5, 2024
2db8af9
container: Remove unused `apt-requirements.txt`
fischeti Sep 5, 2024
4c599d4
ci: Remove pip installs again
fischeti Sep 5, 2024
2cbfa20
ci: Separate `vlt-flist` with commas
fischeti Sep 5, 2024
c857499
ci: Correct flist for verilator build caching
fischeti Sep 5, 2024
c15ca10
ci: Try stripping
fischeti Sep 5, 2024
a412982
ci: Debug
fischeti Sep 5, 2024
3dfdbfc
ci: Use simpler file hashing for caching
fischeti Sep 5, 2024
4381f44
doc: Update container documentation
fischeti Sep 5, 2024
73510b5
ci: Revert publish doc
fischeti Sep 5, 2024
51dcd8e
ci: Also run on draft pull requests
fischeti Sep 5, 2024
a8d9358
ci: Run on internal push and external pull requests
fischeti Sep 5, 2024
fa2b1d6
ci: Linting
fischeti Sep 5, 2024
aae1a89
ci: Hash exact requirements of `bin/snitch_cluster.vlt`
colluca Sep 6, 2024
c6ef368
ci: Temporarily run `list-make-prerequisites` in debug mode
colluca Sep 6, 2024
01661e5
env: Fix python version
fischeti Sep 6, 2024
f68bfae
container: Merge run commands
fischeti Sep 6, 2024
08f4840
container: Use `.dockerignore` to filter python files
fischeti Sep 6, 2024
4f89a6f
ci: Use `list-make-prerequisites` action
colluca Sep 6, 2024
79a03df
container: Use `non-interactive` in every stage
fischeti Sep 10, 2024
25fc294
container: Replace `apt` with `apt-get`
fischeti Sep 10, 2024
3ce3048
ci: Use `build-docker` workflow as dependency for other workflows
fischeti Sep 10, 2024
d1cf2d0
ci: Don't run `build-docker` for `pull_requests`
fischeti Sep 10, 2024
c48bc10
Revert "ci: Don't run `build-docker` for `pull_requests`"
fischeti Sep 10, 2024
e78d17b
Revert "ci: Use `build-docker` workflow as dependency for other workf…
fischeti Sep 10, 2024
8add931
ci: Move sources-up-to-date job from lint to ci
colluca Sep 26, 2024
f46b68d
ci: Temporarily remove Banshee due to dependency error
colluca Sep 27, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .dockerignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
*
!sw/**/*.py
!util/**/*.py
!pyproject.toml
44 changes: 0 additions & 44 deletions .github/workflows/build-docker.yml

This file was deleted.

149 changes: 122 additions & 27 deletions .github/workflows/ci.yml
fischeti marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,55 @@
# Run functional regression checks
name: ci
on: [push, pull_request]

jobs:

##########################
# Build Docker Container #
##########################

build-docker:
name: Deploy Docker image
runs-on: ubuntu-22.04
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
docker-images: false
colluca marked this conversation as resolved.
Show resolved Hide resolved
- uses: actions/checkout@v4
- uses: docker/setup-buildx-action@v3
- name: GHCR Log-in
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v6
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max`
file: util/container/Dockerfile
push: true
tags: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}

########
# Docs #
########

docs:
name: Build documentation
runs-on: ubuntu-22.04
needs: build-docker
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
container:
image: ghcr.io/pulp-platform/snitch_cluster:main
image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}
steps:
- uses: actions/checkout@v2
- name: Build docs
Expand All @@ -28,8 +66,12 @@ jobs:
pytest:
name: Python unit tests
runs-on: ubuntu-22.04
needs: build-docker
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
container:
image: ghcr.io/pulp-platform/snitch_cluster:main
image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}
steps:
- uses: actions/checkout@v2
- name: Run pytest
Expand All @@ -42,23 +84,40 @@ jobs:
sw-snitch-cluster-vlt:
name: Simulate SW on Snitch Cluster w/ Verilator
runs-on: ubuntu-22.04
needs: build-docker
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
container:
image: ghcr.io/pulp-platform/snitch_cluster:main
image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}
steps:
- uses: actions/checkout@v2
with:
submodules: 'recursive'
- name: Install local Python packages
run: pip install .
- name: Build Software
working-directory: target/snitch_cluster
run: |
bender vendor init
make CFG_OVERRIDE=cfg/github-ci.hjson sw
- name: Hash Verilator prerequisites
id: verilator-hash
uses: colluca/[email protected]
with:
working-directory: target/snitch_cluster
target: bin/snitch_cluster.vlt
flags: --recursive
- name: Set up cache for Verilator build
id: verilator-cache
uses: actions/cache@v3
with:
path: target/snitch_cluster/bin
key: verilator-${{ steps.verilator-hash.outputs.hash }}
restore-keys: |
verilator-
- name: Build Hardware
if: steps.verilator-cache.outputs.cache-hit != 'true'
working-directory: target/snitch_cluster
run: |
make CFG_OVERRIDE=cfg/github-ci.hjson VLT_JOBS=1 bin/snitch_cluster.vlt
- name: Build Software
working-directory: target/snitch_cluster
run: |
make CFG_OVERRIDE=cfg/github-ci.hjson sw
- name: Run Tests
working-directory: target/snitch_cluster
run: |
Expand All @@ -69,28 +128,64 @@ jobs:
run: |
make SIM_DIR=./runs/simple annotate -j

#########################################
# Build SW on Snitch Cluster w/ Banshee #
#########################################
# #########################################
# # Build SW on Snitch Cluster w/ Banshee #
# #########################################

# sw-snitch-cluster-banshee:
# name: Simulate SW on Snitch Cluster w/ Banshee
# runs-on: ubuntu-22.04
# needs: build-docker
# if: >
# github.event_name != 'pull_request' ||
# github.event.pull_request.head.repo.full_name != github.repository
# container:
# image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}
# steps:
# - uses: actions/checkout@v2
# with:
# submodules: 'recursive'
# - name: Build Software
# run: |
# bender vendor init
# make -C target/snitch_cluster SELECT_RUNTIME=banshee sw
# - name: Run Tests
# env:
# SNITCH_LOG: info
# working-directory: target/snitch_cluster
# run: |
# ./util/run.py sw/run.yaml --simulator banshee -j

sw-snitch-cluster-banshee:
name: Simulate SW on Snitch Cluster w/ Banshee
######################
# Sources Up-to-Date #
######################
sources-up-to-date:
name: Check Sources Up-to-Date
runs-on: ubuntu-22.04
needs: build-docker
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
container:
image: ghcr.io/pulp-platform/snitch_cluster:main
image: ghcr.io/pulp-platform/snitch_cluster:${{ github.ref_name }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Install local Python packages
run: pip install .
- name: Build Software
submodules: true
- name: Generate opcodes
run: |
bender vendor init
make -C target/snitch_cluster SELECT_RUNTIME=banshee sw
- name: Run Tests
env:
SNITCH_LOG: info
./util/generate-opcodes.sh
- name: Generate RTL sources
working-directory: target/snitch_cluster
run: |
./util/run.py sw/run.yaml --simulator banshee -j
make rtl
# For some reason, the checkout is done by a different user,
# than that running `git diff` (root, possibly due to Docker).
# So we need to set the repository as a safe directory.
- name: Git config safe.directory
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Diff porcelain
uses: mmontes11/[email protected]
with:
message: Found differences, please update all sources
8 changes: 4 additions & 4 deletions .github/workflows/gitlab-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@ jobs:
- name: Check Gitlab CI
uses: pulp-platform/pulp-actions/[email protected]
# Skip on forks or pull requests from forks due to missing secrets.
if:
# yamllint disable rule:line-length
github.repository == 'pulp-platform/snitch_cluster' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name == github.repository)
# yamllint enable rule:line-length
if: >
github.repository == 'pulp-platform/snitch_cluster' &&
(github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name == github.repository)
with:
domain: iis-git.ee.ethz.ch
repo: github-mirror/snitch_cluster
Expand Down
55 changes: 22 additions & 33 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,9 @@ jobs:
verible-lint:
name: Lint Verilog sources
runs-on: ubuntu-latest
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@v3
- uses: chipsalliance/verible-linter-action@main
Expand All @@ -32,48 +35,22 @@ jobs:
bender-vendor-up-to-date:
name: Check bender vendor up-to-date
runs-on: ubuntu-latest
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Check bender vendor up-to-date
uses: pulp-platform/pulp-actions/[email protected]

######################
# Sources Up-to-Date #
######################
sources-up-to-date:
name: Check Sources Up-to-Date
runs-on: ubuntu-22.04
container:
image: ghcr.io/pulp-platform/snitch_cluster:main
steps:
- uses: actions/checkout@v4
with:
submodules: true
- name: Install local Python packages
run: pip install .
- name: Generate opcodes
run: |
./util/generate-opcodes.sh
- name: Generate RTL sources
working-directory: target/snitch_cluster
run: |
make rtl
# For some reason, the checkout is done by a different user,
# than that running `git diff` (root, possibly due to Docker).
# So we need to set the repository as a safe directory.
- name: Git config safe.directory
run: |
git config --global --add safe.directory $GITHUB_WORKSPACE
- name: Diff porcelain
uses: mmontes11/[email protected]
with:
message: Found differences, please update all sources

#################
# Check License #
#################
license-lint:
name: Check License headers
runs-on: ubuntu-latest
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
steps:
- name: Check License
uses: pulp-platform/pulp-actions/[email protected]
Expand All @@ -97,6 +74,9 @@ jobs:
yaml-lint:
name: Lint YAML Sources
runs-on: ubuntu-latest
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@v3
- name: yaml-lint
Expand All @@ -109,6 +89,9 @@ jobs:
########################
python-lint:
runs-on: ubuntu-latest
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
name: Lint Python Sources
steps:
- name: Check out source repository
Expand All @@ -130,9 +113,12 @@ jobs:
clangfmt:
name: Lint C/C++ Sources
runs-on: ubuntu-latest
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@v3
- uses: DoozyX/clang-format-lint-action@v0.16.2
- uses: DoozyX/clang-format-lint-action@v0.18.1
with:
clangFormatVersion: 10

Expand All @@ -143,6 +129,9 @@ jobs:
editorconfig-lint:
name: Lint Editorconfig
runs-on: ubuntu-latest
if: >
github.event_name != 'pull_request' ||
github.event.pull_request.head.repo.full_name != github.repository
steps:
- uses: actions/checkout@v3
- uses: editorconfig-checker/action-editorconfig-checker@main
Expand Down
9 changes: 0 additions & 9 deletions apt-requirements.txt

This file was deleted.

11 changes: 0 additions & 11 deletions docs/requirements.txt

This file was deleted.

Loading
Loading