Skip to content

Commit

Permalink
Merge pull request conda-forge#1502 from conda-forge/check-fork
Browse files Browse the repository at this point in the history
  • Loading branch information
beckermr committed Sep 24, 2021
2 parents 49bfa53 + deeb989 commit 7ccde25
Show file tree
Hide file tree
Showing 12 changed files with 71 additions and 6 deletions.
1 change: 1 addition & 0 deletions conda_smithy/feedstock_content/build-locally.py

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

5 changes: 5 additions & 0 deletions conda_smithy/templates/azure-pipelines-linux.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,11 @@ jobs:
{%- if docker.run_args is defined %}
export CONDA_FORGE_DOCKER_RUN_ARGS="{{ docker.run_args }}"
{%- endif %}
if [[ "${BUILD_REASON:-}" == "PullRequest" ]]; then
export IS_PR_BUILD="True"
else
export IS_PR_BUILD="False"
fi
.scripts/run_docker_build.sh
displayName: Run docker build
env:
Expand Down
5 changes: 5 additions & 0 deletions conda_smithy/templates/azure-pipelines-osx.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,11 @@ jobs:
{%- if upload_on_branch %}
export UPLOAD_ON_BRANCH="{{ upload_on_branch }}"
{%- endif %}
if [[ "${BUILD_REASON:-}" == "PullRequest" ]]; then
export IS_PR_BUILD="True"
else
export IS_PR_BUILD="False"
fi
./.scripts/run_osx_build.sh
displayName: Run OSX build
env:
Expand Down
2 changes: 1 addition & 1 deletion conda_smithy/templates/azure-pipelines-win.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -137,4 +137,4 @@ jobs:
{%- for secret in secrets %}
{{ secret }}: $({{ secret }})
{%- endfor %}
condition: and(succeeded(), not(eq(variables['UPLOAD_PACKAGES'], 'False')))
condition: and(succeeded(), not(eq(variables['UPLOAD_PACKAGES'], 'False')), not(eq(variables['Build.Reason'], 'PullRequest')))
2 changes: 1 addition & 1 deletion conda_smithy/templates/build_steps.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,7 @@ else

( startgroup "Uploading packages" ) 2> /dev/null

if [[ "${UPLOAD_PACKAGES}" != "False" ]]; then
if [[ "${UPLOAD_PACKAGES}" != "False" ]] && [[ "${IS_PR_BUILD}" == "False" ]]; then
upload_package {% if conda_forge_output_validation %}--validate --feedstock-name="${FEEDSTOCK_NAME}" {% endif %}{% if private_upload %} --private{% endif %} "${FEEDSTOCK_ROOT}" "${RECIPE_ROOT}" "${CONFIG_FILE}"
fi

Expand Down
12 changes: 11 additions & 1 deletion conda_smithy/templates/circle.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
machine: true
{%- else %}
macos:
xcode: "9.0"
xcode: "13.0.0"
{%- endif %}
environment:
- CONFIG: "{{ data.config_name }}"
Expand All @@ -43,11 +43,21 @@ jobs:
command: |
export CI=circle
export FEEDSTOCK_NAME=$(basename ${CIRCLE_PROJECT_REPONAME})
if [[ "${CIRCLE_PR_NUMBER:-}" == "" ]]; then
export IS_PR_BUILD="False"
else
export IS_PR_BUILD="True"
fi
./.scripts/run_docker_build.sh
{%- else %}
command: |
export CI=circle
export FEEDSTOCK_NAME=$(basename ${CIRCLE_PROJECT_REPONAME})
if [[ "${CIRCLE_PR_NUMBER:-}" == "" ]]; then
export IS_PR_BUILD="False"
else
export IS_PR_BUILD="True"
fi
./.scripts/run_osx_build.sh
{%- endif %}
{%- if idle_timeout_minutes %}
Expand Down
1 change: 1 addition & 0 deletions conda_smithy/templates/drone.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ steps:
{%- if upload_on_branch %}
- export UPLOAD_ON_BRANCH="{{ upload_on_branch }}"
{%- endif %}
- export IS_PR_BUILD=$(if [[ "$${DRONE_PULL_REQUEST:-}" == "" ]]; then echo "False"; else echo "True"; fi)
- sed -i '$ichown -R conda:conda "$FEEDSTOCK_ROOT"' /opt/docker/bin/entrypoint
- /opt/docker/bin/entrypoint $FEEDSTOCK_ROOT/.scripts/build_steps.sh
- echo "Done building"
Expand Down
19 changes: 18 additions & 1 deletion conda_smithy/templates/github-actions.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -94,6 +94,11 @@ jobs:
docker run --rm --privileged multiarch/qemu-user-static:register --reset --credential yes
export FEEDSTOCK_NAME="$(basename $GITHUB_REPOSITORY)"
export GIT_BRANCH="$(basename $GITHUB_REF)"
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
export IS_PR_BUILD="True"
else
export IS_PR_BUILD="False"
fi
echo "::endgroup::"
./.scripts/run_docker_build.sh
Expand All @@ -113,6 +118,11 @@ jobs:
run: |
export FEEDSTOCK_NAME="$(basename $GITHUB_REPOSITORY)"
export GIT_BRANCH="$(basename $GITHUB_REF)"
if [[ "${GITHUB_EVENT_NAME}" == "pull_request" ]]; then
export IS_PR_BUILD="True"
else
export IS_PR_BUILD="False"
fi
./.scripts/run_osx_build.sh
{%- for choco_pkg in choco %}
Expand Down Expand Up @@ -155,12 +165,19 @@ jobs:
{%- endif %}
set "FEEDSTOCK_NAME=%GITHUB_REPOSITORY:*/=%"
set "GIT_BRANCH=%GITHUB_REF:refs/heads/=%"
if /i "%GITHUB_EVENT_NAME%" == "pull_request" (
set "IS_PR_BUILD=True"
) else (
set "IS_PR_BUILD=False"
)
{%- if conda_forge_output_validation %}
validate_recipe_outputs "%FEEDSTOCK_NAME%"
if errorlevel 1 exit 1
{%- endif %}
if /i "%UPLOAD_PACKAGES%" == "true" (
upload_package {% if conda_forge_output_validation %}--validate --feedstock-name="%FEEDSTOCK_NAME%"{% endif %}{% if private_upload %} --private{% endif %} .\ ".\{{ recipe_dir }}" .ci_support\%CONFIG%.yaml
if /i "%IS_PR_BUILD%" == "false" (
upload_package {% if conda_forge_output_validation %}--validate --feedstock-name="%FEEDSTOCK_NAME%"{% endif %}{% if private_upload %} --private{% endif %} .\ ".\{{ recipe_dir }}" .ci_support\%CONFIG%.yaml
)
)
env:
PYTHONUNBUFFERED: 1
Expand Down
2 changes: 2 additions & 0 deletions conda_smithy/templates/run_docker_build.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,14 @@ fi
( startgroup "Start Docker" ) 2> /dev/null

