| 1 | # Copyright (C) 2018-2020 Brian Douglass |
| 2 | # Copyright (C) 2022 abmyii |
| 3 | # Copyright (C) 2022-2023 Jonatan Hatakeyama Zeidler |
| 4 | # Copyright (C) 2022 Guido Berhoerster |
| 5 | # Copyright (C) 2023 Alexander Richards |
| 6 | # |
| 7 | # SPDX-License-Identifier: GPL-3.0-only |
| 8 | # |
| 9 | # This file is part of Lomiri Calculator App |
| 10 | # |
| 11 | # Lomiri Calculator App is free software: you can redistribute it and/or modify |
| 12 | # it under the terms of the GNU General Public License version 3 as |
| 13 | # published by the Free Software Foundation. |
| 14 | # |
| 15 | # Lomiri Calculator App is distributed in the hope that it will be useful, |
| 16 | # but WITHOUT ANY WARRANTY; without even the implied warranty of |
| 17 | # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
| 18 | # GNU General Public License for more details. |
| 19 | # |
| 20 | # You should have received a copy of the GNU General Public License |
| 21 | # along with this program. If not, see <http://www.gnu.org/licenses/>. |
| 22 | |
| 23 | ############################################################################### |
| 24 | # Define defaults and template anchors |
| 25 | ############################################################################### |
| 26 | variables: |
| 27 | GIT_SUBMODULE_STRATEGY: recursive |
| 28 | DOCKER_DRIVER: overlay2 |
| 29 | CLICKABLE_VERSION: "8" |
| 30 | UT_VERSION: "20.04" |
| 31 | |
| 32 | .node_anchors: |
| 33 | amd64: &amd64 |
| 34 | variables: |
| 35 | ARCH: "amd64" |
| 36 | ARCH_TRIPLET: "x86_64-linux-gnu" |
| 37 | arm64: &arm64 |
| 38 | variables: |
| 39 | ARCH: "arm64" |
| 40 | ARCH_TRIPLET: "aarch64-linux-gnu" |
| 41 | armhf: &armhf |
| 42 | variables: |
| 43 | ARCH: "armhf" |
| 44 | ARCH_TRIPLET: "arm-linux-gnueabihf" |
| 45 | |
| 46 | # https://stackoverflow.com/a/77477765 |
| 47 | workflow: |
| 48 | rules: |
| 49 | - if: $CI_PROJECT_NAMESPACE =~ /^ubports\// |
| 50 | variables: |
| 51 | # Use our own GitLab runner |
| 52 | RUNNER_TAG: "ubports" |
| 53 | - if: $CI_PROJECT_NAMESPACE !~ /^ubports\// |
| 54 | variables: |
| 55 | # Use shared runner if run outside our namespace |
| 56 | RUNNER_TAG: "saas-linux-small-amd64" |
| 57 | |
| 58 | default: |
| 59 | tags: |
| 60 | - $RUNNER_TAG |
| 61 | image: "clickable/ci-$UT_VERSION-$ARCH:$CLICKABLE_VERSION" |
| 62 | |
| 63 | ############################################################################### |
| 64 | # Define stages |
| 65 | ############################################################################### |
| 66 | stages: |
| 67 | - build |
| 68 | - publish |
| 69 | |
| 70 | ############################################################################### |
| 71 | # `build` stage: build clicks for all architectures |
| 72 | ############################################################################### |
| 73 | .build: |
| 74 | stage: build |
| 75 | artifacts: |
| 76 | expire_in: 1 week |
| 77 | paths: |
| 78 | - "build/$ARCH_TRIPLET/app" |
| 79 | script: |
| 80 | - clickable build --clean --accept-review-errors |
| 81 | |
| 82 | build-amd64: |
| 83 | <<: *amd64 |
| 84 | extends: .build |
| 85 | |
| 86 | build-arm64: |
| 87 | <<: *arm64 |
| 88 | extends: .build |
| 89 | |
| 90 | build-armhf: |
| 91 | <<: *armhf |
| 92 | extends: .build |
| 93 | |
| 94 | ############################################################################### |
| 95 | # `publish` stage: upload to OpenStore on tags |
| 96 | ############################################################################### |
| 97 | publish: |
| 98 | <<: *amd64 |
| 99 | stage: publish |
| 100 | artifacts: |
| 101 | expire_in: 1 week |
| 102 | paths: |
| 103 | - build/x86_64-linux-gnu/app/*.click |
| 104 | - build/aarch64-linux-gnu/app/*.click |
| 105 | - build/arm-linux-gnueabihf/app/*.click |
| 106 | rules: |
| 107 | - if: $CI_COMMIT_TAG |
| 108 | script: |
| 109 | - 'clickable publish --arch amd64 -- "$CI_COMMIT_MESSAGE"' |
| 110 | - 'clickable publish --arch arm64' |
| 111 | - 'clickable publish --arch armhf' |
| 112 |