From 8f2b0daa60aceac04c4ece881edb278a06ffca56 Mon Sep 17 00:00:00 2001 From: Branden J Brown Date: Sun, 30 Jul 2023 14:06:03 -0500 Subject: [PATCH] update pipeline for woodpecker v1.0 --- .woodpecker.yml | 92 ++++++++++++++++++++++++++----------------------- 1 file changed, 49 insertions(+), 43 deletions(-) diff --git a/.woodpecker.yml b/.woodpecker.yml index a63dfee..3306403 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -2,72 +2,75 @@ workspace: base: /studio path: idle-survivors -# We use a singleton "matrix" to set variables, because formal variables are a -# Woodpecker next feature. -matrix: - include: - - BUILD_NAME: idle-survivors - UNITY_ACTIVATION_FILE: ./unity3d.alf - IMAGE: unityci/editor - IMAGE_VERSION: 1 - # The GitLab version pulls the Unity version from the project information, - # but I don't think Woodpecker will use that as a variable in image names. - # We set the version as a variable instead and check that it's right. - UNITY_VERSION: 2022.3.4f1 - UNITY_DIR: /studio/idle-survivors +variables: + - &base_image 'unityci/editor:2022.3.4f1-base-1' + - &win_mono_image 'unityci/editor:2022.3.4f1-windows-mono-1' + - all_env: &all_env + - BUILD_NAME=idle-survivors + - UNITY_VERSION=2022.3.4f1 + - UNITY_DIR=/studio/idle-survivors + - build_env: &build_env + - VERSION_NUMBER_VAR=${CI_COMMIT_BRANCH}-${CI_PIPELINE_NUMBER} + - VERSION_BUILD_VAR=${CI_COMMIT_HASH} + - test_env: &test_env + - TESTING_TYPE=NUNIT + - secrets: &secrets_list + - unity_license + - before_script: &before_script + - chmod +x $UNITY_DIR/ci/before_script.sh + - $UNITY_DIR/ci/before_script.sh + - test_script: &test_script + - chmod +x $UNITY_DIR/ci/test.sh + - $UNITY_DIR/ci/test.sh -pipeline: +steps: check-unity-version: - image: ${IMAGE}:${UNITY_VERSION}-base-${IMAGE_VERSION} + image: *base_image commands: - - test "$UNITY_VERSION" = $(grep "m_EditorVersion:" "${UNITY_DIR}/ProjectSettings/ProjectVersion.txt" | cut -d' ' -f2) + - test "$UNITY_VERSION" = $(grep "m_EditorVersion:" "$UNITY_DIR/ProjectSettings/ProjectVersion.txt" | cut -d' ' -f2) + environment: + <<: *all_env setup-license: - image: ${IMAGE}:${UNITY_VERSION}-base-${IMAGE_VERSION} + image: *base_image commands: - - chmod +x ${UNITY_DIR}/ci/before_script.sh - - ${UNITY_DIR}/ci/before_script.sh - secrets: [unity_license] + - <<: *before_script + secrets: + - <<: *secrets_list test-playmode: - image: ${IMAGE}:${UNITY_VERSION}-base-${IMAGE_VERSION} + image: *base_image commands: - - ${UNITY_DIR}/ci/before_script.sh - - chmod +x ${UNITY_DIR}/ci/test.sh - - ${UNITY_DIR}/ci/test.sh + - <<: [*before_script, *test_script] environment: + - <<: [*all_env, *build_env, *test_env] - TEST_PLATFORM=playmode - - TESTING_TYPE=NUNIT - - VERSION_NUMBER_VAR=${CI_COMMIT_BRANCH}-${CI_BUILD_NUMBER} - - VERSION_BUILD_VAR=${CI_COMMIT_HASH} - secrets: [unity_license] + secrets: + - <<: *secrets_list test-editmode: - image: ${IMAGE}:${UNITY_VERSION}-base-${IMAGE_VERSION} + image: *base_image commands: - - ${UNITY_DIR}/ci/before_script.sh - - chmod +x ${UNITY_DIR}/ci/test.sh - - ${UNITY_DIR}/ci/test.sh + - <<: [*before_script, *test_script] environment: + - <<: [*all_env, *build_env, *test_env] - TEST_PLATFORM=editmode - - TESTING_TYPE=NUNIT - - VERSION_NUMBER_VAR=${CI_COMMIT_BRANCH}-${CI_BUILD_NUMBER} - - VERSION_BUILD_VAR=${CI_COMMIT_HASH} - secrets: [unity_license] + secrets: + - <<: *secrets_list build-standalone-windows: - image: ${IMAGE}:${UNITY_VERSION}-windows-mono-${IMAGE_VERSION} + image: *win_mono_image commands: - - ${UNITY_DIR}/ci/before_script.sh + - <<: *before_script - chmod +x ./ci/build.sh - ./ci/build.sh environment: + - <<: [*all_env, *build_env] - BUILD_TARGET=StandaloneWindows64 - - VERSION_NUMBER_VAR=${CI_COMMIT_TAG} - - VERSION_BUILD_VAR=${CI_COMMIT_HASH} - secrets: [unity_license] + secrets: + - <<: *secrets_list when: event: tag package: - image: ${IMAGE}:${UNITY_VERSION}-windows-mono-${IMAGE_VERSION} + image: *win_mono_image commands: - - tar -C ${UNITY_DIR}/Builds -cvzf ${CI_COMMIT_TAG}.tar.gz . + - tar -C $UNITY_DIR/Builds -cvzf ${CI_COMMIT_TAG}.tar.gz . when: event: tag publish: @@ -81,3 +84,6 @@ pipeline: base_url: https://git.sunturtle.xyz when: event: tag + +when: + event: [pull_request, tag, deployment]