-
Notifications
You must be signed in to change notification settings - Fork 206
88 lines (84 loc) · 2.72 KB
/
build-and-test.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
name: BuildAndTest
on: [pull_request, workflow_dispatch]
env:
CHIFRA_PATH: src/apps/chifra
GO_VERSION: ^1.20
jobs:
golangci:
name: Lint
runs-on: ubuntu-latest
steps:
-
uses: actions/checkout@v3
-
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
cache: false
cache-dependency-path: ${{ env.CHIFRA_PATH }}/go.sum
-
name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
# Optional: version of golangci-lint to use in form of v1.2 or v1.2.3 or `latest` to use the latest version
version: latest
# Optional: working directory, useful for monorepos
working-directory: ${{ env.CHIFRA_PATH }}
# Optional: set location of the config file (if it is not in the root directory)
args: --timeout=5m --verbose
Build:
needs: golangci
runs-on: ubuntu-20.04
steps:
-
name: Checkout TrueBlocks repo
uses: actions/checkout@v2
-
name: Use a certain version of go
uses: actions/setup-go@v4
with:
go-version: ${{ env.GO_VERSION }}
-
name: Install prerequistes
run: |
sudo apt-get update
sudo apt-get upgrade
sudo apt-get install build-essential git cmake
sudo apt-get install python3 tree jq
sudo apt-get install libcurl3-dev clang-format
-
name: Run basic golang unit tests
run: |
mkdir -p build
cd build
cmake ../src
cd other/install
make
cd ../../../
cd ${{ env.CHIFRA_PATH }}
go test ./...
RemoteTests:
needs: Build
runs-on: ubuntu-latest
steps:
-
name: Run tests remotely
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.TESTING_HOST }}
username: ${{ secrets.TESTING_USERNAME }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
command_timeout: 40m
script_stop: true
script: |
rm -rf testing/${{ github.sha }}
mkdir -p testing/${{ github.sha }}
mkdir -p test_results/${{ github.sha }}
cd testing/${{ github.sha }}
git clone --quiet https://github.com/${{ github.repository }}
cd trueblocks-core
git checkout ${{ github.head_ref }}
cd src/other/build_assets/remote_testing
CONFIG_FILE=$HOME/trueBlocks.toml bash test_with_docker.sh ${{ github.repository }} ${{ github.sha }} ${{ github.head_ref }} test-all
docker system prune -af --filter "until=1h"
echo "Results placed in /home/testuser/testing/${{ github.sha }}"