forked from GrammaTech/ddisasm
-
Notifications
You must be signed in to change notification settings - Fork 0
147 lines (142 loc) · 5.3 KB
/
actions.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
139
140
141
142
143
144
145
146
147
name: DDisasm Build
on: [push]
jobs:
docker:
runs-on: ubuntu-latest
permissions:
packages: write
strategy:
matrix:
os: [focal]
include:
- os: focal
file_suffix: ubuntu20
outputs:
image_tag: ${{ steps.vars.outputs.image_tag }}
image_path: ${{ steps.vars.outputs.image_path }}
steps:
# We must generate output variables here in order to ensure the
# reference is lowercase, even if the repository reference is not
# (e.g., because of the organization "GrammaTech").
# For the tag, we replace forward slashes with hyphens and use the tag
# the "latest" for the "main" branch.
# We'd like to just generate the environment variables, but the `env`
# context is not available in the "jobs.<id>.container" field, despite
# what the Context Availability documentation says. See:
# https://docs.github.com/en/actions/learn-github-actions/contexts#context-availability
- id: vars
run: |
export IMAGE_TAG=$([ "${{ github.ref_name }}" == "main" ] && echo latest || echo ${{ github.ref_name }} | sed -e "s/\//-/g")
echo "image_tag=$IMAGE_TAG" >> $GITHUB_ENV
echo "image_tag=$IMAGE_TAG" >> $GITHUB_OUTPUT
export IMAGE_PATH=$(echo ghcr.io/${{ github.repository }}/ | awk '{print tolower($0)}')
echo "image_path=$IMAGE_PATH" >> $GITHUB_ENV
echo "image_path=$IMAGE_PATH" >> $GITHUB_OUTPUT
- uses: actions/checkout@v4
- name: Kaniko build
uses: aevea/[email protected]
with:
registry: ghcr.io
image: ${{ matrix.os }}
password: ${{ secrets.GITHUB_TOKEN }}
cache: true
cache_registry: ${{ matrix.os }}-cache
tag: ${{ env.image_tag }}
build_file: .ci/Dockerfile.${{ matrix.file_suffix }}
build:
runs-on: ubuntu-latest
permissions:
packages: read
strategy:
matrix:
os: [focal]
compiler: [g++, clang++]
needs: docker
env:
BUILD_TYPE: Release
container: ${{ needs.docker.outputs.image_path }}${{ matrix.os }}:${{ needs.docker.outputs.image_tag }}
steps:
- name: Install capstone, gtirb, gtirb-pprinter
run: |
curl https://download.grammatech.com/gtirb/files/apt-repo/conf/apt.gpg.key | apt-key add -
echo "deb https://download.grammatech.com/gtirb/files/apt-repo ${{ matrix.os }} unstable" >> /etc/apt/sources.list
apt-get update
apt-get -y install libcapstone-dev=1:5.0.0-gtdev libgtirb libgtirb-dev libgtirb-pprinter libgtirb-pprinter-dev gtirb-pprinter
- name: Checkout ddisasm
uses: actions/checkout@v4
- name: Build
run: |
mkdir build
cd build
cmake -DCMAKE_CXX_COMPILER=${{ matrix.compiler }} -DCMAKE_BUILD_TYPE=${BUILD_TYPE} -DLIEF_ROOT=/usr/ ..
make
- name: Upload artifacts
uses: actions/upload-artifact@v4
with:
name: ddisasm-build-${{ matrix.os }}-${{ matrix.compiler }}
path: build
test:
runs-on: ubuntu-latest
permissions:
packages: read
strategy:
matrix:
os: [focal]
compiler: [g++, clang++]
needs: [docker, build]
container: ${{ needs.docker.outputs.image_path }}${{ matrix.os }}:${{ needs.docker.outputs.image_tag }}
steps:
# Checkout
- name: Checkout repository
uses: actions/checkout@v4
# Install deps
- name: Install capstone, gtirb, gtirb-pprinter
run: |
curl https://download.grammatech.com/gtirb/files/apt-repo/conf/apt.gpg.key | apt-key add -
echo "deb https://download.grammatech.com/gtirb/files/apt-repo ${{ matrix.os }} unstable" >> /etc/apt/sources.list
apt-get update
apt-get -y install libcapstone-dev=1:5.0.0-gtdev libgtirb libgtirb-dev libgtirb-pprinter libgtirb-pprinter-dev gtirb-pprinter
pip3 install https://download.grammatech.com/gtirb/files/python/gtirb-unstable-py3-none-any.whl
pip3 install -r requirements-dev.txt
# Download artifacts
- name: Download build artifacts
uses: actions/download-artifact@v4
with:
name: ddisasm-build-${{ matrix.os }}-${{ matrix.compiler }}
path: build
- run: chmod +x build/bin/*
- run: mkdir ${HOME}/.wine
# Run tests
- run: cd build && PATH=$(pwd)/bin:$PATH ctest -V
build-pages:
runs-on: ubuntu-latest
permissions:
packages: read
needs: docker
container: ${{ needs.docker.outputs.image_path }}focal:${{ needs.docker.outputs.image_tag }}
steps:
- name: Checkout ddisasm
uses: actions/checkout@v4
- name: Generate API documentation
run: |
cd doc
pip3 install -r requirements-docs.txt
BUILDDIR=../public make -e
- name: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3
with:
path: public
deploy-pages:
needs: build-pages
if: github.ref == 'refs/heads/main'
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4