|
| 1 | +stages: |
| 2 | + - sync |
| 3 | + - singularity_build |
| 4 | + - load_deps |
| 5 | + - test |
| 6 | + |
| 7 | +variables: |
| 8 | + PIPELINE_NAME: |
| 9 | + description: "Optional name to better identify this pipeline" |
| 10 | + value: "" |
| 11 | + TEST_SUITE: |
| 12 | + description: "Select test suite to run" |
| 13 | + value: "full" |
| 14 | + options: |
| 15 | + - "none" |
| 16 | + - "quicktest" |
| 17 | + - "full" |
| 18 | + CPU_CORES: |
| 19 | + description: "Select number of CPU cores and test workers" |
| 20 | + value: "8" |
| 21 | + PARALLEL_JOBS: |
| 22 | + description: "Number of parallel Slurm array jobs per Benchmark job" |
| 23 | + value: "2" |
| 24 | + SLURM_TIMEOUT: |
| 25 | + description: "Select SLURM timeout" |
| 26 | + value: "3-0" # [days-hours] |
| 27 | + SLURM_PARTITION: |
| 28 | + description: "Slurm partition (e.g., normal, largemem, fpga, gpu)" |
| 29 | + value: "normal" |
| 30 | + SLURM_QOS: |
| 31 | + description: "Optional QoS option (include --qos, e.g., --qos express)" |
| 32 | + value: "" |
| 33 | + MANUAL_CFG_PATH: |
| 34 | + description: "Use this config file instead of configs stored in the repo. Path must be accessible to runner" |
| 35 | + value: "" |
| 36 | + FINN_XILINX_VERSION: |
| 37 | + value: "2022.2" |
| 38 | + |
| 39 | +workflow: |
| 40 | + name: '$PIPELINE_NAME' |
| 41 | + rules: |
| 42 | + # Run pipeline for GitHub PRs to dev (does not support PRs from forks) |
| 43 | + - if: $CI_PIPELINE_SOURCE == "external_pull_request_event" && $CI_EXTERNAL_PULL_REQUEST_TARGET_BRANCH_NAME == "dev" |
| 44 | + # Run pipeline for pushes to dev |
| 45 | + - if: $CI_COMMIT_BRANCH == "dev" |
| 46 | + # Run pipeline if manually triggered via API or web GUI |
| 47 | + - if: $CI_PIPELINE_SOURCE == "api" |
| 48 | + - if: $CI_PIPELINE_SOURCE == "web" |
| 49 | + # Run pipeline if scheduled (only for nightly sync of finn-dev) |
| 50 | + - if: $CI_PIPELINE_SOURCE == "schedule" |
| 51 | + |
| 52 | +Sync finn-dev: |
| 53 | + id_tokens: |
| 54 | + CI_JOB_JWT: |
| 55 | + aud: https://git.uni-paderborn.de |
| 56 | + stage: sync |
| 57 | + tags: |
| 58 | + # Run where full Docker + Singularity is available |
| 59 | + - image_build |
| 60 | + rules: |
| 61 | + # Only run on a schedule |
| 62 | + - if: $CI_PIPELINE_SOURCE == "schedule" |
| 63 | + script: |
| 64 | + - mkdir -p ../github_clone && cd ../github_clone |
| 65 | + - rm -rf finn-plus # Ensure we do a fresh clone (TODO: better way to handle this on job level?) |
| 66 | + - git clone git@github.com:eki-project/finn-plus.git && cd finn-plus |
| 67 | + - git remote add upstream https://github.com/Xilinx/finn.git |
| 68 | + - git checkout finn-dev |
| 69 | + - git pull upstream dev |
| 70 | + - git push origin finn-dev |
| 71 | + |
| 72 | +Singularity Image Build: |
| 73 | + id_tokens: |
| 74 | + CI_JOB_JWT: |
| 75 | + aud: https://git.uni-paderborn.de |
| 76 | + stage: singularity_build |
| 77 | + tags: |
| 78 | + # Run where full Docker + Singularity is available |
| 79 | + - image_build |
| 80 | + rules: |
| 81 | + # Do not run on a schedule |
| 82 | + - if: $CI_PIPELINE_SOURCE == "schedule" |
| 83 | + when: never |
| 84 | + # Always run for dev branch to ensure default image is up to date |
| 85 | + - if: $CI_COMMIT_REF_SLUG == "dev" |
| 86 | + # For other branches only run if relevant files changed relative to dev branch |
| 87 | + - changes: |
| 88 | + paths: |
| 89 | + - requirements.txt |
| 90 | + - docker/Dockerfile.finn |
| 91 | + - docker/finn_entrypoint.sh |
| 92 | + - docker/quicktest.sh |
| 93 | + compare_to: "dev" |
| 94 | + script: |
| 95 | + - docker build --no-cache -f docker/Dockerfile.finn --tag=finn_docker_export . |
| 96 | + - apptainer build --force finn_singularity_image.sif docker-daemon://finn_docker_export:latest |
| 97 | + - rsync -vh finn_singularity_image.sif $PATH_SINGULARITY_IMG_BUILD/finn-plus/finn_$CI_COMMIT_REF_SLUG.sif |
| 98 | + - echo SINGULARITY_IMG_SELECT=finn_$CI_COMMIT_REF_SLUG.sif > FINN_environment.env |
| 99 | + after_script: # Clean caches |
| 100 | + - echo 'y' | docker image prune |
| 101 | + - echo 'y' | docker builder prune |
| 102 | + - echo 'y' | apptainer cache clean |
| 103 | + # Save env var selecting Singularity image to be used in subsequent jobs |
| 104 | + artifacts: |
| 105 | + reports: |
| 106 | + dotenv: FINN_environment.env |
| 107 | + |
| 108 | +Fetch Repos: |
| 109 | + id_tokens: |
| 110 | + CI_JOB_JWT: |
| 111 | + aud: https://git.uni-paderborn.de |
| 112 | + stage: load_deps |
| 113 | + tags: |
| 114 | + - login |
| 115 | + rules: |
| 116 | + # Do not run on a schedule |
| 117 | + - if: $CI_PIPELINE_SOURCE == "schedule" |
| 118 | + when: never |
| 119 | + # Otherwise run |
| 120 | + - when: always |
| 121 | + cache: |
| 122 | + key: $CI_COMMIT_SHA |
| 123 | + paths: |
| 124 | + - deps |
| 125 | + variables: |
| 126 | + SINGULARITY_IMG_SELECT: "finn_dev.sif" # default, may be overwritten by dotenv artifact |
| 127 | + script: |
| 128 | + - ./fetch-repos.sh |
| 129 | + # Workaround for https://gitlab.com/gitlab-org/gitlab/-/issues/349538 |
| 130 | + # Passing artifacts from optional parent jobs to child pipelines is not supported |
| 131 | + # Therefore, we pass the dotenv artifact from "Singularity Image Build" through this job |
| 132 | + - echo SINGULARITY_IMG_SELECT=$SINGULARITY_IMG_SELECT > FINN_environment_passthrough.env |
| 133 | + artifacts: |
| 134 | + reports: |
| 135 | + dotenv: FINN_environment_passthrough.env |
| 136 | + |
| 137 | +FINN Test Suite 2022.2: |
| 138 | + id_tokens: |
| 139 | + CI_JOB_JWT: |
| 140 | + aud: https://git.uni-paderborn.de |
| 141 | + stage: test |
| 142 | + rules: |
| 143 | + # Do not run on a schedule |
| 144 | + - if: $CI_PIPELINE_SOURCE == "schedule" |
| 145 | + when: never |
| 146 | + # Do not run if test suite has been deselected |
| 147 | + - if: $TEST_SUITE == "none" |
| 148 | + when: never |
| 149 | + # Always run, as long as there was no prior failure |
| 150 | + - when: on_success |
| 151 | + cache: |
| 152 | + key: $CI_COMMIT_SHA |
| 153 | + policy: pull |
| 154 | + paths: |
| 155 | + - deps |
| 156 | + variables: |
| 157 | + SCHEDULER_PARAMETERS: "-A $PROJECT_ACCOUNT -p $SLURM_PARTITION -t $SLURM_TIMEOUT $SLURM_QOS --nodes 1 --ntasks 1 --cpus-per-task $CPU_CORES --exclusive" |
| 158 | + PYTEST_PARALLEL: "$CPU_CORES" |
| 159 | + FINN_XILINX_VERSION: "2022.2" |
| 160 | + before_script: |
| 161 | + - cp -dfR .. $PATH_WORKDIR # Copy to working directory (e.g. RAMdisk) |
| 162 | + - cd $PATH_WORKDIR/finn-plus |
| 163 | + - chmod 755 ./test.sh |
| 164 | + - module load system singularity |
| 165 | + - ulimit -s unlimited # Increase stack size limit |
| 166 | + - export FINN_SINGULARITY=$PATH_SINGULARITY_IMG/finn-plus/$SINGULARITY_IMG_SELECT |
| 167 | + script: |
| 168 | + - ./run-docker.sh ./test.sh $TEST_SUITE |
| 169 | + artifacts: |
| 170 | + name: "test_reports" |
| 171 | + when: always |
| 172 | + paths: |
| 173 | + - reports/ |
| 174 | + reports: |
| 175 | + junit: reports/*.xml |
| 176 | + |
| 177 | +FINN Test Suite 2024.1: |
| 178 | + extends: FINN Test Suite 2022.2 |
| 179 | + variables: |
| 180 | + FINN_XILINX_VERSION: "2024.1" |
0 commit comments