Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CI migration (octopus) #5

Merged
merged 5 commits into from
May 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 104 additions & 0 deletions .github/workflows/build-and-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
name: Build/Test

on:
workflow_call:

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: python3 -m pip install tox

- name: Run linters
run: tox -e pep8

unit-test:
name: Unit tests
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Install dependencies
run: |
sudo apt-get -qq install libxslt-dev libxml2-dev python3-lxml
python3 -m pip install tox

- name: Run tests
run: tox -e py3

build:
name: Build the charm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 1

- name: Setup LXD
uses: canonical/[email protected]
with:
channel: 5.20/stable

- name: Install dependencies
run: python3 -m pip install tox

- name: Build charm(s)
id: builder
run: |
sudo snap install charmcraft --classic
tox -e build

- name: Upload built charm
uses: actions/upload-artifact@v3
with:
name: charms
path: "*.charm"

functional-test:
needs:
- lint
- unit-test
- build
name: Functional tests
runs-on: self-hosted
steps:

- name: Download charm
uses: actions/download-artifact@v3
with:
name: charms
path: ~/artifacts/

- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Setup LXD
uses: canonical/[email protected]
with:
# pin lxd to LTS release.
channel: 5.21/stable

- name: Install dependencies
run: |
python3 -m pip install tox
if [ ! -d "$HOME/.local/share/juju" ]; then
sudo snap install juju
mkdir -p ~/.local/share/juju
juju bootstrap localhost localhost
fi

- name: Run focal-ussuri tests
run: |
date
mv ~/artifacts/ceph-fs.charm ./
tox -c src -e func-target -- focal-ussuri
8 changes: 8 additions & 0 deletions .github/workflows/pr.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
name: PR

on:
pull_request:

jobs:
build:
uses: ./.github/workflows/build-and-test.yml
10 changes: 6 additions & 4 deletions charmcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,13 @@ parts:
apt-get install ca-certificates -y
tox -e build-reactive
override-stage: |
echo "Copying charm to staging area: $CHARMCRAFT_STAGE"
NAME=$(ls $CHARMCRAFT_PART_BUILD/build/builds)
cp -r $CHARMCRAFT_PART_BUILD/build/builds/$NAME/* $CHARMCRAFT_STAGE/
echo "Copying charm to staging area: $CRAFT_STAGE"
NAME=$(ls $CRAFT_PART_BUILD/build/builds)
cp -r $CRAFT_PART_BUILD/build/builds/$NAME/* $CRAFT_STAGE/
override-prime: |
# For some reason, the normal priming chokes on the fact that there's a
# hooks directory.
cp -r $CHARMCRAFT_STAGE/* .
cp -r $CRAFT_STAGE/* .

bases:
- build-on:
Expand All @@ -30,3 +30,5 @@ bases:
run-on:
- name: ubuntu
channel: "18.04"
- name: ubuntu
channel: "20.04"
13 changes: 3 additions & 10 deletions requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,9 @@
# requirements.txt
setuptools<50.0.0 # https://github.com/pypa/setuptools/commit/04e3df22df840c6bb244e9b27bc56750c44b7c85

cryptography<3.4

# Build requirements
cffi==1.14.6; python_version < '3.6' # cffi 1.15.0 drops support for py35.
charm-tools==2.8.3
git+https://github.com/juju/charm-tools.git

simplejson

# Newer versions use keywords that didn't exist in python 3.5 yet (e.g.
# "ModuleNotFoundError")
# NOTE(lourot): This might look like a duplication of test-requirements.txt but
# some tox targets use only test-requirements.txt whereas charm-build uses only
# requirements.txt
importlib-metadata<3.0.0; python_version < '3.6'
importlib-resources<3.0.0; python_version < '3.6'
4 changes: 2 additions & 2 deletions src/test-requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,5 @@
tox

# Functional Test Requirements (let Zaza's dependencies solve all dependencies here!)
git+https://github.com/openstack-charmers/zaza.git@stable/ussuri#egg=zaza
git+https://github.com/openstack-charmers/zaza-openstack-tests.git@stable/ussuri#egg=zaza.openstack
git+https://github.com/openstack-charmers/zaza.git#egg=zaza
git+https://github.com/openstack-charmers/zaza-openstack-tests.git#egg=zaza.openstack
142 changes: 0 additions & 142 deletions src/tests/bundles/bionic-ussuri.yaml

This file was deleted.

Loading
Loading