xref: /expo/.github/workflows/sdk.yml (revision 7aeb2b0c)
1name: SDK
2
3on:
4  workflow_dispatch:
5    inputs:
6      checkAll:
7        description: 'type "check-all" to force checking all packages'
8        required: false
9        default: ''
10  push:
11    branches: [main, 'sdk-*']
12    paths:
13      - .github/workflows/sdk.yml
14      - tools/**
15      - packages/**
16      - yarn.lock
17      # Ignore Expo CLI for now...
18      - '!packages/expo/cli/**'
19      - '!packages/expo/bin/**'
20      - '!packages/expo/e2e/**'
21  pull_request:
22    paths:
23      - .github/workflows/sdk.yml
24      - tools/**
25      - packages/**
26      - yarn.lock
27      # Ignore Expo CLI for now...
28      - '!packages/expo/cli/**'
29      - '!packages/expo/bin/**'
30      - '!packages/expo/e2e/**'
31  schedule:
32    - cron: 0 14 * * *
33
34concurrency:
35  group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
36  cancel-in-progress: true
37
38jobs:
39  check-packages:
40    runs-on: ubuntu-18.04
41    steps:
42      - name: �� Checkout a ref for the event
43        uses: actions/checkout@v2
44        with:
45          fetch-depth: 100
46      - name: ⬇️ Fetch commits from base branch
47        run: git fetch origin ${{ github.event.before || github.base_ref || 'main' }}:${{ github.event.before || github.base_ref || 'main' }} --depth 100
48        if: github.event_name == 'pull_request' || github.event_name == 'workflow_dispatch'
49      - name: ♻️ Restore workspace node modules
50        uses: actions/cache@v2
51        id: node-modules-cache
52        with:
53          path: |
54            # See "workspaces" → "packages" in the root package.json for the source of truth of
55            # which node_modules are affected by the root yarn.lock
56            node_modules
57            apps/*/node_modules
58            home/node_modules
59            packages/*/node_modules
60            packages/@unimodules/*/node_modules
61            react-native-lab/react-native/node_modules
62          key: ${{ runner.os }}-modules-v2-${{ hashFiles('yarn.lock') }}
63      - name: �� Install node modules in root dir
64        # if: steps.node-modules-cache.outputs.cache-hit != 'true'
65        run: yarn install --frozen-lockfile
66      - name: ♻️ Restore node modules in tools
67        uses: actions/cache@v2
68        with:
69          path: tools/node_modules
70          key: ${{ runner.os }}-modules-${{ hashFiles('tools/yarn.lock') }}
71      - name: �� Check packages
72        run: |
73          echo "Checking packages according to the event name: ${{ github.event_name }}"
74          if [[ "${{ github.event_name }}" == "schedule" || "${{ github.event.inputs.checkAll }}" == "check-all" ]]; then
75            # Check all packages on scheduled events or if requested by workflow_dispatch event.
76            bin/expotools check-packages --all
77          else
78            # On push event check packages changed since previous remote head.
79            # In pull requests and workflow_dispatch events check all packages changed in the entire PR.
80            bin/expotools check-packages --since ${{ github.event.before || github.base_ref || 'main' }}
81          fi
82      - name: �� Notify on Slack
83        uses: 8398a7/action-slack@v3
84        if: failure() && (github.event.ref == 'refs/heads/main' || startsWith(github.event.ref, 'refs/heads/sdk-'))
85        env:
86          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
87          SLACK_WEBHOOK_URL: ${{ secrets.slack_webhook_api }}
88        with:
89          channel: '#expo-sdk'
90          status: ${{ job.status }}
91          fields: job,message,ref,eventName,author,took
92          author_name: Check packages
93