From d60eb95c520cc6cf8219089b4f707bb2c0c4b10e Mon Sep 17 00:00:00 2001 From: Alex Lowe Date: Wed, 23 Oct 2024 14:29:57 -0400 Subject: [PATCH] ci: rework based on PR feedback --- .github/workflows/cla-check.yaml | 9 ------- .github/workflows/policy.yaml | 7 +++++ .github/workflows/qa.yaml | 44 +++----------------------------- Makefile | 30 +++++++++++----------- 4 files changed, 25 insertions(+), 65 deletions(-) delete mode 100644 .github/workflows/cla-check.yaml create mode 100644 .github/workflows/policy.yaml diff --git a/.github/workflows/cla-check.yaml b/.github/workflows/cla-check.yaml deleted file mode 100644 index cdb271a..0000000 --- a/.github/workflows/cla-check.yaml +++ /dev/null @@ -1,9 +0,0 @@ -name: cla-check -on: [pull_request] - -jobs: - cla-check: - runs-on: ubuntu-latest - steps: - - name: Check if CLA signed - uses: canonical/has-signed-canonical-cla@v1 diff --git a/.github/workflows/policy.yaml b/.github/workflows/policy.yaml new file mode 100644 index 0000000..7484b46 --- /dev/null +++ b/.github/workflows/policy.yaml @@ -0,0 +1,7 @@ +name: Check policy +on: + pull_request: + +jobs: + policy: + uses: lengau/starflow/.github/workflows/policy.yaml@work/CRAFT-3602/test-workflows diff --git a/.github/workflows/qa.yaml b/.github/workflows/qa.yaml index 460a82f..4843d12 100644 --- a/.github/workflows/qa.yaml +++ b/.github/workflows/qa.yaml @@ -11,44 +11,6 @@ on: jobs: lint: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v4 - - name: Run linters - uses: lengau/starflow/lint@work/CRAFT-3602/test-action - unit-tests: - strategy: - matrix: - platform: - - ubuntu-latest - - [noble, arm64] # Self-hosted Ubuntu Noble runner to test arm64 - runs-on: ${{ matrix.platform }} - steps: - - uses: actions/checkout@v4 - - name: Run unit tests with coverage - uses: lengau/starflow/test-python@work/CRAFT-3602/test-action - with: - python-versions: 3.10 3.11 3.12 3.13 - tics-token: ${{ secrets.TICSAUTHTOKEN }} - integration-tests: - strategy: - matrix: - platform: - - ubuntu-latest - runs-on: ${{ matrix.platform }} - steps: - - uses: actions/checkout@v4 - - name: Run integration tests - uses: lengau/starflow/test-python@work/CRAFT-3602/test-action - with: - python-versions: 3.10 3.12 - target: test-integration - lowest-tests: # Run unit and integration tests on the oldest Python available with UV - runs-on: ubuntu-latest - env: - UV_RESOLUTION: lowest - steps: - - uses: actions/checkout@v4 - - uses: lengau/starflow/test-python@work/CRAFT-3602/test-action - with: - python-versions: "3.10" + uses: lengau/starflow/.github/workflows/lint-python.yaml@work/CRAFT-3602/test-workflows + test: + uses: lengau/starflow/.github/workflows/test-python.yaml@work/CRAFT-3602/test-workflows diff --git a/Makefile b/Makefile index 379aa3f..73e96ba 100644 --- a/Makefile +++ b/Makefile @@ -52,7 +52,7 @@ setup-docs: install-uv ##- Set up a documentation-only environment .PHONY: setup-precommit setup-precommit: install-uv ##- Set up pre-commit hooks in this repository. -ifeq ($(shell command -v pre-commit),) +ifeq ($(shell which pre-commit),) uv tool install pre-commit endif pre-commit install @@ -96,7 +96,7 @@ lint-mypy: ##- Check types with mypy .PHONY: lint-pyright lint-pyright: ##- Check types with pyright -ifneq ($(shell command -v pyright),) # Prefer the system pyright +ifneq ($(shell which pyright),) # Prefer the system pyright pyright --pythonpath .venv/bin/python else # Fix for a bug in npm @@ -157,7 +157,7 @@ package-pip: ##- Build packages for pip (sdist, wheel) .PHONY: package-snap package-snap: snap/snapcraft.yaml ##- Build snap package -ifeq ($(shell command -v snapcraft),) +ifeq ($(shell which snapcraft),) sudo snap install --classic snapcraft endif snapcraft pack @@ -184,31 +184,31 @@ clean: ## Clean up the development environment .PHONY: install-uv install-uv: -ifneq ($(shell command -v uv),) -else ifneq ($(shell command -v snap),) +ifneq ($(shell which uv),) +else ifneq ($(shell which snap),) sudo snap install --classic astral-uv -else ifneq ($(shell command -v brew),) +else ifneq ($(shell which brew),) brew install uv else ifeq ($(OS),Windows_NT) - powershell -ExecutionPolicy ByPass -c "irm https://astral.sh/uv/install.ps1 | iex" + pwsh -c "irm https://astral.sh/uv/install.ps1 | iex" else curl -LsSf https://astral.sh/uv/install.sh | sh endif .PHONY: install-codespell install-codespell: -ifneq ($(shell command -v codespell),) -else ifneq ($(shell command -v snap),) +ifneq ($(shell which codespell),) +else ifneq ($(shell which snap),) sudo snap install codespell -else ifneq ($(shell command -v brew),) +else ifneq ($(shell which brew),) make install-uv uv tool install codespell endif .PHONY: install-ruff install-ruff: -ifneq ($(shell command -v ruff),) -else ifneq ($(shell command -v snap),) +ifneq ($(shell which ruff),) +else ifneq ($(shell which snap),) sudo snap install ruff else make install-uv @@ -217,9 +217,9 @@ endif .PHONY: install-shellcheck install-shellcheck: -ifneq ($(shell command -v shellcheck),) -else ifneq ($(shell command -v snap),) +ifneq ($(shell which shellcheck),) +else ifneq ($(shell which snap),) sudo snap install shellcheck -else ifneq ($(shell command -v brew),) +else ifneq ($(shell which brew),) brew install shellcheck endif