forked from smartcontractkit/chainlink
-
Notifications
You must be signed in to change notification settings - Fork 0
113 lines (110 loc) · 3.97 KB
/
continuous-integration-workflow.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
name: CI
on: [push]
jobs:
core:
strategy:
fail-fast: false
matrix:
cmd: ['go_core_tests']
name: Core Tests
runs-on: ubuntu-latest
container:
image: smartcontract/builder:1.0.42
credentials:
username: ${{ secrets.DOCKER_READONLY_USERNAME }}
password: ${{ secrets.DOCKER_READONLY_PASSWORD }}
env:
DATABASE_URL: postgres://chainlink@postgres:5432/chainlink_test?sslmode=disable
LOG_LEVEL: debug
services:
postgres:
image: postgres:14
credentials:
username: ${{ secrets.DOCKER_READONLY_USERNAME }}
password: ${{ secrets.DOCKER_READONLY_PASSWORD }}
env:
POSTGRES_USER: postgres
POSTGRES_HOST_AUTH_METHOD: trust
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Set up Postgres user
uses: docker://postgres
with:
args: psql -v ON_ERROR_STOP=1 --username postgres -h postgres -c "CREATE USER chainlink NOSUPERUSER CREATEDB;"
- name: Install Postgres for CLI tools
run: wget --quiet -O - https://packages.cloud.google.com/apt/doc/apt-key.gpg | apt-key add - && wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | apt-key add - && echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" | tee /etc/apt/sources.list.d/pgdg.list && apt update && apt install -y postgresql-client-14
- name: Get Yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn cache dir)"
- name: Cache Yarn dependencies
uses: actions/cache@v2
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: yarn-${{ env.CACHE_VERSION }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
yarn-${{ env.CACHE_VERSION }}
- name: Install Yarn dependencies
run: make yarndep
- name: Cache Go vendor packages
uses: actions/cache@v2
with:
path: /go/pkg/mod
key: go-mod-${{ env.CACHE_VERSION }}-${{ hashFiles('go.sum') }}
restore-keys: |
go-mod-${{ env.CACHE_VERSION }}
- name: Download Go vendor packages
run: go mod download
- name: Compile all contracts
run: ./contracts/scripts/native_solc_compile_all
- name: Verify local solc binaries
run: ./tools/ci/check_solc_hashes
- name: Setup DB
run: go run ./core local db preparetest
- name: Run tests
run: ./tools/bin/${{ matrix.cmd }}
- name: Store logs artifacts on failure
if: failure()
uses: actions/upload-artifact@v2.2.4
with:
name: ${{ matrix.cmd }}_logs
path: ./output.txt
- name: Print postgres logs
if: always()
uses: docker://docker:latest
with:
args: logs ${{ job.services.postgres.id }}
prepublish_npm:
name: Prepublish NPM
runs-on: ubuntu-latest
container:
image: smartcontract/builder:1.0.42
credentials:
username: ${{ secrets.DOCKER_READONLY_USERNAME }}
password: ${{ secrets.DOCKER_READONLY_PASSWORD }}
steps:
- name: Checkout the repo
uses: actions/checkout@v2
- name: Yarn cache
uses: actions/cache@v2
env:
cache-name: yarn-cache
with:
path: |
~/.npm
~/.cache
**/node_modules
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('yarn.lock') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- run: yarn install --frozen-lockfile
- name: Run prepublish NPM test
run: ./tools/ci/prepublish_npm_test