78 lines (76 loc) · 2.94 KB
/
build.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
name: "Build workflow"
on:
pull_request:
push:
tags:
- v**
branches:
- main
env:
SANDBOX_CONFIG: dev
SANDBOX_GENESIS: genesis/dev/genesis.json
jobs:
build-test:
runs-on: ubuntu-20.04
container: python:${{ matrix.python }}
strategy:
matrix:
python: [ "3.8", "3.9", "3.10" ]
steps:
- run: python3 --version
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: pip, lint, and units
run: make build-and-test
run-integration-tests:
runs-on: ubuntu-20.04
strategy:
matrix:
python: [ "3.8", "3.9", "3.10" ]
steps:
- name: Check out code
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: actions/setup-python@v3
with:
python-version: "${{ matrix.python }}"
- name: Test Python version
run: |
installed="$(python --version)"
expected="${{ matrix.python }}"
echo $installed
[[ $installed =~ "Python ${expected}" ]] && echo "Configured Python" || (echo "Failed to configure Python" && exit 1)
- name: Install required os level applications
run: |
sudo apt update -y
sudo apt install -y curl git nodejs
sudo apt -y install ca-certificates curl gnupg lsb-release
sudo curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /usr/share/keyrings/docker-archive-keyring.gpg
sudo echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/docker-archive-keyring.gpg] https://download.docker.com/linux/ubuntu \
$(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
sudo apt update
sudo apt -y install docker-ce docker-ce-cli containerd.io
- name: Setup docker compose
run: |
sudo curl -L "https://github.com/docker/compose/releases/download/1.29.2/docker-compose-$(uname -s)-$(uname -m)" -o /usr/local/bin/docker-compose
sudo chmod +x /usr/local/bin/docker-compose
sudo ln -s /usr/local/bin/docker-compose /usr/bin/docker-compose
docker-compose --version
- name: Check cache for Docker layers
uses: satackey/action-docker-layer-caching@v0.0.11
# Ignore the failure of a step and avoid terminating the job.
continue-on-error: true
with:
key: docker-layer-caching-${{ github.workflow }}-${{ hashFiles(env.SANDBOX_CONFIG, env.SANDBOX_GENESIS) }}-{hash}
restore-keys: docker-layer-caching-${{ github.workflow }}-${{ hashFiles(env.CONFIG, env.SANDBOX_GENESIS) }}-
- name: Create sandbox
uses: lucasvanmol/algorand-sandbox-action@v1
with:
config: ${{ env.SANDBOX_CONFIG }}
- name: Setup integration test environment
run: make pip-development unit-test
- name: Run integration tests
run: make gh-blackbox