Commit c48d4c54 authored by Zach Pomerantz's avatar Zach Pomerantz Committed by GitHub

build: simplify actions (#4014)

* build: simplify actions

* build: add checkout

* build: fix path

* build: fix all paths

* build: missing steps

* build: update build name

* build: rename action

* build: add shell

* build: formalize lint

* build: cleanup

* build: update release

* build: comment workflows
parent b28cd9c8
name: Setup
runs:
using: composite
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
registry-url: https://registry.npmjs.org
cache: yarn
- uses: actions/cache@v3
id: install-cache
with:
path: node_modules/
key: ${{ runner.os }}-install-${{ hashFiles('**/yarn.lock') }}
- if: steps.install-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --ignore-scripts
shell: bash
name: "Check PR Title" name: Check PR Title
on: on:
pull_request_target: pull_request_target:
...@@ -8,8 +8,8 @@ on: ...@@ -8,8 +8,8 @@ on:
- synchronize - synchronize
jobs: jobs:
check-pr-title: # Ensures that the PR title adheres to [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/).
name: Check PR Title conventional-commit:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: amannn/action-semantic-pull-request@v3.4.0 - uses: amannn/action-semantic-pull-request@v3.4.0
......
...@@ -2,34 +2,18 @@ name: Crowdin Download ...@@ -2,34 +2,18 @@ name: Crowdin Download
on: on:
schedule: schedule:
- cron: '0 * * * *' # every hour we download translations and update the pr from crowdin # Download translations every hour.
# This is not done as part of the build so that builds remain reproducible.
- cron: '0 * * * *'
# manual trigger # manual trigger
workflow_dispatch: workflow_dispatch:
jobs: jobs:
download-translations: download-translations:
name: Download translations
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: actions/setup-node@v3
with:
node-version: 14
registry-url: https://registry.npmjs.org
cache: 'yarn'
- uses: actions/cache@v3
id: install-cache
with:
path: node_modules/
key: ${{ runner.os }}-install-${{ hashFiles('**/yarn.lock') }}
- if: steps.install-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --ignore-scripts
- run: yarn i18n:extract - run: yarn i18n:extract
- name: Download Crowdin translations - name: Download Crowdin translations
......
...@@ -6,28 +6,11 @@ on: ...@@ -6,28 +6,11 @@ on:
- main - main
jobs: jobs:
synchronize-with-crowdin: upload-sources:
name: Upload sources to Crowdin
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: actions/setup-node@v3
with:
node-version: 14
registry-url: https://registry.npmjs.org
cache: 'yarn'
- uses: actions/cache@v3
id: install-cache
with:
path: node_modules/
key: ${{ runner.os }}-install-${{ hashFiles('**/yarn.lock') }}
- if: steps.install-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --ignore-scripts
- run: yarn i18n:extract - run: yarn i18n:extract
- name: Upload Crowdin sources - name: Upload Crowdin sources
......
name: Lint
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
run-linters:
name: Run linters
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
registry-url: https://registry.npmjs.org
cache: 'yarn'
- uses: actions/cache@v3
id: install-cache
with:
path: node_modules/
key: ${{ runner.os }}-install-${{ hashFiles('**/yarn.lock') }}
- if: steps.install-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --ignore-scripts
- name: Run eslint w/ autofix
if: ${{ github.event_name != 'pull_request' || github.event.pull_request.head.repo.owner.login == github.repository_owner }}
uses: wearerequired/lint-action@36c7e6689e80d785d27a22f71d970f3a3b4fcb70
with:
github_token: ${{ secrets.github_token }}
eslint: true
eslint_args: "-c .eslintrc.json"
auto_fix: true
- name: Run eslint
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.repo.owner.login != github.repository_owner }}
run: yarn eslint .
name: Release name: Release
on: on:
# disable deploys until this action is amended to include seeding cloudflare IPFS schedule:
# schedule: - cron: '0 12 * * 1-4' # every day 12:00 UTC Monday-Thursday
# - cron: '0 12 * * 1-4' # every day 12:00 UTC Monday-Thursday
# manual trigger # manual trigger
workflow_dispatch: workflow_dispatch:
jobs: jobs:
bump_version: wait-on-test:
name: Bump Version runs-on: ubuntu-latest
steps:
- uses: jitterbit/await-check-suites@v1
# Only wait for the first check suite, so that only tests are awaited, and not eg crowdin.
onlyFirstCheckSuite: true
tag:
needs: wait-on-test
runs-on: ubuntu-latest runs-on: ubuntu-latest
outputs: outputs:
new_tag: ${{ steps.github_tag_action.outputs.new_tag }} new_tag: ${{ steps.github_tag_action.outputs.new_tag }}
changelog: ${{ steps.github_tag_action.outputs.changelog }} changelog: ${{ steps.github_tag_action.outputs.changelog }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- name: Bump and tag
- name: Bump version and push tag id: github-tag-action
id: github_tag_action uses: mathieudutour/github-tag-action@v6.0
uses: mathieudutour/github-tag-action@331898d5052eedac9b15fec867b5ba66ebf9b692
with: with:
github_token: ${{ secrets.GITHUB_TOKEN }} github_token: ${{ secrets.GITHUB_TOKEN }}
release_branches: .* release_branches: .*
default_bump: false default_bump: patch
create_release: release:
name: Create Release needs: tag
if: ${{ needs.tag.outputs.new_tag != null }}
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: bump_version
if: ${{ needs.bump_version.outputs.new_tag != null }}
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: actions/setup-node@v3
with:
node-version: 14
registry-url: https://registry.npmjs.org
cache: 'yarn'
- uses: actions/cache@v3
id: install-cache
with:
path: node_modules/
key: ${{ runner.os }}-install-${{ hashFiles('**/yarn.lock') }}
- if: steps.install-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --ignore-scripts
- run: yarn prepare - run: yarn prepare
- run: yarn build - run: yarn build
- name: Pin to IPFS - name: Pin to IPFS
id: upload id: pinata
uses: anantaramdas/ipfs-pinata-deploy-action@39bbda1ce1fe24c69c6f57861b8038278d53688d uses: anantaramdas/ipfs-pinata-deploy-action@39bbda1ce1fe24c69c6f57861b8038278d53688d
with: with:
pin-name: Uniswap ${{ needs.bump_version.outputs.new_tag }} pin-name: Uniswap ${{ needs.tag.outputs.new_tag }}
path: './build' path: './build'
pinata-api-key: ${{ secrets.PINATA_API_KEY }} pinata-api-key: ${{ secrets.PINATA_API_KEY }}
pinata-secret-api-key: ${{ secrets.PINATA_API_SECRET_KEY }} pinata-secret-api-key: ${{ secrets.PINATA_API_SECRET_KEY }}
...@@ -70,12 +57,24 @@ jobs: ...@@ -70,12 +57,24 @@ jobs:
seeds: ${{ secrets.CRUST_SEEDS }} seeds: ${{ secrets.CRUST_SEEDS }}
- name: Convert CIDv0 to CIDv1 - name: Convert CIDv0 to CIDv1
id: convert_cidv0 id: convert-cidv0
uses: uniswap/convert-cidv0-cidv1@v1.0.0 uses: uniswap/convert-cidv0-cidv1@v1.0.0
with: with:
cidv0: ${{ steps.upload.outputs.hash }} cidv0: ${{ steps.pinata.outputs.hash }}
- run: sleep 600 - uses: actions/cache@v3
id: cypress-cache
with:
path: /home/runner/.cache/Cypress
key: ${{ runner.os }}-cypress-${{ hashFiles('node_modules/cypress') }}
- if: steps.cypress-cache.outputs.cache-hit != 'true'
run: yarn cypress install
- uses: cypress-io/github-action@v4
with:
install: false
browser: chrome
spec: cypress/e2e/landing.test.ts
config: pageLoadTimeout=180000,retries=4,baseUrl=https://cloudflare-ipfs.com/ipfs/${{ steps.pinata.outputs.hash }}
- name: Update DNS with new IPFS hash - name: Update DNS with new IPFS hash
env: env:
...@@ -85,20 +84,19 @@ jobs: ...@@ -85,20 +84,19 @@ jobs:
CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }} CLOUDFLARE_ZONE_ID: ${{ secrets.CLOUDFLARE_ZONE_ID }}
uses: textileio/cloudflare-update-dnslink@0fe7b7a1ffc865db3a4da9773f0f987447ad5848 uses: textileio/cloudflare-update-dnslink@0fe7b7a1ffc865db3a4da9773f0f987447ad5848
with: with:
cid: ${{ steps.upload.outputs.hash }} cid: ${{ steps.pinata.outputs.hash }}
- name: Create GitHub Release - name: Release
id: create_release
uses: actions/create-release@v1.1.0 uses: actions/create-release@v1.1.0
env: env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with: with:
tag_name: ${{ needs.bump_version.outputs.new_tag }} tag_name: ${{ needs.tag.outputs.new_tag }}
release_name: Release ${{ needs.bump_version.outputs.new_tag }} release_name: Release ${{ needs.tag.outputs.new_tag }}
body: | body: |
IPFS hash of the deployment: IPFS hash of the deployment:
- CIDv0: `${{ steps.upload.outputs.hash }}` - CIDv0: `${{ steps.pinata.outputs.hash }}`
- CIDv1: `${{ steps.convert_cidv0.outputs.cidv1 }}` - CIDv1: `${{ steps.convert-cidv0.outputs.cidv1 }}`
The latest release is always accessible via our alias to the Cloudflare IPFS gateway at [app.uniswap.org](https://app.uniswap.org). The latest release is always accessible via our alias to the Cloudflare IPFS gateway at [app.uniswap.org](https://app.uniswap.org).
...@@ -108,8 +106,8 @@ jobs: ...@@ -108,8 +106,8 @@ jobs:
Your Uniswap settings are never remembered across different URLs. Your Uniswap settings are never remembered across different URLs.
IPFS gateways: IPFS gateways:
- https://${{ steps.convert_cidv0.outputs.cidv1 }}.ipfs.dweb.link/ - https://${{ steps.convert-cidv0.outputs.cidv1 }}.ipfs.dweb.link/
- https://${{ steps.convert_cidv0.outputs.cidv1 }}.ipfs.cf-ipfs.com/ - https://${{ steps.convert-cidv0.outputs.cidv1 }}.ipfs.cf-ipfs.com/
- [ipfs://${{ steps.upload.outputs.hash }}/](ipfs://${{ steps.upload.outputs.hash }}/) - [ipfs://${{ steps.upload.outputs.hash }}/](ipfs://${{ steps.pinata.outputs.hash }}/)
${{ needs.bump_version.outputs.changelog }} ${{ needs.tag.outputs.changelog }}
name: End-to-End Tests name: Test
on: on:
push: push:
...@@ -7,33 +7,33 @@ on: ...@@ -7,33 +7,33 @@ on:
pull_request: pull_request:
branches: branches:
- main - main
# manual trigger
workflow_dispatch:
jobs: jobs:
build: lint:
name: Build
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: yarn lint
- uses: actions/setup-node@v3 unit-tests:
with: runs-on: ubuntu-latest
node-version: 14 steps:
registry-url: https://registry.npmjs.org - uses: actions/checkout@v3
cache: 'yarn' - uses: ./.github/actions/setup
- run: yarn prepare
- uses: actions/cache@v3 - run: yarn test
id: install-cache
with:
path: node_modules/
key: ${{ runner.os }}-install-${{ hashFiles('**/yarn.lock') }}
- if: steps.install-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --ignore-scripts
cypress-build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup
- run: yarn prepare - run: yarn prepare
- run: yarn build - run: yarn build
- uses: actions/upload-artifact@v2 - uses: actions/upload-artifact@v2
with: with:
name: build name: build
...@@ -45,35 +45,19 @@ jobs: ...@@ -45,35 +45,19 @@ jobs:
with: with:
path: /home/runner/.cache/Cypress path: /home/runner/.cache/Cypress
key: ${{ runner.os }}-cypress-${{ hashFiles('node_modules/cypress') }} key: ${{ runner.os }}-cypress-${{ hashFiles('node_modules/cypress') }}
- if: steps.cypress-cache.outputs.cache-hit != 'true' - if: steps.cypress-cache.outputs.cache-hit != 'true'
run: yarn cypress install run: yarn cypress install
cypress-tests: cypress-tests:
name: Run tests needs: cypress-build
runs-on: ubuntu-latest runs-on: ubuntu-latest
needs: build
strategy: strategy:
fail-fast: false fail-fast: false
matrix: matrix:
containers: [1, 2, 3, 4] containers: [1, 2, 3, 4]
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v3
- uses: ./.github/actions/setup
- uses: actions/setup-node@v3
with:
node-version: 14
registry-url: https://registry.npmjs.org
cache: 'yarn'
- uses: actions/cache@v3
id: install-cache
with:
path: node_modules/ # this should always be a cache hit, from install
key: ${{ runner.os }}-install-${{ hashFiles('**/yarn.lock') }}
- if: steps.install-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --ignore-scripts
- uses: actions/download-artifact@v2 - uses: actions/download-artifact@v2
with: with:
...@@ -85,7 +69,6 @@ jobs: ...@@ -85,7 +69,6 @@ jobs:
with: with:
path: /home/runner/.cache/Cypress path: /home/runner/.cache/Cypress
key: ${{ runner.os }}-cypress-${{ hashFiles('node_modules/cypress') }} key: ${{ runner.os }}-cypress-${{ hashFiles('node_modules/cypress') }}
- if: steps.cypress-cache.outputs.cache-hit != 'true' - if: steps.cypress-cache.outputs.cache-hit != 'true'
run: yarn cypress install run: yarn cypress install
...@@ -98,6 +81,5 @@ jobs: ...@@ -98,6 +81,5 @@ jobs:
record: true record: true
parallel: true parallel: true
env: env:
CI: false # disables lint checks when building
CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }} CYPRESS_RECORD_KEY: ${{ secrets.CYPRESS_RECORD_KEY }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
\ No newline at end of file
name: Unit Tests
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
unit-tests:
name: Run tests
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: 14
registry-url: https://registry.npmjs.org
cache: 'yarn'
- uses: actions/cache@v3
id: install-cache
with:
path: node_modules/
key: ${{ runner.os }}-install-${{ hashFiles('**/yarn.lock') }}
- if: steps.install-cache.outputs.cache-hit != 'true'
run: yarn install --frozen-lockfile --ignore-scripts
- run: yarn prepare
- run: yarn test
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
"start": "react-scripts start", "start": "react-scripts start",
"build": "react-scripts build", "build": "react-scripts build",
"serve": "serve build -l 3000", "serve": "serve build -l 3000",
"lint": "yarn eslint .",
"test": "react-scripts test --coverage", "test": "react-scripts test --coverage",
"cypress:open": "cypress open --browser chrome --e2e", "cypress:open": "cypress open --browser chrome --e2e",
"cypress:run": "cypress run --browser chrome --e2e" "cypress:run": "cypress run --browser chrome --e2e"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment