This repository has been archived by the owner on Nov 28, 2022. It is now read-only.
87 lines (77 loc) · 2.92 KB
/
ci-test.yaml
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
# NOTE: This name appears in GitHub's Checks API and in workflow's status badge.
name: ci-test
# Trigger the workflow when:
on:
# A push occurs to one of the matched branches.
push:
branches:
- main
- stable/*
# Or when a pull request event occurs for a pull request against one of the
# matched branches.
pull_request:
branches:
- main
- stable/*
# Cancel in-progress jobs on same branch.
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs:
test-go:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
POSTGRES_HOST: 127.0.0.1
POSTGRES_PORT: 5432
POSTGRES_DB: postgres
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
env:
OASIS_CORE_VERSION: "22.0"
OASIS_NODE: ${{ github.workspace }}/oasis_core/oasis-node
OASIS_NET_RUNNER: ${{ github.workspace }}/oasis_core/oasis-net-runner
EMERALD_PARATIME_VERSION: 7.0.0-rc2
GATEWAY__CHAIN_ID: 42261
EMERALD_PARATIME: ${{ github.workspace }}/oasis_core/emerald-paratime
OASIS_NODE_DATADIR: /tmp/eth-runtime-test
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go 1.17
uses: actions/setup-go@v2.2.0
with:
go-version: "1.17.x"
- name: Install prerequisites
run: |
sudo apt update && sudo apt install bubblewrap unzip -y
wget "https://github.com/oasisprotocol/oasis-core/releases/download/v${OASIS_CORE_VERSION}/oasis_core_${OASIS_CORE_VERSION}_linux_amd64.tar.gz"
tar xfvz "oasis_core_${OASIS_CORE_VERSION}_linux_amd64.tar.gz"
mkdir -p "$(dirname ${OASIS_NODE})"
mv "oasis_core_${OASIS_CORE_VERSION}_linux_amd64/oasis-node" "${OASIS_NODE}"
mkdir -p "$(dirname ${OASIS_NET_RUNNER})"
mv "oasis_core_${OASIS_CORE_VERSION}_linux_amd64/oasis-net-runner" "${OASIS_NET_RUNNER}"
mkdir -p "$(dirname ${EMERALD_PARATIME})"
wget "https://github.com/oasisprotocol/emerald-paratime/releases/download/v${EMERALD_PARATIME_VERSION}/emerald-paratime.orc" -O "${EMERALD_PARATIME}.orc"
unzip "${EMERALD_PARATIME}.orc"
mv runtime.elf "${EMERALD_PARATIME}"
chmod a+x "${EMERALD_PARATIME}"
- name: Spinup oasis-node
run: tests/tools/spinup-oasis-stack.sh > /dev/null &
- name: Unit tests with coverage
run: go test -race -coverpkg=./... -coverprofile=coverage.txt -covermode=atomic -v ./...
- name: Shutdown oasis-node
run: killall oasis-node
if: always()
- name: Upload oasis-node logs artifacts
if: always()
uses: actions/upload-artifact@v2
with:
name: oasis-node-logs
path: ${{ env.OASIS_NODE_DATADIR }}/**/*.log
- name: Upload to codecov.io
uses: codecov/codecov-action@v2.1.0