export UPLOAD_PACKAGES="${UPLOAD_PACKAGES:-True}"
export IS_PR_BUILD="${IS_PR_BUILD:-False}"
{{ docker.executable }} run ${DOCKER_RUN_ARGS} \
-v "${RECIPE_ROOT}":/home/conda/recipe_root:rw,z,delegated \
-v "${FEEDSTOCK_ROOT}":/home/conda/feedstock_root:rw,z,delegated \
-e CONFIG \
-e HOST_USER_ID \
-e UPLOAD_PACKAGES \
-e IS_PR_BUILD \
-e GIT_BRANCH \
-e UPLOAD_ON_BRANCH \
-e CI \
Expand Down
2 changes: 1 addition & 1 deletion conda_smithy/templates/run_osx_build.sh.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ exit 1
{%- else %}
( startgroup "Uploading packages" ) 2> /dev/null

if [[ "${UPLOAD_PACKAGES}" != "False" ]]; then
if [[ "${UPLOAD_PACKAGES}" != "False" ]] && [[ "${IS_PR_BUILD}" == "False" ]]; then
upload_package {% if conda_forge_output_validation %}--validate --feedstock-name="${FEEDSTOCK_NAME}"{% endif %}{% if private_upload %} --private{% endif %} ./ ./{{ recipe_dir }} ./.ci_support/${CONFIG}.yaml
fi

Expand Down
3 changes: 2 additions & 1 deletion conda_smithy/templates/travis.yml.tmpl
Original file line number Diff line number Diff line change
Expand Up @@ -55,9 +55,10 @@ script:
{%- if upload_on_branch %}
- export UPLOAD_ON_BRANCH="{{ upload_on_branch }}"
{%- endif %}
- if [[ "${TRAVIS_PULL_REQUEST:-}" == "false" ]]; then export IS_PR_BUILD="False"; else export IS_PR_BUILD="True"; fi
{% if 'osx' in platformset %}
- if [[ ${PLATFORM} =~ .*osx.* ]]; then {%- if idle_timeout_minutes %} travis_wait {{ idle_timeout_minutes }}{% endif %} ./.scripts/run_osx_build.sh; fi
{%- endif %}
{% if 'linux' in platformset %}
- if [[ ${PLATFORM} =~ .*linux.* ]]; then {%- if idle_timeout_minutes %} travis_wait {{ idle_timeout_minutes }}{% endif %} ./.scripts/run_docker_build.sh; fi
{%- endif %}
{%- endif %}
23 changes: 23 additions & 0 deletions news/is_pr_build.rst
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
**Added:**

* Added explicit check to not upload packages on PR builds.

**Changed:**

* Updated CircleCI xcode version to 13.0.0 to prevent failures.

**Deprecated:**

* <news item>

**Removed:**

* <news item>

**Fixed:**

* <news item>

**Security:**

* <news item>

0 comments on commit 7ccde25

Please sign in to comment.