Merge branch 'argentlabs:develop' into develop #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 }} |