|
| 1 | +name: Build |
| 2 | +on: [push, pull_request] |
| 3 | + |
| 4 | +env: |
| 5 | + CARGO_TERM_COLOR: always |
| 6 | + |
| 7 | +jobs: |
| 8 | + agent: |
| 9 | + runs-on: "${{ matrix.os }}" |
| 10 | + steps: |
| 11 | + - uses: actions/checkout@v2 |
| 12 | + - uses: actions/cache@v2 |
| 13 | + env: |
| 14 | + cache-name: cache-rust-target |
| 15 | + with: |
| 16 | + path: | |
| 17 | + src/agent/target |
| 18 | + ~/.cargo/registry |
| 19 | + ~/.cargo/git |
| 20 | + ~/.cargo/bin |
| 21 | + ~/.cache/sccache |
| 22 | + key: agent-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} |
| 23 | + restore-keys: | |
| 24 | + agent-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} |
| 25 | + agent-${{ runner.os }} |
| 26 | + - name: Linux Prereqs |
| 27 | + run: | |
| 28 | + sudo apt-get -y update |
| 29 | + sudo apt-get -y install libssl1.0-dev libunwind-dev |
| 30 | + if: "${{ runner.os == 'Linux' }}" |
| 31 | + - run: src/ci/agent.sh |
| 32 | + shell: bash |
| 33 | + |
| 34 | + with: |
| 35 | + name: build-artifacts |
| 36 | + path: artifacts |
| 37 | + strategy: |
| 38 | + matrix: |
| 39 | + os: |
| 40 | + - ubuntu-18.04 |
| 41 | + - windows-2019 |
| 42 | + azcopy: |
| 43 | + runs-on: ubuntu-18.04 |
| 44 | + steps: |
| 45 | + - uses: actions/checkout@v2 |
| 46 | + - run: src/ci/azcopy.sh |
| 47 | + |
| 48 | + with: |
| 49 | + name: build-artifacts |
| 50 | + path: artifacts |
| 51 | + cli: |
| 52 | + needs: |
| 53 | + - onefuzztypes |
| 54 | + runs-on: windows-2019 |
| 55 | + steps: |
| 56 | + - uses: actions/checkout@v2 |
| 57 | + - run: src/ci/set-versions.sh |
| 58 | + - uses: actions/setup-python@v2 |
| 59 | + with: |
| 60 | + python-version: 3.7 |
| 61 | + |
| 62 | + with: |
| 63 | + name: build-artifacts |
| 64 | + path: artifacts |
| 65 | + - name: Build |
| 66 | + shell: bash |
| 67 | + run: | |
| 68 | + set -ex |
| 69 | + ls artifacts |
| 70 | + cd src/cli |
| 71 | + pip install -r requirements-dev.txt |
| 72 | + pip-licenses -uf json > onefuzz/data/licenses.json |
| 73 | + python setup.py sdist bdist_wheel |
| 74 | + pip install -r ./requirements.txt ../../artifacts/sdk/*.whl |
| 75 | + pip install six |
| 76 | + pyinstaller onefuzz/__main__.py --onefile --name onefuzz --additional-hooks-dir extra/pyinstaller --hidden-import='pkg_resources.py2_warn' --exclude-module tkinter --exclude-module PySide2 --exclude-module PIL.ImageDraw --exclude-module Pillow |
| 77 | + ./dist/onefuzz.exe --version |
| 78 | + mkdir -p ${GITHUB_WORKSPACE}/artifacts/windows-cli/ |
| 79 | + mkdir -p ${GITHUB_WORKSPACE}/artifacts/sdk/ |
| 80 | + cp dist/*.tar.gz dist/*.whl ${GITHUB_WORKSPACE}/artifacts/sdk/ |
| 81 | + cp dist/onefuzz.exe ${GITHUB_WORKSPACE}/artifacts/windows-cli/ |
| 82 | + |
| 83 | + with: |
| 84 | + name: build-artifacts |
| 85 | + path: artifacts |
| 86 | + - name: lint |
| 87 | + run: | |
| 88 | + cd src/cli |
| 89 | + pip install -r requirements-lint.txt |
| 90 | + flake8 . |
| 91 | + isort --profile black ./onefuzz ./examples/ ./tests/ --check |
| 92 | + mypy . --ignore-missing-imports |
| 93 | + pytest -v tests |
| 94 | +
|
| 95 | + # set a minimum confidence to ignore known false positives |
| 96 | + vulture --min-confidence 61 onefuzz |
| 97 | + onefuzztypes: |
| 98 | + runs-on: ubuntu-18.04 |
| 99 | + steps: |
| 100 | + - uses: actions/checkout@v2 |
| 101 | + - run: src/ci/set-versions.sh |
| 102 | + - uses: actions/setup-python@v2 |
| 103 | + with: |
| 104 | + python-version: 3.7 |
| 105 | + - run: src/ci/onefuzztypes.sh |
| 106 | + |
| 107 | + with: |
| 108 | + name: build-artifacts |
| 109 | + path: artifacts |
| 110 | + proxy: |
| 111 | + runs-on: ubuntu-18.04 |
| 112 | + steps: |
| 113 | + - uses: actions/checkout@v2 |
| 114 | + - uses: actions/cache@v2 |
| 115 | + env: |
| 116 | + cache-name: cache-rust-proxy |
| 117 | + with: |
| 118 | + path: | |
| 119 | + src/proxy-manager/target |
| 120 | + ~/.cargo/registry |
| 121 | + ~/.cargo/git |
| 122 | + ~/.cargo/bin |
| 123 | + ~/.cache/sccache |
| 124 | + key: proxy-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} |
| 125 | + restore-keys: | |
| 126 | + proxy-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }} |
| 127 | + proxy-${{ runner.os }} |
| 128 | + - run: src/ci/proxy.sh |
| 129 | + |
| 130 | + with: |
| 131 | + name: build-artifacts |
| 132 | + path: artifacts |
| 133 | + service: |
| 134 | + needs: |
| 135 | + - onefuzztypes |
| 136 | + runs-on: ubuntu-18.04 |
| 137 | + steps: |
| 138 | + - uses: actions/checkout@v2 |
| 139 | + - run: src/ci/set-versions.sh |
| 140 | + - uses: actions/setup-python@v2 |
| 141 | + with: |
| 142 | + python-version: 3.7 |
| 143 | + |
| 144 | + with: |
| 145 | + name: build-artifacts |
| 146 | + path: artifacts |
| 147 | + - name: Build Service |
| 148 | + run: | |
| 149 | + cd src/api-service/__app__ |
| 150 | + echo ${GITHUB_RUN_ID} | tee onefuzzlib/build.id |
| 151 | + echo ${GITHUB_SHA} | tee onefuzzlib/git.version |
| 152 | + pip install --target="./.python_packages/lib/site-packages" -r ./requirements.txt ${GITHUB_WORKSPACE}/artifacts/sdk/onefuzztypes-*.whl |
| 153 | + zip -r api-service.zip . |
| 154 | + mkdir -p ${GITHUB_WORKSPACE}/artifacts/service |
| 155 | + cp api-service.zip ${GITHUB_WORKSPACE}/artifacts/service |
| 156 | + |
| 157 | + with: |
| 158 | + name: build-artifacts |
| 159 | + path: artifacts |
| 160 | + - name: lint |
| 161 | + run: | |
| 162 | + cd src/api-service |
| 163 | + rm -rf __app__/.python_packages |
| 164 | + pip install ${GITHUB_WORKSPACE}/artifacts/sdk/onefuzztypes-*.whl |
| 165 | + pip install -r __app__/requirements.txt |
| 166 | + pip install -r requirements-dev.txt |
| 167 | + pytest |
| 168 | + flake8 . |
| 169 | + isort --profile black ./__app__/ ./tests --check |
| 170 | + mypy __app__ |
| 171 | +
|
| 172 | + # set a minimum confidence to ignore known false positives |
| 173 | + vulture --min-confidence 61 __app__ |
| 174 | + afl: |
| 175 | + runs-on: ubuntu-18.04 |
| 176 | + steps: |
| 177 | + - uses: actions/checkout@v2 |
| 178 | + - run: src/ci/afl.sh |
| 179 | + |
| 180 | + with: |
| 181 | + name: build-artifacts |
| 182 | + path: artifacts |
| 183 | + radamsa-linux: |
| 184 | + runs-on: ubuntu-18.04 |
| 185 | + steps: |
| 186 | + - uses: actions/checkout@v2 |
| 187 | + - run: src/ci/radamsa-linux.sh |
| 188 | + |
| 189 | + with: |
| 190 | + name: build-artifacts |
| 191 | + path: artifacts |
| 192 | + package: |
| 193 | + needs: |
| 194 | + - agent |
| 195 | + - azcopy |
| 196 | + - cli |
| 197 | + - onefuzztypes |
| 198 | + - proxy |
| 199 | + - service |
| 200 | + - afl |
| 201 | + - radamsa-linux |
| 202 | + runs-on: ubuntu-18.04 |
| 203 | + steps: |
| 204 | + - uses: actions/checkout@v2 |
| 205 | + |
| 206 | + with: |
| 207 | + name: build-artifacts |
| 208 | + path: artifacts |
| 209 | + - name: Package Onefuzz |
| 210 | + run: | |
| 211 | + set -ex |
| 212 | + find artifacts |
| 213 | + mkdir release-artifacts |
| 214 | + cp -r src/runtime-tools src/deployment/tools |
| 215 | + cp artifacts/azcopy/azcopy artifacts/azcopy/ThirdPartyNotice.txt src/deployment/tools/linux |
| 216 | + cp artifacts/azcopy/azcopy.exe artifacts/azcopy/ThirdPartyNotice.txt src/deployment/tools/win64 |
| 217 | + cp artifacts/agent/onefuzz-supervisor.exe src/deployment/tools/win64/ |
| 218 | + cp artifacts/agent/onefuzz-agent.exe src/deployment/tools/win64/ |
| 219 | + cp artifacts/agent/onefuzz-supervisor src/deployment/tools/linux/ |
| 220 | + cp artifacts/agent/onefuzz-agent src/deployment/tools/linux/ |
| 221 | + cp artifacts/proxy/onefuzz-proxy-manager src/deployment/tools/linux/ |
| 222 | + cp artifacts/service/api-service.zip src/deployment |
| 223 | + cp -r artifacts/third-party src/deployment |
| 224 | + cp -r src/agent/script/linux/libfuzzer-coverage src/deployment/tools/linux/libfuzzer-coverage |
| 225 | + cp -r src/agent/script/win64/libfuzzer-coverage src/deployment/tools/win64/libfuzzer-coverage |
| 226 | + echo $GITHUB_RUN_ID | tee src/deployment/.build.id |
| 227 | + echo $GITHUB_SHA | tee src/deployment/.sha |
| 228 | + cp CURRENT_VERSION src/deployment/VERSION |
| 229 | + (cd src/deployment ; zip -r onefuzz-deployment-$(cat VERSION).zip . ) |
| 230 | + cp src/deployment/onefuzz-deployment*zip release-artifacts |
| 231 | + cp -r artifacts/sdk release-artifacts |
| 232 | + cp -r artifacts/windows-cli/onefuzz.exe release-artifacts/onefuzz-cli-$(cat CURRENT_VERSION).exe |
| 233 | + |
| 234 | + with: |
| 235 | + name: release-artifacts |
| 236 | + path: release-artifacts |
0 commit comments