Fix 1.19 build #2882
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Tests | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
jobs: | |
linters: | |
runs-on: ubuntu-20.04 | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Install python packages and dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y libapt-pkg-dev | |
pip install -U \ | |
https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python-distutils-extra/2.43/python-distutils-extra_2.43.tar.xz \ | |
https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python-apt/2.0.0ubuntu0.20.04.6/python-apt_2.0.0ubuntu0.20.04.6.tar.xz \ | |
.[dev] | |
- name: Run black | |
run: | | |
make test-black | |
- name: Run codespell | |
run: | | |
make test-codespell | |
- name: Run ruff | |
run: | | |
make test-ruff | |
- name: Run isort | |
run: | | |
make test-isort | |
- name: Run mypy | |
run: | | |
make test-mypy | |
- name: Run pydocstyle | |
run: | | |
make test-pydocstyle | |
- name: Run pylint | |
run: | | |
make test-pylint | |
- name: Run pyright | |
run: | | |
sudo snap install --classic node --channel=18/stable | |
sudo snap install --classic pyright --revision=575 | |
make test-pyright | |
tests: | |
strategy: | |
matrix: | |
os: [ubuntu-20.04] | |
python-version: ["3.7", "3.8", "3.9", "3.10"] | |
include: | |
- adjective: focal | |
- os: ubuntu-22.04 | |
python-version: "3.10" | |
adjective: jammy | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
with: | |
fetch-depth: 0 | |
- name: Set up Python | |
uses: actions/setup-python@v2 | |
with: | |
python-version: ${{ matrix.python-version }} | |
- name: Install apt build dependencies | |
run: | | |
sudo apt update | |
sudo apt install -y libapt-pkg-dev intltool fuse-overlayfs | |
- name: Install python-apt dependencies | |
run: | | |
pip install https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python-distutils-extra/2.43/python-distutils-extra_2.43.tar.xz | |
pip install https://launchpad.net/ubuntu/+archive/primary/+sourcefiles/python-apt/2.0.0ubuntu0.20.04.6/python-apt_2.0.0ubuntu0.20.04.6.tar.xz | |
- name: Install general python dependencies | |
run: | | |
pip install .[dev] | |
pip install -e . | |
- name: Install additional test dependencies | |
run: | | |
sudo apt install -y ninja-build cmake scons | |
# Build Chisel: needs a version of go than is available in Ubuntu 20.04 | |
sudo snap install --classic --channel=1.20/stable go | |
git clone https://github.com/canonical/chisel.git chisel-tmp | |
cd chisel-tmp && git checkout v0.10.0 | |
go mod download | |
sudo go build -o /usr/bin ./... | |
chisel --help | |
# Remove newer go and install regular version for 20.04 | |
sudo snap remove go | |
sudo apt install -y golang | |
# Install RPM dependencies for RPM tests | |
sudo apt install rpm | |
# Ensure we don't have dotnet installed, to properly test dotnet-deps | |
# Based on https://github.com/actions/runner-images/blob/main/images/linux/scripts/installers/dotnetcore-sdk.sh | |
sudo apt remove -y dotnet-* || true | |
# Remove manually-installed dotnet from tarballs | |
sudo rm -rf /usr/share/dotnet | |
# Remove dotnet tools | |
rm -rf $HOME/.dotnet | |
- name: specify node version | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
- name: Run unit tests | |
run: | | |
make test-units | |
- name: Run integration tests | |
run: | | |
make test-integrations | |
- name: Run overlay smoke test | |
if: ${{ matrix.adjective == 'focal' }} #TODO: fix this smoke test for jammy | |
run: | | |
wget -q https://cloud-images.ubuntu.com/${{ matrix.adjective }}/current/${{ matrix.adjective }}-server-cloudimg-amd64.squashfs | |
mkdir base | |
sudo mount -t squashfs ${{ matrix.adjective }}-server-cloudimg-amd64.squashfs base/ | |
cat <<-EOF > parts.yaml | |
parts: | |
foo: | |
plugin: nil | |
overlay-packages: [hello] | |
overlay-script: | | |
chroot "\$CRAFT_OVERLAY" /bin/bash -c "hello > hello.txt" | |
echo 1234 > "\$CRAFT_OVERLAY/etc/issue" | |
overlay: | |
- "*.txt" | |
- etc | |
- usr/bin | |
bar: | |
plugin: nil | |
after: [foo] | |
overlay-packages: [bison] | |
overlay-script: | | |
chroot "\$CRAFT_OVERLAY" /bin/bash -c "rm -Rf /etc/shells /etc/ssh && mkdir /etc/ssh" | |
echo 5678 > "\$CRAFT_OVERLAY/etc/issue" | |
overlay: | |
- -usr/share | |
- -var/cache | |
override-build: | | |
rev "\$CRAFT_OVERLAY/hello.txt" > "\$CRAFT_PART_INSTALL/olleh.txt" | |
EOF | |
python_exe=$(command -v python) | |
cat <<-EOF > run.sh | |
echo "--- overlay foo" | |
"${python_exe}" -mcraft_parts --work-dir=work --trace --overlay-base=base --refresh overlay foo | |
echo "--- next actions plan" | |
"${python_exe}" -mcraft_parts --work-dir=work --overlay-base=base --dry-run --show-skipped | |
echo "--- next actions execution" | |
"${python_exe}" -mcraft_parts --work-dir=work --trace --overlay-base=base | |
EOF | |
echo "--- parts.yaml:" | |
cat parts.yaml | |
sudo bash -xe run.sh | |
echo "* Check if hello executables installed" | |
test -x work/prime/usr/bin/hello && echo "hello" | |
test -x work/prime/usr/bin/bison && echo "bison" | |
test -x work/prime/usr/bin/m4 && echo "m4" | |
echo "* Check if /usr/bin/yacc is a symbolic link" | |
test -L work/prime/usr/bin/yacc && ls -l work/prime/usr/bin/yacc | |
echo "* Check if docs excluded" | |
test ! -d work/usr/share/doc/hello && echo "hello" | |
test ! -d work/usr/share/doc/bison && echo "bison" | |
echo "* Check created files" | |
grep "!dlrow ,olleH" work/prime/olleh.txt | |
grep "Hello, world!" work/prime/hello.txt | |
grep 5678 work/prime/etc/issue | |
echo "* Check whiteout files" | |
test -f work/prime/etc/.wh.shells && echo "/etc/shells" | |
test -f work/prime/etc/ssh/.wh..wh.opq && echo "/etc/ssh" | |
echo "--- prime files:" | |
find work/prime |