← Back to team overview

canonical-ubuntu-qa team mailing list archive

[Merge] ~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud-2:add_charms_to_pipeline into autopkgtest-cloud:master

 

Tim Andersson has proposed merging ~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud-2:add_charms_to_pipeline into autopkgtest-cloud:master.

Commit message:
update .launchpad.yaml to pack the charms before linting

Requested reviews:
  Canonical's Ubuntu QA (canonical-ubuntu-qa)

For more details, see:
https://code.launchpad.net/~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud-2/+merge/444026

update .launchpad.yaml to pack the charms before linting
-- 
Your team Canonical's Ubuntu QA is requested to review the proposed merge of ~andersson123/autopkgtest-cloud/+git/autopkgtest-cloud-2:add_charms_to_pipeline into autopkgtest-cloud:master.
diff --git a/.launchpad.yaml b/.launchpad.yaml
index f812f7e..68cbf20 100755
--- a/.launchpad.yaml
+++ b/.launchpad.yaml
@@ -1,8 +1,16 @@
 pipeline:
   - readthedocs_build
+  - build_charms
   - lint_test
 
 jobs:
+  build_charms:
+    series: focal
+    architectures: amd64
+    packages: [git]
+    snaps:
+      - name: charmcraft
+    run: ./ci/build_charms
   lint_test:
     series: focal
     architectures: amd64
diff --git a/ci/build_charms b/ci/build_charms
new file mode 100755
index 0000000..ee9abf6
--- /dev/null
+++ b/ci/build_charms
@@ -0,0 +1,20 @@
+#!/bin/bash
+
+LATEST_COMMIT=$(git log --format="%H" -n 1)
+LIST_OF_CHANGES=$(git diff-tree --no-commit-id --name-only "${LATEST_COMMIT}" -r)
+
+printf "Building charms..."
+
+if [[ "${LIST_OF_CHANGES}" =~ .*"charms/".* ]]; then
+    printf "Changes to charms made in latest commit."
+    charmcraft pack --destructive-mode -v -p charms/focal/autopkgtest-cloud-worker/
+    charmcraft pack --destructive-mode -v -p charms/focal/autopkgtest-web/
+    if test -f "autopkgtest-cloud-worker_ubuntu-20.04-amd64.charm" && test -f "autopkgtest-web_ubuntu-20.04-amd64.charm"; then
+        printf "Charms built successfully"
+    else
+        printf "Charms didn't build!"
+        exit 1
+    fi
+else
+    printf "No changes to charms, not building..."
+fi