blob: 715dc618704788e6f45f06e6a8c1bedf339c85fa [file] [edit]
name: Canary
on:
workflow_call:
inputs:
repos_file:
description: 'Path to the file containing the list of repository names'
type: string
required: true
local_debug:
description: Whether to use a local version of ecosystem testing - only for debug
default: false
type: boolean
required: false
jobs:
test:
permissions:
pull-requests: write
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0
with:
token: ${{ secrets.GITHUB_TOKEN }}
- uses: actions/cache@55cc8345863c7cc4c66a329aec7e433d2d1c52a9
with:
path: ~/.pub-cache
key: ${{ runner.os }}-pub-cache-${{ hashFiles('**/pubspec.lock') }}
restore-keys: |
${{ runner.os }}-pub-cache-
- uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2
with:
channel: main
cache: true
- run: echo "$LABELS_JSON"
env:
LABELS_JSON: ${{ toJSON(github.event.pull_request.labels.*.name) }}
- name: Install local version of `package:canary`
run: dart pub global activate -s path pkgs/canary
if: ${{ inputs.local_debug }}
- run: dart pub global activate -s git https://github.com/dart-lang/ecosystem.git --git-ref main --git-path pkgs/canary
if: ${{ !inputs.local_debug }}
- name: Update package and test
run: |
dart pub global run canary "$INPUTS_REPOS_FILE" "$GITHUB_REPOSITORY_URL" "$HEAD_REF" "$LABELS_JSON"
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUTS_REPOS_FILE: ${{ inputs.repos_file }}
GITHUB_REPOSITORY_URL: ${{ github.event.pull_request.head.repo.clone_url || github.repositoryUrl }}
HEAD_REF: ${{ github.head_ref || github.ref_name }}
LABELS_JSON: ${{ toJSON(github.event.pull_request.labels.*.name) }}
- name: Output issue number
env:
ISSUE_NUMBER: ${{ github.event.number }}
run: |
mkdir -p output
echo "$ISSUE_NUMBER" > output/issueNumber
- name: Install firehose (internal)
if: github.repository == 'dart-lang/ecosystem'
env:
GIT_URL: ${{ github.event.pull_request.head.repo.clone_url || 'https://github.com/dart-lang/ecosystem' }}
HEAD_REF: ${{ github.head_ref || github.ref_name }}
run: dart pub global activate --source git "$GIT_URL" --git-path pkgs/firehose/ --git-ref "$HEAD_REF"
- name: Install firehose (external)
if: github.repository != 'dart-lang/ecosystem'
run: dart pub global activate --source git https://github.com/dart-lang/ecosystem --git-path pkgs/firehose/
- name: Find Comment
id: fc
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.number }}
run: |
COMMENT_ID=$(dart pub global run firehose:comment find --issue "$ISSUE_NUMBER" --author github-actions[bot] --body-includes "## Ecosystem testing")
echo "comment-id=$COMMENT_ID" >> "$GITHUB_OUTPUT"
- name: Write comment id to file
if: ${{ steps.fc.outputs.comment-id != 0 }}
run: echo ${STEPS_FC_OUTPUTS_COMMENT_ID} >> output/commentId
env:
STEPS_FC_OUTPUTS_COMMENT_ID: ${{ steps.fc.outputs.comment-id }}
- name: Upload markdown
if: success() || failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a
with:
name: output
path: output/