diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 5cf27441..ddb16c05 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -87,49 +87,62 @@ lint: tags: - medium -test-linux: + +.test-base: stage: test - extends: - - .rules-branch-manual-MR-and-devel-always - - .after-script-code-coverage script: - make test + +test-linux: + extends: + - .test-base + - .rules-branch-manual-MR-and-devel-always + - .after-script-code-coverage tags: - medium test-linux-race: - stage: test extends: + - test-linux - .rules-branch-and-MR-manual script: - make test-race - tags: - - medium test-integration: - stage: test extends: - - .rules-branch-manual-MR-always + - test-linux script: - make test-integration tags: - large test-integration-race: - stage: test extends: + - test-integration - .rules-branch-and-MR-manual script: - make test-integration-race - tags: - - large -dependency-updates: + +.windows-base: + before_script: + - export GOROOT=/c/Go1.18 + - export PATH=$GOROOT/bin:$PATH + - export GOARCH=amd64 + - export GOPATH=~/go18 + - export GO111MODULE=on + - export PATH=$GOPATH/bin:$PATH + - export MSYSTEM= + tags: + - windows-bridge + +test-windows: + extends: + - .rules-branch-manual-MR-always + - .windows-base stage: test script: - - make updates - - + - make test # Stage: BUILD @@ -145,31 +158,20 @@ dependency-updates: when: manual allow_failure: true - when: never - before_script: - - mkdir -p .cache/bin - - export PATH=$(pwd)/.cache/bin:$PATH - - export GOPATH="$CI_PROJECT_DIR/.cache" - - export PATH=$PATH:$QT6DIR/bin - - $(git config --global -l | grep -o 'url.*gitlab.protontech.ch.*insteadof' | xargs -L 1 git config --global --unset &> /dev/null) || echo "nothing to remove" - - git config --global url.https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}.insteadOf https://${CI_SERVER_HOST} script: - make build - git diff && git diff-index --quiet HEAD - make vault-editor artifacts: - # Note: The latest artifacts for refs are locked against deletion, and kept - # regardless of the expiry time. Introduced in GitLab 13.0 behind a - # disabled feature flag, and made the default behavior in GitLab 13.4. expire_in: 1 day when: always + name: "$CI_JOB_NAME-$CI_COMMIT_SHORT_SHA" paths: - bridge_*.tgz - vault-editor - tags: - - large -build-linux: - extends: .build-base + +.linux-build-setup: image: gitlab.protontech.ch:4567/go/bridge-internal:qt6 variables: VCPKG_DEFAULT_BINARY_CACHE: ${CI_PROJECT_DIR}/.cache @@ -178,19 +180,29 @@ build-linux: paths: - .cache when: 'always' - artifacts: - name: "bridge-linux-$CI_COMMIT_SHORT_SHA" + before_script: + - mkdir -p .cache/bin + - export PATH=$(pwd)/.cache/bin:$PATH + - export GOPATH="$CI_PROJECT_DIR/.cache" + - export PATH=$PATH:$QT6DIR/bin + - $(git config --global -l | grep -o 'url.*gitlab.protontech.ch.*insteadof' | xargs -L 1 git config --global --unset &> /dev/null) || echo "nothing to remove" + - git config --global url.https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}.insteadOf https://${CI_SERVER_HOST} + tags: + - large + +build-linux: + extends: + - .build-base + - .linux-build-setup build-linux-qa: - extends: build-linux + extends: + - build-linux variables: BUILD_TAGS: "build_qa" - artifacts: - name: "bridge-linux-qa-$CI_COMMIT_SHORT_SHA" -.build-darwin-base: - extends: .build-base +.darwin-build-setup: before_script: - export PATH=/usr/local/bin:$PATH - export PATH=/usr/local/opt/git/bin:$PATH @@ -202,30 +214,22 @@ build-linux-qa: - export CGO_CPPFLAGS='-Wno-error -Wno-nullability-completeness -Wno-expansion-to-defined -Wno-builtin-requires-header' - $(git config --global -l | grep -o 'url.*gitlab.protontech.ch.*insteadof' | xargs -L 1 git config --global --unset &> /dev/null) || echo "nothing to remove" - git config --global url.https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}.insteadOf https://${CI_SERVER_HOST} - script: - - go version - - make build-nogui - - git diff && git diff-index --quiet HEAD - - make vault-editor cache: {} tags: - macOS build-darwin: - extends: .build-darwin-base - artifacts: - name: "bridge-darwin-$CI_COMMIT_SHORT_SHA" + extends: + - .build-base + - .darwin-build-setup build-darwin-qa: - extends: .build-darwin-base + extends: + - build-darwin variables: BUILD_TAGS: "build_qa" - artifacts: - name: "bridge-darwin-qa-$CI_COMMIT_SHORT_SHA" - -.build-windows-base: - extends: .build-base +.windows-build-setup: before_script: - export GOROOT=/c/Go1.18/ - export PATH=$GOROOT/bin:$PATH @@ -239,23 +243,19 @@ build-darwin-qa: - export PATH="/c/Program Files/Microsoft Visual Studio/2022/Community/Common7/IDE/CommonExtensions/Microsoft/CMake/CMake/bin:$PATH" - $(git config --global -l | grep -o 'url.*gitlab.protontech.ch.*insteadof' | xargs -L 1 git config --global --unset &> /dev/null) || echo "nothing to remove" - git config --global url.https://gitlab-ci-token:${CI_JOB_TOKEN}@${CI_SERVER_HOST}.insteadOf https://${CI_SERVER_HOST} - script: - - make build-nogui - - git diff && git diff-index --quiet HEAD - - make vault-editor + cache: {} tags: - windows-bridge build-windows: - extends: .build-windows-base - artifacts: - name: "bridge-windows-$CI_COMMIT_SHORT_SHA" + extends: + - .build-base + - .windows-build-setup build-windows-qa: - extends: .build-windows-base + extends: + - build-windows variables: BUILD_TAGS: "build_qa" - artifacts: - name: "bridge-windows-qa-$CI_COMMIT_SHORT_SHA" # TODO: PUT BACK ALL THE JOBS! JUST DID THIS FOR NOW TO GET CI WORKING AGAIN... diff --git a/internal/versioner/version_test.go b/internal/versioner/version_test.go index 26f61718..710c3f09 100644 --- a/internal/versioner/version_test.go +++ b/internal/versioner/version_test.go @@ -109,6 +109,8 @@ func createSignedFiles(t *testing.T, root string, paths ...string) *crypto.KeyRi signFile(t, sumFile.Name(), kr) + require.NoError(t, sumFile.Close()) + return kr }