Skip to content

Commit

Permalink
chore: make skopeo tests optional on non linux/mac
Browse files Browse the repository at this point in the history
  • Loading branch information
lengau committed Jun 10, 2024
1 parent 7e0e259 commit c110cee
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
6 changes: 5 additions & 1 deletion .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,13 @@ jobs:
if: ${{ startsWith(matrix.os, 'ubuntu') }}
run: |
sudo apt update
sudo apt install -y python3-pip python3-setuptools python3-wheel python3-venv libapt-pkg-dev skopeo
sudo apt install -y python3-pip python3-setuptools python3-wheel python3-venv libapt-pkg-dev
export $(cat /etc/os-release | grep VERSION_CODENAME)
pip install -U -r "requirements-${VERSION_CODENAME}.txt"
- name: Install external dependencies with homebrew
if: ${{ runner.os == 'Linux' || runner.os == 'macOS' }}
run: |
brew install skopeo
- name: Configure environment
run: |
python -m pip install tox
Expand Down
2 changes: 1 addition & 1 deletion snap/snapcraft.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -155,7 +155,7 @@ parts:
skopeo: # Copied from Rockcraft
plugin: nil
source: https://github.com/containers/skopeo.git
source-tag: v1.14.2
source-tag: v1.15.1
override-build: |
CGO=1 go build -ldflags -linkmode=external ./cmd/skopeo
mkdir "$CRAFT_PART_INSTALL"/bin
Expand Down
9 changes: 9 additions & 0 deletions tests/unit/utils/test_skopeo.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,21 @@
"""Unit tests for skopeo wrapper."""

import pathlib
import platform
from unittest import mock

import pytest

from charmcraft.utils.skopeo import Skopeo

pytestmark = [
pytest.mark.xfail(
platform.system().lower() not in ("linux", "darwin"),
reason="Don't necessarily have skopeo on non Linux/mac platforms.",
strict=False, # Allow them to pass anyway.
),
]

IMAGE_PATHS = [ # See: https://github.com/containers/skopeo/blob/main/docs/skopeo.1.md#image-names
"containers-storage:my/local:image",
"dir:/tmp/some-dir",
Expand Down

0 comments on commit c110cee

Please sign in to comment.