diff --git a/.github/actions/setup-go/action.yaml b/.github/actions/setup-dev/action.yaml similarity index 52% rename from .github/actions/setup-go/action.yaml rename to .github/actions/setup-dev/action.yaml index d9d45745c..357124fe4 100644 --- a/.github/actions/setup-go/action.yaml +++ b/.github/actions/setup-dev/action.yaml @@ -1,5 +1,5 @@ # -# Copyright (c) 2025 Red Hat Inc. +# Copyright (c) 2026 Red Hat Inc. # # Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except # in compliance with the License. You may obtain a copy of the License at @@ -12,17 +12,17 @@ # the License. # -name: Setup Go -description: Install and Go and Ginkgo +name: Setup development tools runs: using: composite steps: + + # Go and Ginkgo: - uses: actions/setup-go@4a3601121dd01d1626a1e23e37211e3254c1c06c # v6 with: go-version: '1.26.2' - shell: bash - run: | - go mod download + run: go mod download - id: ginkgo-cache uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 with: @@ -34,3 +34,25 @@ runs: module="github.com/onsi/ginkgo/v2" version=$(go list -f '{{ .Version }}' -m "${module}") go install "${module}/ginkgo@${version}" + + # Python, uv, and ruff: + - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 + with: + python-version: '3.14' + - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 + - shell: bash + run: uv tool install ruff==0.15.16 + + # Project-specific tools installed by 'dev.py'. The cache key includes the hash of 'dev/tools.py' + # because that file defines the tool names, versions, and checksums. Any change there means + # different binaries should be installed. + - id: dev-cache + uses: actions/cache@27d5ce7f107fe9357f9df03efb73ab90386fccae # v5 + with: + key: dev-${{ runner.os }}-${{ hashFiles('dev/tools.py') }} + path: bin + - if: steps.dev-cache.outputs.cache-hit != 'true' + shell: bash + run: uv run dev.py setup + - shell: bash + run: echo "${GITHUB_WORKSPACE}/bin" >> "${GITHUB_PATH}" diff --git a/.github/actions/setup-python/action.yaml b/.github/actions/setup-python/action.yaml deleted file mode 100644 index 406d96ff4..000000000 --- a/.github/actions/setup-python/action.yaml +++ /dev/null @@ -1,25 +0,0 @@ -# -# Copyright (c) 2026 Red Hat Inc. -# -# Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except -# in compliance with the License. You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software distributed under the License -# is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express -# or implied. See the License for the specific language governing permissions and limitations under -# the License. -# - -name: Setup Python -description: Install Python, uv, and ruff -runs: - using: composite - steps: - - uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6 - with: - python-version: '3.14' - - uses: astral-sh/setup-uv@fac544c07dec837d0ccb6301d7b5580bf5edae39 # v8.2.0 - - shell: bash - run: uv tool install ruff==0.15.16 diff --git a/.github/workflows/check-pull-request.yaml b/.github/workflows/check-pull-request.yaml index 93967f0b9..707b3bf19 100644 --- a/.github/workflows/check-pull-request.yaml +++ b/.github/workflows/check-pull-request.yaml @@ -43,7 +43,7 @@ jobs: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: persist-credentials: false - - uses: ./.github/actions/setup-python + - uses: ./.github/actions/setup-dev - run: uv run ruff check check-go-code: @@ -53,11 +53,8 @@ jobs: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: persist-credentials: false - - uses: ./.github/actions/setup-go - - uses: ./.github/actions/setup-python - - run: | - uv run dev.py setup - uv run dev.py lint + - uses: ./.github/actions/setup-dev + - run: uv run dev.py lint check-generated-code: name: Check generated code @@ -81,9 +78,8 @@ jobs: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: persist-credentials: false - - uses: ./.github/actions/setup-go - - run: | - ginkgo run --timeout 1h -r internal + - uses: ./.github/actions/setup-dev + - run: ginkgo run --timeout 1h -r internal build-binaries: name: Build binaries @@ -92,7 +88,7 @@ jobs: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: persist-credentials: false - - uses: ./.github/actions/setup-go + - uses: ./.github/actions/setup-dev - uses: goreleaser/goreleaser-action@5daf1e915a5f0af01ddbcd89a43b8061ff4f1a89 # v7 with: args: build --snapshot --clean @@ -104,7 +100,7 @@ jobs: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: persist-credentials: false - - uses: ./.github/actions/setup-go + - uses: ./.github/actions/setup-dev - run: | echo '127.0.0.1 fulfillment-api.osac.svc.cluster.local' | sudo tee -a /etc/hosts echo '127.0.0.1 fulfillment-internal-api.osac.svc.cluster.local' | sudo tee -a /etc/hosts @@ -124,7 +120,7 @@ jobs: - uses: actions/checkout@df4cb1c069e1874edd31b4311f1884172cec0e10 # v6 with: persist-credentials: false - - uses: ./.github/actions/setup-go + - uses: ./.github/actions/setup-dev - run: | echo '127.0.0.1 fulfillment-api.osac.svc.cluster.local' | sudo tee -a /etc/hosts echo '127.0.0.1 fulfillment-internal-api.osac.svc.cluster.local' | sudo tee -a /etc/hosts