-
Notifications
You must be signed in to change notification settings - Fork 1
72 lines (70 loc) · 2.37 KB
/
test.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
name: Lint & Test
on:
- pull_request
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
CURRENT_BRANCH_NAME: ${{ github.head_ref || github.ref_name }}
TARGET_BRANCH_NAME: ${{ github.base_ref || github.ref_name }}
CI: "true"
defaults:
run:
shell: bash -l {0}
jobs:
eslint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-node@v3
name: Use NodeJS
with:
node-version: 18
cache: yarn
- run: yarn install --frozen-lockfile
- name: Determine version cache key
id: version-environment-cache
run: |
# Create a cache key based on the current AppStore version
echo "VERSION_CACHE_KEY=$(yarn --silent version:show --cache-key | tail -n1)" >> $GITHUB_OUTPUT
- name: Check previous environment
uses: UnlyEd/github-action-store-variable@v3 # See https://github.com/UnlyEd/github-action-store-variable
with:
variables: ${{ steps.version-environment-cache.outputs.VERSION_CACHE_KEY }}
- name: set EXPO_ENV environment
id: environment
env:
VERSION_CACHE_KEY: "${{ steps.version-environment-cache.outputs.VERSION_CACHE_KEY }}"
run: |
# If we have a cached environment for this AppStore version, use that instead,
# otherwise default to guess it by branch
if [[ -n "${!VERSION_CACHE_KEY}" ]]; then
echo "EXPO_ENV=${!VERSION_CACHE_KEY}" >> $GITHUB_OUTPUT
elif [[ "${{ env.TARGET_BRANCH_NAME }}" == "staging" ]]; then
echo "EXPO_ENV=staging" >> $GITHUB_OUTPUT
else
echo "EXPO_ENV=staging" >> $GITHUB_OUTPUT
fi
- run: yarn check:types:ci
- run: yarn check:linting:ci
- run: yarn check:testing:ci
env:
EXPO_ENV: ${{ steps.environment.outputs.EXPO_ENV }}
JEST_JUNIT_OUTPUT_DIR: ~/reports/
publish-test-results:
name: "Publish Unit Tests Results"
needs:
- eslint
runs-on: ubuntu-latest
if: always()
steps:
- name: Download Artifacts
uses: actions/download-artifact@v2
with:
path: artifacts
- name: Publish Unit Test Results
uses: EnricoMi/publish-unit-test-result-action@v2
with:
junit_files: artifacts/**/*.xml