-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (131 loc) · 4.05 KB
/
ci.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
134
135
136
137
138
name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-container:
runs-on: ubuntu-latest
container: docker:20.10.24-git
permissions:
contents: read
packages: write
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: True
- name: Log in to Container registry
uses: docker/login-action@v2
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
uses: docker/build-push-action@v4
with:
context: .
file: diana/docker/Dockerfile.tvm
push: true
labels: ${{ steps.meta.outputs.labels }}
tags: ${{ steps.meta.outputs.tags }}
outputs:
container_name: ${{ steps.meta.outputs.tags }}
build-htvm-release:
runs-on: ubuntu-latest
needs: build-container
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: True
- name: Cache HTVM Build if C++ is not altered
id: cache-build
uses: actions/cache@v3
with:
path: build
key: ${{ hashFiles('src', 'cmake', 'include') }}
- name: Build HTVM Release
if: steps.cache-build.outputs.cache-hit != 'true'
uses: addnab/docker-run-action@v3
with:
image: ${{ needs.build-container.outputs.container_name }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
options: -v ${{ github.workspace }}:/tvm-fork
run: |
mkdir build
cp diana/config.cmake build
cd build
cmake ..
make -j$(nproc)
cd ..
- name: Store HTVM Build
uses: actions/upload-artifact@v3
with:
name: build
path: build
test-htvm-unit:
runs-on: ubuntu-latest
needs: [build-container, build-htvm-release]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: True
- name: Download previous HTVM build
uses: actions/download-artifact@v3
with:
name: build
path: build
- name: Run unit tests
uses: addnab/docker-run-action@v3
with:
image: ${{ needs.build-container.outputs.container_name }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
options: -v ${{ github.workspace }}:/tvm-fork
run: |
export TVM_HOME=`pwd`
export PYTHONPATH=$PYTHONPATH:`pwd`/python
pytest tests/python/contrib/test_soma_dory
test-htvm-e2e:
runs-on: ubuntu-latest
needs: [build-container, build-htvm-release]
steps:
- name: Checkout repository
uses: actions/checkout@v3
with:
submodules: True
lfs: True
- name: Download previous HTVM build
uses: actions/download-artifact@v3
with:
name: build
path: build
- name: Run end-to-end tests
uses: addnab/docker-run-action@v3
with:
image: ${{ needs.build-container.outputs.container_name }}
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
options: -v ${{ github.workspace }}:/tvm-fork
run: |
export TVM_HOME=`pwd`
export PYTHONPATH=$PYTHONPATH:`pwd`/python
cd diana/byoc
echo "Dory version is "`git --git-dir /dory/.git rev-parse HEAD`
pytest -v test.py