-
Notifications
You must be signed in to change notification settings - Fork 6
97 lines (94 loc) · 3.68 KB
/
main.yaml
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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
# This is the entry point for CI. It will setup the application, then run lint, test, and eventually publish if not the main branch
name: 'Main'
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
concurrency: build-${{ github.ref}}
if: ${{ !startsWith(github.head_ref, 'version-bump') }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/setup
- run: yarn build
lint:
runs-on: ubuntu-latest
concurrency: lint-${{ github.ref }}
if: ${{ !startsWith(github.head_ref, 'version-bump') }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/setup
- run: yarn lint
- run: yarn prettier --check "**/*.{ts,md}"
test:
concurrency: test-${{ github.ref }}
runs-on: ubuntu-latest
if: ${{ !startsWith(github.head_ref, 'version-bump') }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/setup
- run: |
# Check for test.only() in test files
set +e
files=$(find ${{ github.workspace }}/test -name "*.test.ts" | xargs grep -l 'test.only')
set -e
if [[ -n $files ]]; then
echo "Error: Found /test.only/ in following test files:"
echo "$files"
exit 1
fi
- run: yarn test
- uses: actions/upload-artifact@b4b15b8c7c6ac21ea08fcf65892d2ee8f75cf882 # v4.4.3
with:
name: coverage-reports
path: |
./**/coverage/tmp/*.json
./**/coverage/coverage-summary.json
# Only run if tests have run and completed successfully
code-coverage:
needs: test
runs-on: ubuntu-latest
if: ${{ !startsWith(github.head_ref, 'version-bump') }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/setup
- uses: actions/download-artifact@fa0a91b85d4f404e444e00e005971372dc801d16 # v4.1.8
with:
name: coverage-reports
- run: yarn code-coverage
- uses: ./.github/actions/set-git-credentials
- name: Save coverage summary
if: github.event.pull_request.number # check if the context is pull request
run: |
# save coverage summary in a branch 'coverage-pr-PR_NUMBER' so we can have access to it in a different workflow
BRANCH="coverage-pr-${{ github.event.pull_request.number }}"
git checkout -b $BRANCH
git add -f coverage/coverage-summary.json
git commit -m "coverage summary report"
git push --set-upstream origin $BRANCH --force
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
generate-example-adapter:
runs-on: ubuntu-latest
if: ${{ !startsWith(github.head_ref, 'version-bump') }}
steps:
- uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
- uses: ./.github/actions/setup
- name: Generate new adapter, build, run the tests
run: |
yarn build
path_to_generator="$GITHUB_WORKSPACE/dist/src/generator-adapter/generators/app/index.js"
npm install -g yo@5.0.0
# The command bellow will generate new EA with default name 'example-adapter' in specified directory 'examples'
DEBUG=* yo "$path_to_generator" examples
cd examples/example-adapter
yarn build
yarn test
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
EXTERNAL_ADAPTER_GENERATOR_NO_INTERACTIVE: 'true'
EXTERNAL_ADAPTER_GENERATOR_STANDALONE: 'true'