From 88652220329a9da4488ea550ad964426766734cc Mon Sep 17 00:00:00 2001 From: Christian Pauly Date: Sat, 6 Mar 2021 09:33:06 +0100 Subject: [PATCH] CI: Fix snapcraft job --- .gitlab-ci.yml | 93 ++++++++++++++++++---------------- scripts/build-snap.sh | 8 --- scripts/publish-snap-edge.sh | 2 +- scripts/publish-snap-stable.sh | 2 +- 4 files changed, 51 insertions(+), 54 deletions(-) delete mode 100755 scripts/build-snap.sh diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index 1e2e280f..df19098b 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -6,14 +6,14 @@ variables: .shared_windows_runners: tags: - - shared-windows - - windows - - windows-1809 + - shared-windows + - windows + - windows-1809 stages: -- coverage -- release -- deploy + - coverage + - release + - deploy code_analyze: stage: coverage @@ -25,7 +25,8 @@ test: build_web: stage: coverage - before_script: [sudo apt update && sudo apt install curl -y, ./scripts/prepare-web.sh] + before_script: + [sudo apt update && sudo apt install curl -y, ./scripts/prepare-web.sh] script: [./scripts/build-web.sh] artifacts: paths: @@ -44,8 +45,8 @@ build_windows: - cd ..; git clone https://github.com/flutter/flutter.git -b dev; $env:path += ";C:\GitLab-Runner\builds\famedly\flutter\bin"; cd fluffychat - flutter doctor - flutter config --enable-windows-desktop - - "$package_override = \"`r`ndependency_overrides:`r`n intl: 0.17.0-nullsafety.2\"" - - "[System.IO.File]::AppendAllText(\"$CI_PROJECT_DIR/pubspec.yaml\", $package_override, [System.Text.Encoding]::UTF8)" + - '$package_override = "`r`ndependency_overrides:`r`n intl: 0.17.0-nullsafety.2"' + - '[System.IO.File]::AppendAllText("$CI_PROJECT_DIR/pubspec.yaml", $package_override, [System.Text.Encoding]::UTF8)' - flutter clean - flutter pub get - flutter build windows @@ -94,9 +95,9 @@ build_android_appbundle: upload-fdroid: stage: release before_script: - - 'which ssh-agent || (sudo apt-get update -y && sudo apt-get install openssh-client -y )' - - 'which rsync || (sudo apt-get update -y && sudo apt-get install rsync -y )' - - 'which pcregrep || (sudo apt-get update -y && sudo apt-get install pcregrep -y )' + - "which ssh-agent || (sudo apt-get update -y && sudo apt-get install openssh-client -y )" + - "which rsync || (sudo apt-get update -y && sudo apt-get install rsync -y )" + - "which pcregrep || (sudo apt-get update -y && sudo apt-get install pcregrep -y )" - eval $(ssh-agent -s) - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - mkdir -p ~/.ssh @@ -116,9 +117,9 @@ upload-fdroid: upload-fdroid-nightly: stage: release before_script: - - 'which ssh-agent || (sudo apt-get update -y && sudo apt-get install openssh-client -y )' - - 'which rsync || (sudo apt-get update -y && sudo apt-get install rsync -y )' - - 'which pcregrep || (sudo apt-get update -y && sudo apt-get install pcregrep -y )' + - "which ssh-agent || (sudo apt-get update -y && sudo apt-get install openssh-client -y )" + - "which rsync || (sudo apt-get update -y && sudo apt-get install rsync -y )" + - "which pcregrep || (sudo apt-get update -y && sudo apt-get install pcregrep -y )" - eval $(ssh-agent -s) - echo "$SSH_PRIVATE_KEY" | tr -d '\r' | ssh-add - - mkdir -p ~/.ssh @@ -156,7 +157,10 @@ pages: build_linux: stage: coverage - before_script: [sudo apt update && sudo apt install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev -y] + before_script: + [ + sudo apt update && sudo apt install curl clang cmake ninja-build pkg-config libgtk-3-dev libblkid-dev liblzma-dev -y, + ] script: [./scripts/build-linux.sh] artifacts: when: on_success @@ -164,35 +168,36 @@ build_linux: - build/linux/release/bundle/ allow_failure: true -#snap:edge: -# stage: release -# image: "cibuilds/snapcraft:core18" -# variables: -# SNAPCRAFT_LOGIN_FILE: ${SNAPCRAFT_LOGIN_FILE} -# only: -# - main -# script: [./scripts/publish-snap-edge.sh] -# artifacts: -# paths: -# - './*.snap' -# when: on_success -# allow_failure: true +snap:edge: + stage: release + image: "cibuilds/snapcraft:core18" + variables: + SNAPCRAFT_LOGIN_FILE: ${SNAPCRAFT_LOGIN_FILE} + only: + - main + script: [./scripts/publish-snap-edge.sh] + needs: ["build_linux"] + artifacts: + paths: + - "./*.snap" + when: on_success + allow_failure: true -#snap:publish: -# stage: release -# image: "cibuilds/snapcraft:core18" -# variables: -# SNAPCRAFT_LOGIN_FILE: ${SNAPCRAFT_LOGIN_FILE} -# only: -# - tags -# script: [./scripts/publish-snap-stable.sh] -# artifacts: -# paths: -# - './*.snap' -# when: on_success -# expire_in: 1 week -# needs: [] -# allow_failure: true +snap:publish: + stage: release + image: "cibuilds/snapcraft:core18" + variables: + SNAPCRAFT_LOGIN_FILE: ${SNAPCRAFT_LOGIN_FILE} + only: + - tags + script: [./scripts/publish-snap-stable.sh] + needs: ["build_linux"] + artifacts: + paths: + - "./*.snap" + when: on_success + expire_in: 1 week + allow_failure: true update-dependencies: stage: coverage diff --git a/scripts/build-snap.sh b/scripts/build-snap.sh deleted file mode 100755 index 6a3dd823..00000000 --- a/scripts/build-snap.sh +++ /dev/null @@ -1,8 +0,0 @@ -#!/bin/sh -ve -'curl -L $(curl -H "X-Ubuntu-Series: 16" "https://api.snapcraft.io/api/v1/snaps/details/flutter?channel=latest/stable" | jq ".download_url" -r) --output flutter.snap' -sudo mkdir -p /snap/flutter -sudo unsquashfs -d /snap/flutter/current flutter.snap -rm -f flutter.snap -sudo ln -sf /snap/flutter/current/flutter.sh /snap/bin/flutter -sudo ln -sf /snap/flutter/current/env.sh /snap/bin/env.sh -snapcraft diff --git a/scripts/publish-snap-edge.sh b/scripts/publish-snap-edge.sh index 08ad0003..6f81b29d 100755 --- a/scripts/publish-snap-edge.sh +++ b/scripts/publish-snap-edge.sh @@ -1,5 +1,5 @@ #!/bin/sh -ve -/bin/bash ./scripts/build-snap.sh +snapcraft echo $SNAPCRAFT_LOGIN_FILE | base64 --decode --ignore-garbage > snapcraft.login snapcraft login --with snapcraft.login snapcraft push --release=edge *.snap diff --git a/scripts/publish-snap-stable.sh b/scripts/publish-snap-stable.sh index 090f0e69..939d70d0 100755 --- a/scripts/publish-snap-stable.sh +++ b/scripts/publish-snap-stable.sh @@ -1,5 +1,5 @@ #!/bin/sh -ve -/bin/bash ./scripts/build-snap.sh +snapcraft echo $SNAPCRAFT_LOGIN_FILE | base64 --decode --ignore-garbage > snapcraft.login snapcraft login --with snapcraft.login snapcraft push --release=stable *.snap