Skip to content

Commit

Permalink
Review builds for pull requests. (conda#11135)
Browse files Browse the repository at this point in the history
  • Loading branch information
jezdez authored Jan 27, 2022
1 parent b0b5c68 commit fc56fde
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 81 deletions.
81 changes: 0 additions & 81 deletions .github/workflows/build-upload-pkgs.yaml

This file was deleted.

41 changes: 41 additions & 0 deletions .github/workflows/builds-canary.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Canary builds

on:
workflow_run:
workflows:
- CI tests
branches:
- master
types:
- completed

jobs:
build:
if: github.event.workflow_run.conclusion == 'success'
strategy:
matrix:
include:
- runner: ubuntu-latest
subdir: linux-64
- runner: macos-latest
subdir: osx-64
- runner: windows-latest
subdir: win-64
runs-on: ${{ matrix.runner }}
steps:
# Clean checkout of specific git ref needed for package metadata version
# which needs env vars GIT_DESCRIBE_TAG and GIT_BUILD_STR:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
clean: true
fetch-depth: 0

- name: Create and upload canary build
uses: conda/actions/[email protected]
with:
package-name: conda
subdir: ${{ matrix.subdir }}
anaconda-org-channel: conda-canary
anaconda-org-label: dev
anaconda-org-token: ${{ secrets.ANACONDA_ORG_TOKEN }}
71 changes: 71 additions & 0 deletions .github/workflows/builds-review.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
name: Review builds

on:
pull_request:
types:
- labeled

jobs:
build:
if: |
github.event_name == 'pull_request' &&
github.event.label.name == 'build::review'
strategy:
matrix:
include:
- runner: ubuntu-latest
subdir: linux-64
- runner: macos-latest
subdir: osx-64
- runner: windows-latest
subdir: win-64
runs-on: ${{ matrix.runner }}
steps:
- name: Check current actor
id: in_team
uses: conda/actions/[email protected]
with:
org: conda
team: conda-core
user: ${{ github.actor }}

- name: Remove build label
uses: actions/github-script@v5
with:
github-token: ${{ secrets.CANARY_ACTION_TOKEN }}
script: |
const { data: pullRequest } = await github.rest.pulls.get({
...context.repo,
pull_number: context.issue.number,
})
const buildLabel = '${{ github.event.label.name }}'
const labels = pullRequest.labels.map(label => label.name)
const hasBuildLabel = labels.includes(buildLabel)
if (hasBuildLabel) {
await github.rest.issues.removeLabel({
...context.repo,
issue_number: context.issue.number,
name: buildLabel,
})
}
# Clean checkout of specific git ref needed for package metadata version
# which needs env vars GIT_DESCRIBE_TAG and GIT_BUILD_STR:
- uses: actions/checkout@v2
with:
ref: ${{ github.ref }}
clean: true
fetch-depth: 0

- name: Create and upload review build
if: steps.in_team.outputs.contains == 'true'
uses: conda/actions/[email protected]
with:
package-name: conda
subdir: ${{ matrix.subdir }}
anaconda-org-channel: conda-canary
anaconda-org-label: '${{ github.repository_owner }}-${{ github.event.repository.name }}-pr-${{ github.event.number }}'
anaconda-org-token: ${{ secrets.ANACONDA_ORG_TOKEN }}
comment-headline: 'Review build status'
comment-token: ${{ secrets.CANARY_ACTION_TOKEN }}

0 comments on commit fc56fde

Please sign in to comment.