Skip to content

[CI] Add cache checkout script to docker containers #5184

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

Merged
merged 2 commits into from
Dec 20, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
39 changes: 39 additions & 0 deletions devops/actions/cached_checkout/action.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: 'Cached checkout'
description: 'Checkout a git repository using local cache if possible'
inputs:
repository:
description: 'Repository name with owner'
default: ${{ github.repository }}
ref:
description: 'Commit-ish to checkout'
path:
description: 'Path to checkout repo to'
fetch-depth:
description: 'Number of commits to fetch'
default: 1
cache_path:
description: 'Path to cache location for all repos'

runs:
using: 'composite'
steps:
- name: Fetch cache
shell: bash
run: |
mkdir -p ${{ inputs.cache_path }}/${{ inputs.repository }}
cd ${{ inputs.cache_path }}/${{ inputs.repository }}
if [ -d ./.git ]; then
git pull
else
git clone https://github.com/${{ inputs.repository }}.git .
fi
chown -R sycl:sycl ${{ inputs.cache_path }}/${{ inputs.repository }}
- name: Checkout
env:
GIT_ALTERNATE_OBJECT_DIRECTORIES: ${{ inputs.cache_path }}/${{ inputs.repository }}/.git/objects
uses: actions/checkout@v2
with:
repository: ${{ inputs.repository }}
ref: ${{ inputs.ref }}
path: ${{ inputs.path }}
fetch-depth: ${{ inputs.fetch-depth }}
2 changes: 2 additions & 0 deletions devops/containers/ubuntu2004_base.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@ RUN groupadd -g 1001 sycl && useradd sycl -u 1001 -g 1001 -m -s /bin/bash
# Add sycl user to video group so that it can access GPU
RUN usermod -aG video sycl

COPY actions/cached_checkout /actions/cached_checkout
COPY actions/cleanup /actions/cleanup
COPY scripts/docker_entrypoint.sh /docker_entrypoint.sh

ENTRYPOINT ["/docker_entrypoint.sh"]
2 changes: 2 additions & 0 deletions devops/containers/ubuntu2004_build.Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,8 @@ RUN groupadd -g 1001 sycl && useradd sycl -u 1001 -g 1001 -m -s /bin/bash
# Add sycl user to video group so that it can access GPU
RUN usermod -aG video sycl

COPY actions/cached_checkout /actions/cached_checkout
COPY actions/cleanup /actions/cleanup
COPY scripts/docker_entrypoint.sh /docker_entrypoint.sh

ENTRYPOINT ["/docker_entrypoint.sh"]
Expand Down
5 changes: 5 additions & 0 deletions devops/scripts/install_build_tools.sh
Original file line number Diff line number Diff line change
Expand Up @@ -9,5 +9,10 @@ apt update && apt install -yqq \
python3 \
python3-distutils \
python-is-python3 \
python3-pip \
zstd \
ocl-icd-libopencl1 \
vim

pip3 install psutil