forked from gnolang/gno
-
Notifications
You must be signed in to change notification settings - Fork 0
134 lines (122 loc) · 3.92 KB
/
gnovm.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
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
name: gnovm
on:
pull_request:
paths:
- "go.sum"
- "gnovm/**.go"
- "gnovm/**.gno"
- "examples/**.gno"
- "gnovm/**/go.sum"
- "gnovm/Makefile"
- "tm2/**.go"
- ".github/workflows/gnovm.yml"
# Until the codecov issue is resolved, it's essential to run the tests for gnovm, tm2, and gno.land concurrently.
- "gnovm/**"
- "tm2/**"
- "gno.land/**"
- "examples/**"
- ".github/workflows/**"
push:
branches: [ "master" ]
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
build:
strategy:
fail-fast: false
matrix:
goversion: # two latest versions
- "1.20.x"
- "1.21.x"
goenv: # TODO: replace with pairs, so it's easier to read in the GH interface.
- "GOARCH=amd64 GOOS=linux"
- "GOARCH=wasm GOOS=js"
program:
- "gno"
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.goversion }}
- name: go install
working-directory: gnovm
run: ${{ matrix.goenv }} go install ./cmd/${{ matrix.program }}
test:
strategy:
fail-fast: false
matrix:
goversion:
- "1.20.x"
- "1.21.x"
args:
- _test.cmd
- _test.pkg
- _test.gnolang.native
- _test.gnolang.stdlibs
- _test.gnolang.realm
- _test.gnolang.pkg0
- _test.gnolang.pkg1
- _test.gnolang.pkg2
- _test.gnolang.other
runs-on: ubuntu-latest
timeout-minutes: 15
env:
COVERAGE_DIR: "/tmp/coverage"
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v4
with:
go-version: ${{ matrix.goversion }}
- name: test
working-directory: gnovm
env:
TXTARCOVERDIR: ${{ env.COVERAGE_DIR }}
run: |
mkdir -p $COVERAGE_DIR
# Setup testing environements variables
export GOPATH=$HOME/go
export GOTEST_FLAGS="-v -p 1 -timeout=30m -covermode=atomic -test.gocoverdir=$COVERAGE_DIR"
# Run target test
make ${{ matrix.args }}
- uses: actions/upload-artifact@v3
if: ${{ runner.os == 'Linux' && matrix.goversion == '1.21.x' }}
with:
name: ${{runner.os}}-coverage-gnovm-${{ matrix.args}}-${{matrix.goversion}}
path: ${{ env.COVERAGE_DIR }}
upload-coverage:
needs: test
runs-on: ubuntu-latest
env:
COVERAGE_DATA: /tmp/coverage/coverage-raw
COVERAGE_OUTPUT: /tmp/coverage/coverage-out
COVERAGE_PROFILE: /tmp/coverage/coverage.txt
steps:
- run: mkdir -p $COVERAGE_DATA $COVERAGE_OUTPUT
- name: Download all previous coverage data artifacts
uses: actions/download-artifact@v3
with:
path: ${{ env.COVERAGE_DATA }}
- uses: actions/setup-go@v4
with:
go-version: "1.21.x"
- name: Merge coverages
working-directory: ${{ env.COVERAGE_DATA }}
run: |
# Create coverage directory list separate by comma
export COVERAGE_DIRS="$(ls | tr '\n' ',' | sed s/,$//)"
# Merge all coverage data directories from previous tests
go tool covdata merge -v 1 -i="$COVERAGE_DIRS" -o $COVERAGE_OUTPUT
# Print coverage percent for debug purpose if needed
echo 'coverage results:'
go tool covdata percent -i=$COVERAGE_OUTPUT
# Generate coverage profile
go tool covdata textfmt -v 1 -i=$COVERAGE_OUTPUT -o $COVERAGE_PROFILE
- name: Upload combined coverage to Codecov
uses: codecov/codecov-action@v3
with:
files: ${{ env.COVERAGE_PROFILE }}
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: ${{ github.repository == 'gnolang/gno' }}