|
| 1 | +# This config is used for the CircleCI workflow to run the tests on the Linux runner |
| 2 | +version: 2.1 |
| 3 | + |
| 4 | +parameters: |
| 5 | + build-unreal-plugin: |
| 6 | + type: boolean |
| 7 | + default: false |
| 8 | + build-blender-addon: |
| 9 | + type: boolean |
| 10 | + default: false |
| 11 | + run-unreal-test: |
| 12 | + type: boolean |
| 13 | + default: false |
| 14 | + run-blender-test: |
| 15 | + type: boolean |
| 16 | + default: false |
| 17 | + |
| 18 | +jobs: |
| 19 | + unreal-linux: |
| 20 | + parameters: |
| 21 | + image: |
| 22 | + type: string |
| 23 | + default: "ghcr.io/epicgames/unreal-engine:dev-5.3" |
| 24 | + docker: |
| 25 | + - image: << parameters.image >> |
| 26 | + auth: |
| 27 | + username: $GHCR_USERNAME |
| 28 | + password: $GHCR_TOKEN |
| 29 | + working_directory: ~/project |
| 30 | + steps: |
| 31 | + - when: |
| 32 | + condition: << pipeline.parameters.build-unreal-plugin >> || << pipeline.parameters.run-unreal-test >> |
| 33 | + steps: |
| 34 | + - checkout |
| 35 | + - run: |
| 36 | + name: Install Miniconda, Python 3.10, and XRFeitoria |
| 37 | + command: | |
| 38 | + curl -sLo Miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh |
| 39 | + bash Miniconda.sh -b -p $HOME/miniconda |
| 40 | + echo "source $HOME/miniconda/bin/activate" >> $BASH_ENV |
| 41 | + source $BASH_ENV |
| 42 | + conda install -y python=3.10 |
| 43 | + python -m pip install . |
| 44 | + - run: |
| 45 | + name: "Build Plugins & Run Tests" |
| 46 | + environment: |
| 47 | + BUILD_UNREAL_PLUGIN: << pipeline.parameters.build-unreal-plugin >> |
| 48 | + RUN_TEST: << pipeline.parameters.run-unreal-test >> |
| 49 | + PYTHONIOENCODING: "utf-8" |
| 50 | + command: | |
| 51 | + mkdir -p /home/ue4/project/src/dist |
| 52 | + if [ "$BUILD_UNREAL_PLUGIN" = "1" ]; then |
| 53 | + echo "#### Building Unreal Plugin ####" |
| 54 | + python -m xrfeitoria.utils.publish_plugins build-unreal -u "/home/ue4/UnrealEngine/Engine/Binaries/Linux/UnrealEditor-Cmd" |
| 55 | + export XRFEITORIA__DIST_ROOT="/home/ue4/project/src" |
| 56 | + export XRFEITORIA__VERSION=`python -c "import xrfeitoria; print(xrfeitoria.__version__)"` |
| 57 | + rm -rf /home/ue4/project/src/dist/*-Source.zip # remove source zip, cuz it's uploaded in the win build |
| 58 | + fi |
| 59 | + if [ "$RUN_TEST" = "1" ]; then |
| 60 | + echo "#### Running Tests ####" |
| 61 | + # Can't run tests on non-gpu machine |
| 62 | + echo "Skipping tests on non-gpu machine" |
| 63 | + # python -m tests.setup_ci -u "/home/ue4/UnrealEngine/Engine/Binaries/Linux/UnrealEditor-Cmd" |
| 64 | + # python -m tests.unreal.main |
| 65 | + fi |
| 66 | + - when: |
| 67 | + condition: << pipeline.parameters.build-unreal-plugin >> |
| 68 | + steps: |
| 69 | + - store_artifacts: |
| 70 | + when: << pipeline.parameters.build-unreal-plugin >> |
| 71 | + path: src/dist/ |
| 72 | + destination: Plugins |
| 73 | + - persist_to_workspace: |
| 74 | + when: << pipeline.parameters.build-unreal-plugin >> |
| 75 | + root: /home/ue4/project |
| 76 | + paths: |
| 77 | + - src/dist/ |
| 78 | + |
| 79 | + blender: |
| 80 | + docker: |
| 81 | + - image: linuxserver/blender:3.6.5 |
| 82 | + steps: |
| 83 | + - when: |
| 84 | + condition: << pipeline.parameters.build-blender-addon >> || << pipeline.parameters.run-blender-test >> |
| 85 | + steps: |
| 86 | + - checkout |
| 87 | + - run: |
| 88 | + name: Install Essential Packages |
| 89 | + command: | |
| 90 | + apt-get update |
| 91 | + apt-get install -y git |
| 92 | + - run: |
| 93 | + name: Install Miniconda, Python 3.10, and XRFeitoria |
| 94 | + command: | |
| 95 | + curl -sLo Miniconda.sh https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh |
| 96 | + bash Miniconda.sh -b -p $HOME/miniconda |
| 97 | + echo "source $HOME/miniconda/bin/activate" >> $BASH_ENV |
| 98 | + source $BASH_ENV |
| 99 | + conda install -y python=3.10 |
| 100 | + python -m pip install . |
| 101 | + - run: |
| 102 | + name: "Build Blender Addon & Run Tests" |
| 103 | + environment: |
| 104 | + BUILD_BLENDER_ADDON: << pipeline.parameters.build-blender-addon >> |
| 105 | + RUN_TEST: << pipeline.parameters.run-blender-test >> |
| 106 | + PYTHONIOENCODING: "utf-8" |
| 107 | + command: | |
| 108 | + if [ "$BUILD_BLENDER_ADDON" = "1" ]; then |
| 109 | + echo "#### Building Blender Addon ####" |
| 110 | + python -m xrfeitoria.utils.publish_plugins build-blender |
| 111 | + export XRFEITORIA__DIST_ROOT="/config/project/src/dist/" |
| 112 | + export XRFEITORIA__VERSION=`python -c "import xrfeitoria; print(xrfeitoria.__version__)"` |
| 113 | + fi |
| 114 | + if [ "$RUN_TEST" = "1" ]; then |
| 115 | + echo "#### Running Tests ####" |
| 116 | + python -m tests.setup_ci -b /usr/bin/blender |
| 117 | + python -m tests.blender.main -b |
| 118 | + fi |
| 119 | + - when: |
| 120 | + condition: << pipeline.parameters.build-blender-addon >> |
| 121 | + steps: |
| 122 | + - store_artifacts: |
| 123 | + path: /config/project/src/dist/ |
| 124 | + - persist_to_workspace: |
| 125 | + root: /config/project |
| 126 | + paths: |
| 127 | + - src/dist/ |
| 128 | + |
| 129 | + publish-github-release: |
| 130 | + docker: |
| 131 | + - image: cibuilds/base:latest |
| 132 | + steps: |
| 133 | + - checkout |
| 134 | + - attach_workspace: |
| 135 | + at: ./artifacts |
| 136 | + - run: |
| 137 | + name: "Get GitHub Release CLI" |
| 138 | + command: | |
| 139 | + # https://github.com/tcnksm/ghr |
| 140 | + GHR_VERSION="v0.16.2" |
| 141 | + GHR_URL="https://github.com/tcnksm/ghr/releases/download/${GHR_VERSION}/ghr_${GHR_VERSION}_linux_amd64.tar.gz" |
| 142 | + wget "$GHR_URL" && \ |
| 143 | + tar xzf ghr_${GHR_VERSION}_linux_amd64.tar.gz && \ |
| 144 | + mv ghr_${GHR_VERSION}_linux_amd64/ghr /usr/bin/ghr && \ |
| 145 | + rm -r ghr_${GHR_VERSION}_linux_amd64.tar.gz ghr_${GHR_VERSION}_linux_amd64/ |
| 146 | + - run: |
| 147 | + name: "Publish Release on GitHub" |
| 148 | + command: | |
| 149 | + VERSION=$(git describe --tags --abbrev=0) |
| 150 | + RELEASE_TITLE="XRFeitoria Release $VERSION" |
| 151 | + if [ -d "./artifacts/src/dist" ]; then |
| 152 | + DIST_PATH="./artifacts/src/dist/" |
| 153 | + else |
| 154 | + DIST_PATH="" |
| 155 | + fi |
| 156 | + ghr \ |
| 157 | + -t ${GITHUB_TOKEN} \ |
| 158 | + -u ${CIRCLE_PROJECT_USERNAME} \ |
| 159 | + -r ${CIRCLE_PROJECT_REPONAME} \ |
| 160 | + -c ${CIRCLE_SHA1} \ |
| 161 | + -n "${RELEASE_TITLE}" \ |
| 162 | + -draft \ |
| 163 | + -generatenotes \ |
| 164 | + -delete \ |
| 165 | + ${VERSION} ${DIST_PATH} |
| 166 | +
|
| 167 | +workflows: |
| 168 | + plugin-workflow: |
| 169 | + jobs: |
| 170 | + # -- Unreal -- # |
| 171 | + - unreal-linux: |
| 172 | + matrix: |
| 173 | + parameters: |
| 174 | + image: ["ghcr.io/epicgames/unreal-engine:dev-5.1", "ghcr.io/epicgames/unreal-engine:dev-5.2", "ghcr.io/epicgames/unreal-engine:dev-5.3"] |
| 175 | + filters: |
| 176 | + tags: |
| 177 | + only: /^v\d+\.\d+\.\d+/ |
| 178 | + # -- Blender -- # |
| 179 | + - blender: |
| 180 | + filters: |
| 181 | + tags: |
| 182 | + only: /^v\d+\.\d+\.\d+/ |
| 183 | + # -- Publish -- # |
| 184 | + - publish-github-release: |
| 185 | + requires: |
| 186 | + - blender |
| 187 | + - unreal-linux |
| 188 | + filters: |
| 189 | + branches: |
| 190 | + ignore: /.*/ |
| 191 | + tags: |
| 192 | + only: /^v\d+\.\d+\.\d+/ |
0 commit comments