snap: add "snap" job to Travis CI

This commit is contained in:
Carlos Hernandez 2019-11-20 13:23:25 -07:00 committed by Justin M. Keyes
parent 86867c2f95
commit 6325ec90dc
5 changed files with 85 additions and 0 deletions

View File

@ -145,6 +145,33 @@ jobs:
env:
- CLANG_SANITIZER=TSAN
- *common-job-env
- if: type != pull
name: snap
os: linux
env:
- LC_ALL: C.UTF-8
- LANG: C.UTF-8
- SNAPCRAFT_ENABLE_SILENT_REPORT: y
- SNAPCRAFT_ENABLE_DEVELOPER_DEBUG: y
addons:
snaps:
- name: snapcraft
channel: stable
classic: true
- name: http
- name: transfer
- name: lxd
channel: stable
before_install: /bin/true
install: ci/snap/install.sh
before_script: echo "Building snap..."
script: ci/snap/script.sh
after_success: ci/snap/after_success.sh
before_cache: /bin/true
deploy:
skip_cleanup: true
provider: script
script: ci/snap/deploy.sh
fast_finish: true
before_install: ci/before_install.sh

19
ci/snap/after_success.sh Executable file
View File

@ -0,0 +1,19 @@
#!/usr/bin/env bash
set -e
set -o pipefail
RESULT_SNAP=$(find ./ -name "*.snap")
sudo snap install "$RESULT_SNAP" --dangerous --classic
/snap/bin/nvim --version
SHA256=$(sha256sum "$RESULT_SNAP")
echo "SHA256: ${SHA256} ."
timeout 240 /snap/bin/transfer "$RESULT_SNAP"
travis_retry bash "${ROOT_PATH}/scripts/services/0x0.st.sh" "${RESULT_SNAP}"

21
ci/snap/deploy.sh Executable file
View File

@ -0,0 +1,21 @@
#!/usr/bin/env bash
set -e
set -o pipefail
# not a tagged release, abort
[[ "$TRAVIS_TAG" != "$TRAVIS_BRANCH" ]] && exit 0
openssl aes-256-cbc -K $encrypted_0a6446eb3ae3_key \
-iv $encrypted_0a6446eb3ae3_iv \
-in .snapcraft/travis_snapcraft.cfg \
-out .snapcraft/snapcraft.cfg -d
SNAP=$(find ./ -name "*.snap")
if [[ "$SNAP" =~ "dirty" || "$SNAP" =~ "nightly" ]]; then
snapcraft push "$SNAP" --release edge
else
snapcraft push "$SNAP" --release candidate
fi

10
ci/snap/install.sh Executable file
View File

@ -0,0 +1,10 @@
#!/usr/bin/env bash
set -e
set -o pipefail
sudo apt update
sudo /snap/bin/lxd.migrate -yes
sudo /snap/bin/lxd waitready
sudo /snap/bin/lxd init --auto

8
ci/snap/script.sh Executable file
View File

@ -0,0 +1,8 @@
#!/usr/bin/env bash
set -e
set -o pipefail
mkdir -p "$TRAVIS_BUILD_DIR/snaps-cache"
sudo snapcraft --use-lxd