From fa8386150160de394363028c5d593dd61010f1d7 Mon Sep 17 00:00:00 2001 From: YoshiRulz Date: Sun, 11 Oct 2020 05:24:46 +1000 Subject: [PATCH] More GitLab CI changes * Revert 21a476200 ("Add timestamp update step", which was ineffective) * Use `needs` to declare job dependency graph * Replace Docker image for Ubuntu w/ minimal Debian image * Add `build_ext_tools` job (scheduled pipelines only) * Rename `package` job to `package_windows` and add `package_linux` (runs the same script but then makes a `.tar` which becomes `.tar.zip`) * Misc. cleanup --- .gitlab-ci.yml | 63 +++++++++++++++++++++++++++++++++++++++++-------- Dist/Package.sh | 1 - 2 files changed, 53 insertions(+), 11 deletions(-) diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index d68ec91221..2cc839e10a 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,4 +1,6 @@ -image: mcr.microsoft.com/dotnet/core/sdk:3.1 +variables: + CI_HAWK_ARTIFACT_NAME: "BizHawk_devbuild_${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}" + CI_HAWK_TMPARTIFACT_NAME: "BizHawk_tempbuild_${CI_COMMIT_REF_SLUG}_${CI_COMMIT_SHORT_SHA}" stages: - build @@ -8,32 +10,71 @@ stages: build: artifacts: expire_in: "30 minutes" - name: "BizHawk_tempbuild_${CI_COMMIT_REF_SLUG}_$CI_COMMIT_SHORT_SHA" + name: "$CI_HAWK_TMPARTIFACT_NAME" paths: - output - - test_output + image: mcr.microsoft.com/dotnet/core/sdk:3.1 script: - if [ "$CI_COMMIT_REF_SLUG" == "release" ]; then Dist/UpdateVersionInfoForRelease.sh; fi - Dist/BuildRelease.sh stage: build -check_style: +build_ext_tools: allow_failure: true - dependencies: [] + image: mcr.microsoft.com/dotnet/core/sdk:3.1 + needs: + - build rules: - - if: '$BIZHAWKBUILD_USE_ANALYZERS != null' + - if: '$CI_PIPELINE_SOURCE == "schedule"' when: always + script: + - for d in $CI_PROJECT_DIR/ExternalToolProjects/*; do if [ -d "$d" ]; then cd "$d" && ./build_release.sh; fi; done + stage: test + +check_style: + image: mcr.microsoft.com/dotnet/core/sdk:3.1 + needs: + - job: build + artifacts: false + rules: + - if: '$CI_PIPELINE_SOURCE == "schedule"' + when: always + allow_failure: true + - if: $BIZHAWKBUILD_USE_ANALYZERS != null + when: always + allow_failure: false script: - Dist/BuildRelease.sh -p:MachineRunAnalyzersDuringBuild=true || Dist/BuildRelease.sh -p:MachineRunAnalyzersDuringBuild=true stage: test -package: +package_linux: artifacts: expire_in: "1 month" - name: "BizHawk_devbuild_${CI_COMMIT_REF_SLUG}_$CI_COMMIT_SHORT_SHA" + name: "$CI_HAWK_ARTIFACT_NAME.tar" + paths: + - "$CI_HAWK_ARTIFACT_NAME.tar" + image: debian:buster-slim + needs: + - build + rules: + - if: '$CI_COMMIT_REF_SLUG == "master" || $CI_COMMIT_REF_SLUG == "release"' + when: always + script: + - su -c "apt-get update && apt-get -y install p7zip-full" + - Dist/Package.sh + - cd packaged_output + - tar -cf "../$CI_HAWK_ARTIFACT_NAME.tar" * + stage: package + +package_windows: + artifacts: + expire_in: "1 month" + name: "$CI_HAWK_ARTIFACT_NAME" paths: - ./* - image: ubuntu:focal + image: debian:buster-slim + needs: + - build rules: - if: '$CI_COMMIT_REF_SLUG == "master" || $CI_COMMIT_REF_SLUG == "release"' when: always @@ -54,8 +95,10 @@ run_tests: reports: junit: - test_output/*.coverage.xml - dependencies: [] image: mcr.microsoft.com/dotnet/core/sdk:3.1 + needs: + - job: build + artifacts: false script: - Dist/BuildTestRelease.sh || Dist/BuildTestRelease.sh stage: test diff --git a/Dist/Package.sh b/Dist/Package.sh index 0d5f7768ad..fb2bd4518d 100755 --- a/Dist/Package.sh +++ b/Dist/Package.sh @@ -6,5 +6,4 @@ find "output" -type f \( -wholename "output/EmuHawk.exe" -o -wholename "output/D find "packaged_output/dll" -type f -name "*.xml" -exec rm "{}" \; mkdir "packaged_output/Firmware" cd "packaged_output/gamedb" && 7za a -t7z -mx9 "NesCarts.7z" "NesCarts.xml" && rm "NesCarts.xml" && cd "../.." -find "packaged_output" -type d -exec touch {} \; # no idea why, but some of the access timestamps are in the far future, and Mono crashes when enumerating the exe dir find "packaged_output" -type f -name "*.sh" -exec chmod +x {} \; # installed with -m644 but needs to be 755