-
Notifications
You must be signed in to change notification settings - Fork 65
116 lines (109 loc) · 3.64 KB
/
build-snap.yml
File metadata and controls
116 lines (109 loc) · 3.64 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
# This is a basic workflow to help you get started with Actions
name: Build Snap
# Controls when the action will run. Triggers the workflow on push or pull request
# events but only for the master branch
on:
pull_request
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- uses: actions/checkout@v2
- name: Add fake tag to make vergit happy
run: git tag v0.0.0
- uses: snapcore/action-build@v1
id: snap-build
with:
snapcraft-channel: "7.x"
- uses: actions/upload-artifact@v4
with:
name: charm-snap
path: ${{ steps.snap-build.outputs.snap }}
integration:
strategy:
matrix:
charmcraft_channel:
- "2.x/stable"
name: Integration test
needs: build
runs-on: ubuntu-latest
steps:
- name: Init LXD
run: |
set -euxo pipefail
sudo lxd init --auto
# This is a throw-away CI environment, do not do this at home
sudo chmod 666 /var/snap/lxd/common/lxd/unix.socket
# Fixup iptables forwarding issues from LXD containers with a flush and
# re-create of rules.
sudo iptables -F FORWARD
sudo iptables -P FORWARD ACCEPT
- name: Checkout layer-basic
uses: actions/checkout@v2
with:
repository: juju-solutions/layer-basic
- name: Download built charm snap
uses: actions/download-artifact@v4
with:
name: charm-snap
path: tests/charm-minimal/charm-snap
- name: Build reactive charm with charmcraft-2.x
if: ${{ matrix.charmcraft_channel == '2.x/stable' }}
run: |
set -euxo pipefail
sudo snap install --classic --channel ${{ matrix.charmcraft_channel }} charmcraft
cat << EOF | tee tests/charm-minimal/charmcraft.yaml
type: charm
parts:
charm-tools:
plugin: nil
override-build: |
ls -lR \$CRAFT_PROJECT_DIR/
snap install --dangerous --classic /root/project/charm-snap/charm_0.0.0_amd64.snap
rm -rf \$CRAFT_PROJECT_DIR/parts/charm/src/charm-snap
charm:
after: [charm-tools]
source: .
plugin: reactive
reactive-charm-build-arguments:
- -v
- --binary-wheels-from-source
- --ignore-requires-python
build-packages:
- python3-dev
- libpq-dev
bases:
- name: ubuntu
channel: "18.04"
architectures: [amd64]
- name: ubuntu
channel: "20.04"
architectures: [amd64]
- name: ubuntu
channel: "22.04"
architectures: [amd64]
EOF
charmcraft pack -p tests/charm-minimal -v
## action to interactively debug CI failures.
# - name: Setup upterm session
# if: failure()
# uses: lhotari/action-upterm@v1
- name: Upload charmcraft execution logs
if: always()
uses: actions/upload-artifact@v4
with:
name: charmcraft execution logs ${{ matrix.runs-on }}
path: ~/snap/charmcraft/common/cache/charmcraft/log/*.log
- name: Upload built charms
uses: actions/upload-artifact@v4
with:
name: Built charms
overwrite: true
path: |
minimal_ubuntu-18.04-amd64.charm
minimal_ubuntu-20.04-amd64.charm
minimal_ubuntu-22.04-amd64.charm