diff --git a/.github/actions/check-allow-dev-deps/action.yml b/.github/actions/check-allow-dev-deps/action.yml new file mode 100644 index 000000000000..cc3ada68e01c --- /dev/null +++ b/.github/actions/check-allow-dev-deps/action.yml @@ -0,0 +1,34 @@ +name: "Install chia-blockchain" + +description: "Check if dev deps should be allowed." + +inputs: + fail-on-result: + description: "Fail if the output is equal to this." + required: false + default: "" +outputs: + allow: + description: "" + value: ${{ steps.check-allow-dev-deps.allow }} + +runs: + using: "composite" + steps: + - name: Check allow dev deps + id: check-allow-dev-deps + shell: bash + run: | + if grep 'git =' pyproject.toml &> /dev/null + then + ALLOW="${{ startsWith(github.ref, 'refs/heads/long_lived/') || startsWith(github.event.pull_request.base.ref, 'refs/heads/long_lived/') || contains( github.event.pull_request.labels.*.name, 'allow-dev-deps') }}" + else + ALLOW="false" + fi + echo "allow=${ALLOW}" >> "$GITHUB_OUTPUT" + + - name: maybe fail + if: inputs.fail-on-result == steps.check-allow-dev-deps.outputs.allow + shell: bash + run: | + false diff --git a/.github/actions/install/action.yml b/.github/actions/install/action.yml index 5974d171cd61..3f8e4b4caea4 100644 --- a/.github/actions/install/action.yml +++ b/.github/actions/install/action.yml @@ -39,6 +39,13 @@ inputs: runs: using: "composite" steps: + - uses: ./.github/actions/check-allow-dev-deps + id: check-allow-dev-deps + + - name: Set up rust + if: ${{ steps.check-allow-dev-deps.outputs.allow == 'true' }} + uses: dtolnay/rust-toolchain@stable + - name: Run install script (macOS, Ubuntu) if: runner.os == 'macos' || runner.os == 'linux' shell: bash diff --git a/.github/workflows/check_wheel_availability.yaml b/.github/workflows/check_wheel_availability.yaml index 6924efd1d88f..46442a21dc15 100644 --- a/.github/workflows/check_wheel_availability.yaml +++ b/.github/workflows/check_wheel_availability.yaml @@ -17,8 +17,12 @@ concurrency: cancel-in-progress: true jobs: + check-allow-dev-deps: + uses: ./.github/workflows/reflow-check-allow-dev-deps.yml + check_dependency_artifacts: name: ${{ matrix.os.name }} ${{ matrix.arch.name }} ${{ matrix.python-version }} + needs: check-allow-dev-deps runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }} strategy: fail-fast: false diff --git a/.github/workflows/reflow-check-allow-dev-deps.yml b/.github/workflows/reflow-check-allow-dev-deps.yml new file mode 100644 index 000000000000..4bf0ff61997b --- /dev/null +++ b/.github/workflows/reflow-check-allow-dev-deps.yml @@ -0,0 +1,20 @@ +name: 🚨 Check allow-dev-deps label + +on: + workflow_call: + +concurrency: + # SHA is added to the end if on `main` to let all main workflows run + group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} + cancel-in-progress: true + +jobs: + check-labels: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: ./.github/actions/check-allow-dev-deps + id: check-allow-dev-deps + with: + fail-on-result: "true" diff --git a/.github/workflows/test-install-scripts.yml b/.github/workflows/test-install-scripts.yml index 03e01458188f..0067f7f894e0 100644 --- a/.github/workflows/test-install-scripts.yml +++ b/.github/workflows/test-install-scripts.yml @@ -21,8 +21,12 @@ concurrency: cancel-in-progress: true jobs: + check-allow-dev-deps: + uses: ./.github/workflows/reflow-check-allow-dev-deps.yml + test_scripts: name: Native ${{ matrix.os.emoji }} ${{ matrix.arch.emoji }} ${{ matrix.development.name }} - ${{ matrix.editable.name }} + needs: check-allow-dev-deps runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }} strategy: fail-fast: false @@ -134,6 +138,7 @@ jobs: test_scripts_in_docker: name: Docker ${{ matrix.distribution.name }} ${{ matrix.arch.name }} + if: ${{ !contains( github.event.pull_request.labels.*.name, 'allow-dev-deps') }} runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }} container: ${{ matrix.distribution.url }} strategy: