Chore/use cache in GitHub jobs (#1461)
* chore: use cache v3 * chore: just cache whole node modules * chore: download binaries instead of building them * chore: missing directory flag * chore: remove directory * chore: aaah gobin * chore: apply all improvements to other workflows * chore: cache cypress * fix: added mock for one failing test, removed console.log * fix: removed increased timeout - not needed * chore: change name back Co-authored-by: asiaznik <artur@vegaprotocol.io>
This commit is contained in:
parent
ebf2bfc7a9
commit
a452a6e831
@ -27,7 +27,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
GO111MODULE: 'on'
|
GO111MODULE: 'on'
|
||||||
GOPROXY: ${{ secrets.GO_PROXY }}
|
VEGA_VERSION: 'v0.55.0'
|
||||||
steps:
|
steps:
|
||||||
#######
|
#######
|
||||||
## Setup langs
|
## Setup langs
|
||||||
@ -70,18 +70,18 @@ jobs:
|
|||||||
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||||
path: './capsule'
|
path: './capsule'
|
||||||
|
|
||||||
# Checkout vega
|
# Restore node_modules from cache if possible
|
||||||
- name: Checkout Vega
|
- name: Restore node_modules from cache
|
||||||
uses: actions/checkout@v2
|
uses: actions/cache@v3
|
||||||
with:
|
with:
|
||||||
repository: vegaprotocol/vega
|
path: |
|
||||||
ref: v0.54.0
|
frontend-monorepo/node_modules
|
||||||
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
/home/runner/.cache/Cypress
|
||||||
path: './vega'
|
key: node_modules_cypress-${{ hashFiles('frontend-monorepo/yarn.lock') }}
|
||||||
|
|
||||||
# Install frontend dependencies
|
# Install frontend dependencies
|
||||||
- name: Install root dependencies
|
- name: Install root dependencies
|
||||||
run: yarn install
|
run: yarn install --frozen-lockfile
|
||||||
working-directory: frontend-monorepo
|
working-directory: frontend-monorepo
|
||||||
|
|
||||||
#######
|
#######
|
||||||
@ -97,17 +97,20 @@ jobs:
|
|||||||
|
|
||||||
- name: Install Vega binaries
|
- name: Install Vega binaries
|
||||||
if: ${{ env.RUN_CAPSULE }}
|
if: ${{ env.RUN_CAPSULE }}
|
||||||
run: go install -v ./cmd/vega
|
run: |
|
||||||
working-directory: vega
|
wget 'https://github.com/vegaprotocol/vega/releases/download/${{ env.VEGA_VERSION }}/vega-linux-amd64.zip'
|
||||||
|
unzip vega-linux-amd64.zip -d ${{ env.GOBIN }}
|
||||||
|
|
||||||
- name: Install date-node binaries
|
- name: Install date-node binaries
|
||||||
if: ${{ env.RUN_CAPSULE }}
|
if: ${{ env.RUN_CAPSULE }}
|
||||||
run: go install ./cmd/data-node
|
run: |
|
||||||
working-directory: vega
|
wget 'https://github.com/vegaprotocol/vega/releases/download/${{ env.VEGA_VERSION }}/data-node-linux-amd64.zip'
|
||||||
|
unzip data-node-linux-amd64.zip -d ${{ env.GOBIN }}
|
||||||
|
|
||||||
- name: Install Vega wallet binaries
|
- name: Install Vega wallet binaries
|
||||||
run: go install ./cmd/vegawallet
|
run: |
|
||||||
working-directory: vega
|
wget 'https://github.com/vegaprotocol/vega/releases/download/${{ env.VEGA_VERSION }}/vegawallet-linux-amd64.zip'
|
||||||
|
unzip vegawallet-linux-amd64.zip -d ${{ env.GOBIN }}
|
||||||
|
|
||||||
######
|
######
|
||||||
## Start capsule
|
## Start capsule
|
||||||
@ -149,17 +152,13 @@ jobs:
|
|||||||
run: vegawallet service run --network fairground --automatic-consent --home ~/.vegacapsule/testnet/wallet &
|
run: vegawallet service run --network fairground --automatic-consent --home ~/.vegacapsule/testnet/wallet &
|
||||||
|
|
||||||
- name: Start service using capsule network
|
- name: Start service using capsule network
|
||||||
if: ${{ env.RUN_CAPSULE==true }}
|
if: ${{ env.RUN_CAPSULE }}
|
||||||
run: vegawallet service run --network DV --automatic-consent --home ~/.vegacapsule/testnet/wallet &
|
run: vegawallet service run --network DV --automatic-consent --home ~/.vegacapsule/testnet/wallet &
|
||||||
|
|
||||||
######
|
######
|
||||||
## Run some tests
|
## Run some tests
|
||||||
######
|
######
|
||||||
|
|
||||||
- name: Install root dependencies
|
|
||||||
run: yarn install
|
|
||||||
working-directory: frontend-monorepo
|
|
||||||
|
|
||||||
- name: Run smoke Cypress tests
|
- name: Run smoke Cypress tests
|
||||||
if: ${{ github.event.inputs.runAlltests == 'true' }}
|
if: ${{ github.event.inputs.runAlltests == 'true' }}
|
||||||
run: yarn nx run ${{ github.event.inputs.project }}:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --env.grepTags='@smoke'
|
run: yarn nx run ${{ github.event.inputs.project }}:e2e --record --key ${{ secrets.CYPRESS_RECORD_KEY }} --env.grepTags='@smoke'
|
||||||
@ -185,11 +184,11 @@ jobs:
|
|||||||
######
|
######
|
||||||
|
|
||||||
- name: Logs
|
- name: Logs
|
||||||
if: ${{ env.RUN_CAPSULE==true }}
|
if: ${{ env.RUN_CAPSULE }}
|
||||||
run: vegacapsule network logs > vega-capsule-logs.txt
|
run: vegacapsule network logs > vega-capsule-logs.txt
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
if: ${{ env.RUN_CAPSULE==true }}
|
if: ${{ env.RUN_CAPSULE }}
|
||||||
with:
|
with:
|
||||||
name: logs
|
name: logs
|
||||||
path: ./vega-capsule-logs.txt
|
path: ./vega-capsule-logs.txt
|
||||||
|
49
.github/workflows/capsule-cypress-night-run.yml
vendored
49
.github/workflows/capsule-cypress-night-run.yml
vendored
@ -12,6 +12,7 @@ jobs:
|
|||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
env:
|
env:
|
||||||
GO111MODULE: 'on'
|
GO111MODULE: 'on'
|
||||||
|
VEGA_VERSION: 'v0.55.0'
|
||||||
steps:
|
steps:
|
||||||
#######
|
#######
|
||||||
## Setup langs
|
## Setup langs
|
||||||
@ -28,7 +29,7 @@ jobs:
|
|||||||
node-version: 16
|
node-version: 16
|
||||||
|
|
||||||
#######
|
#######
|
||||||
## Checkout capsule
|
## Checkout repos
|
||||||
#######
|
#######
|
||||||
|
|
||||||
# Checkout front ends
|
# Checkout front ends
|
||||||
@ -48,6 +49,20 @@ jobs:
|
|||||||
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||||
path: './capsule'
|
path: './capsule'
|
||||||
|
|
||||||
|
# Restore node_modules from cache if possible
|
||||||
|
- name: Restore node_modules from cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
frontend-monorepo/node_modules
|
||||||
|
/home/runner/.cache/Cypress
|
||||||
|
key: node_modules_cypress-${{ hashFiles('frontend-monorepo/yarn.lock') }}
|
||||||
|
|
||||||
|
# Install frontend dependencies
|
||||||
|
- name: Install root dependencies
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
working-directory: frontend-monorepo
|
||||||
|
|
||||||
#######
|
#######
|
||||||
## Build binaries
|
## Build binaries
|
||||||
#######
|
#######
|
||||||
@ -58,25 +73,20 @@ jobs:
|
|||||||
- name: Set GOBIN
|
- name: Set GOBIN
|
||||||
run: echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV
|
run: echo GOBIN=$(go env GOPATH)/bin >> $GITHUB_ENV
|
||||||
|
|
||||||
- name: Checkout Vega
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
repository: vegaprotocol/vega
|
|
||||||
ref: v0.55.0
|
|
||||||
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
|
||||||
path: './vega'
|
|
||||||
|
|
||||||
- name: Install Vega binaries
|
- name: Install Vega binaries
|
||||||
run: go install -v ./cmd/vega
|
run: |
|
||||||
working-directory: vega
|
wget 'https://github.com/vegaprotocol/vega/releases/download/${{ env.VEGA_VERSION }}/vega-linux-amd64.zip'
|
||||||
|
unzip vega-linux-amd64.zip -d ${{ env.GOBIN }}
|
||||||
- name: Install Vega wallet binaries
|
|
||||||
run: go install ./cmd/vegawallet
|
|
||||||
working-directory: vega
|
|
||||||
|
|
||||||
- name: Install date-node binaries
|
- name: Install date-node binaries
|
||||||
run: go install ./cmd/data-node
|
run: |
|
||||||
working-directory: vega
|
wget 'https://github.com/vegaprotocol/vega/releases/download/${{ env.VEGA_VERSION }}/data-node-linux-amd64.zip'
|
||||||
|
unzip data-node-linux-amd64.zip -d ${{ env.GOBIN }}
|
||||||
|
|
||||||
|
- name: Install Vega wallet binaries
|
||||||
|
run: |
|
||||||
|
wget 'https://github.com/vegaprotocol/vega/releases/download/${{ env.VEGA_VERSION }}/vegawallet-linux-amd64.zip'
|
||||||
|
unzip vegawallet-linux-amd64.zip -d ${{ env.GOBIN }}
|
||||||
|
|
||||||
######
|
######
|
||||||
## Start capsule
|
## Start capsule
|
||||||
@ -112,10 +122,6 @@ jobs:
|
|||||||
## Run some tests
|
## Run some tests
|
||||||
######
|
######
|
||||||
|
|
||||||
- name: Install root dependencies
|
|
||||||
run: yarn install
|
|
||||||
working-directory: frontend-monorepo
|
|
||||||
|
|
||||||
- name: Run Cypress tests
|
- name: Run Cypress tests
|
||||||
run: yarn nx run-many --target=e2e --all --record --key ${{ secrets.CYPRESS_RECORD_KEY }}
|
run: yarn nx run-many --target=e2e --all --record --key ${{ secrets.CYPRESS_RECORD_KEY }}
|
||||||
working-directory: frontend-monorepo
|
working-directory: frontend-monorepo
|
||||||
@ -131,7 +137,6 @@ jobs:
|
|||||||
######
|
######
|
||||||
|
|
||||||
- name: Logs
|
- name: Logs
|
||||||
if: ${{ always() }}
|
|
||||||
run: vegacapsule network logs > vega-capsule-logs.txt
|
run: vegacapsule network logs > vega-capsule-logs.txt
|
||||||
|
|
||||||
- uses: actions/upload-artifact@v2
|
- uses: actions/upload-artifact@v2
|
||||||
|
67
.github/workflows/capsule-cypress.yml
vendored
67
.github/workflows/capsule-cypress.yml
vendored
@ -3,8 +3,8 @@ name: Capsule tests
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
|
||||||
- develop
|
- develop
|
||||||
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
types:
|
types:
|
||||||
- opened
|
- opened
|
||||||
@ -19,6 +19,7 @@ jobs:
|
|||||||
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false }}
|
if: ${{ github.event_name == 'pull_request' && github.event.pull_request.draft == false }}
|
||||||
env:
|
env:
|
||||||
GO111MODULE: 'on'
|
GO111MODULE: 'on'
|
||||||
|
VEGA_VERSION: 'v0.55.0'
|
||||||
steps:
|
steps:
|
||||||
#######
|
#######
|
||||||
## Setup langs
|
## Setup langs
|
||||||
@ -46,29 +47,6 @@ jobs:
|
|||||||
fetch-depth: 0
|
fetch-depth: 0
|
||||||
path: './frontend-monorepo'
|
path: './frontend-monorepo'
|
||||||
|
|
||||||
# Checkout capsule to build local network
|
|
||||||
- name: Checkout capsule
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
repository: vegaprotocol/vegacapsule
|
|
||||||
ref: main
|
|
||||||
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
|
||||||
path: './capsule'
|
|
||||||
|
|
||||||
# Checkout vega
|
|
||||||
- name: Checkout Vega
|
|
||||||
uses: actions/checkout@v2
|
|
||||||
with:
|
|
||||||
repository: vegaprotocol/vega
|
|
||||||
ref: v0.54.0
|
|
||||||
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
|
||||||
path: './vega'
|
|
||||||
|
|
||||||
# Install frontend dependencies
|
|
||||||
- name: Install root dependencies
|
|
||||||
run: yarn install
|
|
||||||
working-directory: frontend-monorepo
|
|
||||||
|
|
||||||
# See affected apps to see if building all binaries is necessary
|
# See affected apps to see if building all binaries is necessary
|
||||||
- name: See affected apps
|
- name: See affected apps
|
||||||
run: echo AFFECTED=$(yarn nx print-affected --base=origin/${{github.base_ref}} --head=${{github.head_ref}} --select=projects) >> $GITHUB_ENV
|
run: echo AFFECTED=$(yarn nx print-affected --base=origin/${{github.base_ref}} --head=${{github.head_ref}} --select=projects) >> $GITHUB_ENV
|
||||||
@ -78,6 +56,30 @@ jobs:
|
|||||||
if: ${{ contains(env.AFFECTED, 'token') || contains(env.AFFECTED, 'token-e2e') || contains(env.AFFECTED, 'explorer') || contains(env.AFFECTED, 'explorer-e2e') }}
|
if: ${{ contains(env.AFFECTED, 'token') || contains(env.AFFECTED, 'token-e2e') || contains(env.AFFECTED, 'explorer') || contains(env.AFFECTED, 'explorer-e2e') }}
|
||||||
run: echo RUN_CAPSULE=true >> $GITHUB_ENV
|
run: echo RUN_CAPSULE=true >> $GITHUB_ENV
|
||||||
|
|
||||||
|
# Checkout capsule to build local network
|
||||||
|
- name: Checkout capsule
|
||||||
|
if: ${{ env.RUN_CAPSULE }}
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
repository: vegaprotocol/vegacapsule
|
||||||
|
ref: main
|
||||||
|
token: ${{ secrets.VEGA_CI_BOT_GITHUB_TOKEN }}
|
||||||
|
path: './capsule'
|
||||||
|
|
||||||
|
# Restore node_modules from cache if possible
|
||||||
|
- name: Restore node_modules from cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: |
|
||||||
|
frontend-monorepo/node_modules
|
||||||
|
/home/runner/.cache/Cypress
|
||||||
|
key: node_modules_cypress-${{ hashFiles('frontend-monorepo/yarn.lock') }}
|
||||||
|
|
||||||
|
# Install frontend dependencies
|
||||||
|
- name: Install root dependencies
|
||||||
|
run: yarn install --frozen-lockfile
|
||||||
|
working-directory: frontend-monorepo
|
||||||
|
|
||||||
#######
|
#######
|
||||||
## Build binaries
|
## Build binaries
|
||||||
#######
|
#######
|
||||||
@ -91,17 +93,20 @@ jobs:
|
|||||||
|
|
||||||
- name: Install Vega binaries
|
- name: Install Vega binaries
|
||||||
if: ${{ env.RUN_CAPSULE }}
|
if: ${{ env.RUN_CAPSULE }}
|
||||||
run: go install -v ./cmd/vega
|
run: |
|
||||||
working-directory: vega
|
wget 'https://github.com/vegaprotocol/vega/releases/download/${{ env.VEGA_VERSION }}/vega-linux-amd64.zip'
|
||||||
|
unzip vega-linux-amd64.zip -d ${{ env.GOBIN }}
|
||||||
|
|
||||||
- name: Install date-node binaries
|
- name: Install date-node binaries
|
||||||
if: ${{ env.RUN_CAPSULE }}
|
if: ${{ env.RUN_CAPSULE }}
|
||||||
run: go install ./cmd/data-node
|
run: |
|
||||||
working-directory: vega
|
wget 'https://github.com/vegaprotocol/vega/releases/download/${{ env.VEGA_VERSION }}/data-node-linux-amd64.zip'
|
||||||
|
unzip data-node-linux-amd64.zip -d ${{ env.GOBIN }}
|
||||||
|
|
||||||
- name: Install Vega wallet binaries
|
- name: Install Vega wallet binaries
|
||||||
run: go install ./cmd/vegawallet
|
run: |
|
||||||
working-directory: vega
|
wget 'https://github.com/vegaprotocol/vega/releases/download/${{ env.VEGA_VERSION }}/vegawallet-linux-amd64.zip'
|
||||||
|
unzip vegawallet-linux-amd64.zip -d ${{ env.GOBIN }}
|
||||||
|
|
||||||
######
|
######
|
||||||
## Start capsule
|
## Start capsule
|
||||||
@ -143,7 +148,7 @@ jobs:
|
|||||||
run: vegawallet service run --network fairground --automatic-consent --home ~/.vegacapsule/testnet/wallet &
|
run: vegawallet service run --network fairground --automatic-consent --home ~/.vegacapsule/testnet/wallet &
|
||||||
|
|
||||||
- name: Start service using capsule network
|
- name: Start service using capsule network
|
||||||
if: ${{ env.RUN_CAPSULE==true }}
|
if: ${{ env.RUN_CAPSULE }}
|
||||||
run: vegawallet service run --network DV --automatic-consent --home ~/.vegacapsule/testnet/wallet &
|
run: vegawallet service run --network DV --automatic-consent --home ~/.vegacapsule/testnet/wallet &
|
||||||
|
|
||||||
######
|
######
|
||||||
|
45
.github/workflows/test.yml
vendored
45
.github/workflows/test.yml
vendored
@ -3,50 +3,16 @@ name: Unit tests & build
|
|||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches:
|
branches:
|
||||||
- master
|
|
||||||
- develop
|
- develop
|
||||||
|
- main
|
||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
master:
|
|
||||||
name: Test and lint - main
|
|
||||||
runs-on: ubuntu-latest
|
|
||||||
permissions:
|
|
||||||
contents: 'read'
|
|
||||||
actions: 'read'
|
|
||||||
if: ${{ github.event_name != 'pull_request' }}
|
|
||||||
steps:
|
|
||||||
- name: Checkout
|
|
||||||
uses: actions/checkout@v3
|
|
||||||
with:
|
|
||||||
ref: ${{ github.event.pull_request.head.ref }}
|
|
||||||
fetch-depth: 0
|
|
||||||
- name: Derive appropriate SHAs for base and head for `nx affected` commands
|
|
||||||
uses: nrwl/nx-set-shas@v2
|
|
||||||
with:
|
|
||||||
main-branch-name: master
|
|
||||||
- name: Use Node.js 16
|
|
||||||
id: Node
|
|
||||||
uses: actions/setup-node@v3
|
|
||||||
with:
|
|
||||||
node-version: 16.14.0
|
|
||||||
- name: Install root dependencies
|
|
||||||
run: yarn install
|
|
||||||
- name: Check formatting
|
|
||||||
run: yarn nx format:check
|
|
||||||
- name: Lint affected
|
|
||||||
run: yarn nx affected:lint --max-warnings=0
|
|
||||||
- name: Test affected
|
|
||||||
run: yarn nx affected:test
|
|
||||||
- name: Build affected
|
|
||||||
run: yarn nx affected:build
|
|
||||||
pr:
|
pr:
|
||||||
name: Test and lint - PR
|
name: Test and lint - PR
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
permissions:
|
permissions:
|
||||||
contents: 'read'
|
contents: 'read'
|
||||||
actions: 'read'
|
actions: 'read'
|
||||||
if: ${{ github.event_name == 'pull_request' }}
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v3
|
uses: actions/checkout@v3
|
||||||
@ -55,14 +21,19 @@ jobs:
|
|||||||
- name: Derive appropriate SHAs for base and head for `nx affected` commands
|
- name: Derive appropriate SHAs for base and head for `nx affected` commands
|
||||||
uses: nrwl/nx-set-shas@v2
|
uses: nrwl/nx-set-shas@v2
|
||||||
with:
|
with:
|
||||||
main-branch-name: develop
|
main-branch-name: ${{ github.base_ref }}
|
||||||
- name: Use Node.js 16
|
- name: Use Node.js 16
|
||||||
id: Node
|
id: Node
|
||||||
uses: actions/setup-node@v3
|
uses: actions/setup-node@v3
|
||||||
with:
|
with:
|
||||||
node-version: 16.14.0
|
node-version: 16.14.0
|
||||||
|
- name: Restore node_modules from cache
|
||||||
|
uses: actions/cache@v3
|
||||||
|
with:
|
||||||
|
path: '**/node_modules'
|
||||||
|
key: node_modules-${{ hashFiles('**/yarn.lock') }}
|
||||||
- name: Install root dependencies
|
- name: Install root dependencies
|
||||||
run: yarn install
|
run: yarn install --frozen-lockfile
|
||||||
- name: Check formatting
|
- name: Check formatting
|
||||||
run: yarn nx format:check
|
run: yarn nx format:check
|
||||||
- name: Lint affected
|
- name: Lint affected
|
||||||
|
Loading…
Reference in New Issue
Block a user