forked from argentlabs/argent-x
-
Notifications
You must be signed in to change notification settings - Fork 0
139 lines (119 loc) · 4.38 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
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
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
name: Run Tests
on:
push:
branches: [develop]
pull_request:
branches:
- main
- develop
jobs:
test:
runs-on: ubuntu-latest
services:
devnet:
image: shardlabs/starknet-devnet:latest-seed0
ports:
- 5050:5050
env:
FILENAME: argent-extension-${{ github.ref_name }}
FEATURE_PRIVACY_SETTINGS: "true"
FEATURE_EXPERIMENTAL_SETTINGS: "true"
FEATURE_BANXA: "true"
FEATURE_LAYERSWAP: "true"
FEATURE_ORBITER: "true"
FEATURE_VERIFIED_DAPPS: "false"
ARGENT_API_BASE_URL: ${{ secrets.ARGENT_API_BASE_URL }}
ARGENT_TRANSACTION_REVIEW_API_BASE_URL: ${{ secrets.ARGENT_TRANSACTION_REVIEW_API_BASE_URL }}
ARGENT_X_STATUS_URL: ${{ secrets.ARGENT_X_STATUS_URL }}
ARGENT_EXPLORER_BASE_URL: ${{ secrets.ARGENT_EXPLORER_BASE_URL }}
steps:
- name: If github.head_ref not filled, we are merging
run: |
if [ "${{ github.head_ref }}" == "" || ${{ github.actor == 'dependabot[bot]' }} ]; then
echo "PUBLISH_COMMENT=no" >> $GITHUB_ENV
else
echo "PUBLISH_COMMENT=yes" >> $GITHUB_ENV
fi
- name: Check out repository code
uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: "16"
cache: "yarn"
- name: Install dependencies
run: yarn setup
- name: Lint
run: yarn lint
- name: Build
run: yarn lerna run --scope @argent-x/extension build
env:
UPLOAD_SENTRY_SOURCEMAPS: false
- name: Run tests
run: yarn test:ci
- name: Check bundlesize for chrome
run: yarn run bundlewatch
- uses: actions/upload-artifact@v3
if: always()
with:
name: test-results
path: |
packages/extension/test-results/
packages/extension/e2e/artifacts/playwright/
packages/extension/e2e/artifacts/reports/
retention-days: 5
## Upload build and comment PR if not merging into develop
- name: Set filename prefix
if: ${{ env.PUBLISH_COMMENT == 'yes' }}
run: echo "FILENAME_PREFIX=$(echo ${{ env.FILENAME }} | tr / -)" >> $GITHUB_ENV
- name: Create chrome zip
if: ${{ env.PUBLISH_COMMENT == 'yes' }}
run: |
cd packages/extension/dist
zip -r ${{ env.FILENAME_PREFIX }}-chrome.zip ./*
mv ${{ env.FILENAME_PREFIX }}-chrome.zip ../../../
cd ../../../
- name: Build Firefox version
if: ${{ env.PUBLISH_COMMENT == 'yes' }}
run: MANIFEST_VERSION=v2 yarn --cwd packages/extension build
- name: Create firefox zip
if: ${{ env.PUBLISH_COMMENT == 'yes' }}
run: |
cd packages/extension/dist
zip -r ${{ env.FILENAME_PREFIX }}-firefox.zip ./*
mv ${{ env.FILENAME_PREFIX }}-firefox.zip ../../../
cd ../../../
- name: Check bundlesize for firefox
if: ${{ env.PUBLISH_COMMENT == 'yes' }}
run: yarn run bundlewatch
- name: Upload artifacts for firefox
if: ${{ env.PUBLISH_COMMENT == 'yes' }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.FILENAME_PREFIX }}-firefox.zip
path: "*-firefox.zip"
retention-days: 5
- name: Upload artifacts for chrome
if: ${{ env.PUBLISH_COMMENT == 'yes' }}
uses: actions/upload-artifact@v3
with:
name: ${{ env.FILENAME_PREFIX }}-chrome.zip
path: "*-chrome.zip"
retention-days: 5
- name: Set GHA_BRANCH
if: ${{ env.PUBLISH_COMMENT == 'yes' }}
run: echo "GHA_BRANCH=$(echo $GITHUB_REF | awk -F / '{print $3}')" >> $GITHUB_ENV
- name: comment PR
if: ${{ env.PUBLISH_COMMENT == 'yes' }}
continue-on-error: true
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
INPUT_REPO: ${{ env.GHA_BRANCH }}
INPUT_OWNER: ${{ github.repository_owner }}
run: |
gh pr comment ${{ env.GHA_BRANCH }} --body "[Builds for local testing](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})"
- name: SonarCloud Scan
if: github.actor != 'dependabot[bot]'
uses: SonarSource/sonarcloud-github-action@master
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
SONAR_TOKEN: ${{ secrets.SONARCLOUD_TOKEN }}