| 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: |
| runs-on: ubuntu-latest |
| steps: |
| - name: Checkout repository |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd |
| with: |
| token: ${{ secrets.GITHUB_TOKEN }} |
| |
| - uses: actions/cache@668228422ae6a00e4ad889ee87cd7109ec5666a7 |
| 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 "${{ 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.repositoryUrl }} ${{ github.head_ref || github.ref_name }} "${{ toJSON(github.event.pull_request.labels.*.name) }}" |
| env: |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| INPUTS_REPOS_FILE: ${{ inputs.repos_file }} |
| |
| - name: Output issue number |
| run: | |
| mkdir -p output |
| echo ${{ github.event.number }} > output/issueNumber |
| |
| - name: Install firehose (internal) |
| if: github.repository == 'dart-lang/ecosystem' |
| run: dart pub global activate --source git https://github.com/dart-lang/ecosystem --git-path pkgs/firehose/ --git-ref ${{ github.head_ref || github.ref_name }} |
| |
| - 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 |
| run: | |
| COMMENT_ID=$(dart pub global run firehose:comment find --issue ${{ github.event.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@bbbca2ddaa5d8feaa63e36b76fdaad77386f024f |
| with: |
| name: output |
| path: output/ |