Skip to content

Commit

Permalink
workflow test
Browse files Browse the repository at this point in the history
  • Loading branch information
martinpitt committed Mar 16, 2024
1 parent aa49868 commit 9f5b10f
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 6 deletions.
16 changes: 12 additions & 4 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,10 @@ jobs:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y make python3-pyflakes python3-pycodestyle
sudo apt-get install -y make python3-pyflakes python3-pycodestyle python3-pip
sudo pip install .[test]
- name: Run unit tests
- name: Run lint tests
run: make check

tasks:
Expand All @@ -35,6 +36,12 @@ jobs:
git config user.email github-actions@github.com
git rebase origin/main
- name: Install test dependencies
run: |
sudo apt-get update
sudo apt-get install -y make python3-pyflakes python3-pycodestyle python3-pip python3-pytest
sudo pip install .[test]
# HACK: Ubuntu 22.04 has podman 3.4, which isn't compatible with podman-remote 4 in our tasks container
# This PPA is a backport of podman 4.3 from Debian 12; drop this when moving `runs-on:` to ubuntu-24.04
- name: Update to newer podman
Expand All @@ -57,6 +64,7 @@ jobs:

- name: Test local deployment
run: |
echo '${{ secrets.GITHUB_TOKEN }}' > ~/.config/github-token
echo '${{ secrets.GITHUB_TOKEN }}' > github-token
PRN=$(echo "$GITHUB_REF" | cut -f3 -d '/')
tasks/run-local.sh -p $PRN -t ~/.config/github-token
# tasks/run-local.sh -p $PRN -t ~/.config/github-token
python3 -m pytest --github-token=github-token
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ all:
check:
python3 -m pyflakes tasks tasks/container/webhook
python3 -m pycodestyle --max-line-length=120 --ignore=E722 tasks tasks/container/webhook
if command -v mypy >/dev/null; then mypy tests; fi
if command -v ruff >/dev/null; then ruff check tests; fi
if command -v mypy >/dev/null; then mypy tests; else echo "SKIP: mypy not installed"; fi
if command -v ruff >/dev/null; then ruff check tests; else echo "SKIP: ruff not installed"; fi

TAG := $(shell date --iso-8601)
TASK_SECRETS := /var/lib/cockpit-secrets/tasks
Expand Down
2 changes: 2 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ version = "1"

[project.optional-dependencies]
test = [
"ruff",
"mypy",
"pytest",
"pytest_container",
"types-PyYAML",
Expand Down

0 comments on commit 9f5b10f

Please sign in to comment.