-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add pulp-nnx test docker image and move neureka tests to github actio…
…ns (#12) * Add docker build and push action * Add github action neureka test * Remove neureka testing from gitlab-ci
- Loading branch information
Showing
10 changed files
with
149 additions
and
10 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
# The workflow copied from [docker docs](https://docs.github.com/en/actions/use-cases-and-examples/publishing-packages/publishing-docker-images#publishing-images-to-github-packages) | ||
# with some changes. Notably the trigger is changed to `workflow_dispatch` and there is a suffix `-test` added to the generated tag in the metadata step. | ||
name: Create and publish a Docker image | ||
|
||
# Configures this workflow to run only on manual dispatch | ||
on: workflow_dispatch | ||
|
||
# Defines two custom environment variables for the workflow. These are used for the Container registry domain, and a name for the Docker image that this workflow builds. | ||
env: | ||
REGISTRY: ghcr.io | ||
IMAGE_NAME: ${{ github.repository }} | ||
|
||
# There is a single job in this workflow. It's configured to run on the latest available version of Ubuntu. | ||
jobs: | ||
build-and-push-image: | ||
runs-on: ubuntu-latest | ||
# Sets the permissions granted to the `GITHUB_TOKEN` for the actions in this job. | ||
permissions: | ||
contents: read | ||
packages: write | ||
attestations: write | ||
id-token: write | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
# Uses the `docker/login-action` action to log in to the Container registry registry using the account and password that will publish the packages. Once published, the packages are scoped to the account defined here. | ||
- name: Log in to the Container registry | ||
uses: docker/login-action@v3 | ||
with: | ||
registry: ${{ env.REGISTRY }} | ||
username: ${{ github.actor }} | ||
password: ${{ secrets.GITHUB_TOKEN }} | ||
# This step uses [docker/metadata-action](https://github.com/docker/metadata-action#about) to extract tags and labels that will be applied to the specified image. The `id` "meta" allows the output of this step to be referenced in a subsequent step. The `images` value provides the base name for the tags and labels. | ||
- name: Extract metadata (tags, labels) for Docker | ||
id: meta | ||
uses: docker/metadata-action@v5 | ||
with: | ||
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} | ||
labels: | | ||
org.opencontainers.image.vendor=pulp-platform | ||
org.opencontainers.image.description=Image for testing the pulp-nnx library | ||
tags: | | ||
type=ref,suffix=-test,event=tag | ||
type=ref,suffix=-test,event=branch | ||
- run: echo "Docker tags ${{ steps.meta.outputs.tags }}" | ||
- run: echo "Docker labels ${{ steps.meta.outputs.labels }}" | ||
|
||
# This step uses the `docker/build-push-action` action to build the image, based on your repository's `Dockerfile`. If the build succeeds, it pushes the image to GitHub Packages. | ||
# It uses the `context` parameter to define the build's context as the set of files located in the specified path. For more information, see "[Usage](https://github.com/docker/build-push-action#usage)" in the README of the `docker/build-push-action` repository. | ||
# It uses the `tags` and `labels` parameters to tag and label the image with the output from the "meta" step. | ||
- name: Build and push Docker image | ||
id: push | ||
uses: docker/build-push-action@v6 | ||
with: | ||
context: ./test | ||
file: ./test/Dockerfile | ||
push: true | ||
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
# This step generates an artifact attestation for the image, which is an unforgeable statement about where and how it was built. It increases supply chain security for people who consume the image. For more information, see "[AUTOTITLE](/actions/security-guides/using-artifact-attestations-to-establish-provenance-for-builds)." | ||
- name: Generate artifact attestation | ||
uses: actions/attest-build-provenance@v2 | ||
with: | ||
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} | ||
subject-digest: ${{ steps.push.outputs.digest }} | ||
push-to-registry: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
name: Test Neureka | ||
on: push | ||
jobs: | ||
test: | ||
runs-on: ubuntu-latest | ||
container: ghcr.io/pulp-platform/pulp-nnx:main-test | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v4 | ||
- name: Run test | ||
shell: bash | ||
working-directory: test | ||
run: | | ||
source /pulp-sdk/configs/siracusa.sh | ||
pytest test.py -T tests -R -A neureka |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
FROM ubuntu:22.04 | ||
|
||
RUN DEBIAN_FRONTEND=noninteractive \ | ||
apt-get update && \ | ||
apt-get upgrade && \ | ||
apt-get install -y --no-install-recommends \ | ||
bzip2 \ | ||
ca-certificates \ | ||
cmake \ | ||
curl \ | ||
gcc \ | ||
git \ | ||
git-lfs \ | ||
g++ \ | ||
make \ | ||
python3 \ | ||
python3-pip \ | ||
python-is-python3 \ | ||
zlib1g-dev \ | ||
&& apt-get clean && \ | ||
rm -rf /var/lib/apt/lists/* | ||
|
||
COPY requirements-pip.txt docker/requirements-pulp-sdk.txt ./ | ||
RUN pip3 install --no-cache-dir -r requirements-pip.txt -r requirements-pulp-sdk.txt --extra-index-url https://download.pytorch.org/whl/cpu | ||
|
||
ENV PULP_SDK_HOME="/pulp-sdk" | ||
ENV PULP_RISCV_GCC_TOOLCHAIN="/toolchains/pulp-riscv-gnu-toolchain" | ||
|
||
COPY docker/get_pulp_riscv_gnu_toolchain.sh ./ | ||
RUN ./get_pulp_riscv_gnu_toolchain.sh | ||
|
||
COPY docker/get_pulp_sdk.sh ./ | ||
RUN ./get_pulp_sdk.sh |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/bin/bash | ||
|
||
set -euo pipefail | ||
|
||
curl -L https://github.com/pulp-platform/pulp-riscv-gnu-toolchain/releases/download/v1.0.16/v1.0.16-pulp-riscv-gcc-ubuntu-18.tar.bz2 > pulp-riscv-gnu-toolchain.tar.bz2 | ||
mkdir toolchains | ||
tar -xvjf ./pulp-riscv-gnu-toolchain.tar.bz2 -C ./toolchains | ||
mv ./toolchains/v1.0.16-pulp-riscv-gcc-ubuntu-18 ./toolchains/pulp-riscv-gnu-toolchain | ||
rm ./pulp-riscv-gnu-toolchain.tar.bz2 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
#!/bin/bash | ||
|
||
set -eo pipefail | ||
|
||
git clone https://github.com/Scheremo/pulp-sdk.git --branch scheremo --depth=1 && rm -rf pulp-sdk/.git | ||
|
||
cd pulp-sdk | ||
|
||
source configs/siracusa.sh | ||
make all |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
argcomplete | ||
pyelftools | ||
scons | ||
six |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
numpy | ||
numpy==1.26.4 | ||
pydantic | ||
pytest | ||
pytorch==1.11.0 | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
numpy==1.26.4 | ||
pydantic | ||
pytest | ||
torch==1.11.0 | ||
toml | ||
ninja |