aboutsummaryrefslogtreecommitdiffstats
path: root/.github/workflows/ci.yml
blob: 7f4d6dcf260f2994df224112aa2a77c78cd988d3 (plain)
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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
# Copyright 2020 syzkaller project authors. All rights reserved.
# Use of this source code is governed by Apache 2 LICENSE that can be found in the LICENSE file.

# GitHub workflow reference:
# https://help.github.com/en/actions/reference/workflow-syntax-for-github-actions

name: ci
on: [push, pull_request]
permissions:
  contents: read

# https://stackoverflow.com/questions/66335225/how-to-cancel-previous-runs-in-the-pr-when-you-push-new-commitsupdate-the-curre
concurrency:
  group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
  cancel-in-progress: true

jobs:
  aux:
    runs-on: ubuntu-latest
    container: gcr.io/syzkaller/env:latest
    env:
      GOPATH: /__w/syzkaller/syzkaller/gopath
      CI: true
      TERM: dumb
    steps:
      # Checks out syzkaller repo at the path.
      - name: checkout
        uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
        with:
          path: gopath/src/github.com/google/syzkaller
          # This is needed for tools/check-commits.sh
          fetch-depth: 100
      - id: get-date
        run: echo "date=$(/bin/date -u "+%Y%m%d")" >> $GITHUB_OUTPUT
        shell: bash
      - name: update cache
        uses: actions/cache@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
        with:
          path: /syzkaller/.cache
          key: ${{ runner.os }}-syzenv-${{ steps.get-date.outputs.date }}
      # Run make presubmit_aux.
      - name: run
        env:
          GITHUB_PR_HEAD_SHA: ${{ github.event.pull_request.head.sha }}
          GITHUB_PR_BASE_SHA: ${{ github.event.pull_request.base.sha }}
          GITHUB_PR_COMMITS: ${{ github.event.pull_request.commits }}
        run: |
          cd gopath/src/github.com/google/syzkaller
          .github/workflows/run.sh make presubmit_aux

  build:
    runs-on: syz-env-x86
    env:
      GOPATH: /__w/syzkaller/syzkaller/gopath
      CI: true
      TERM: dumb
      GITHUB_ACTIONS: true
    steps:
      - name: checkout
        uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
        with:
          path: gopath/src/github.com/google/syzkaller
      - name: restore cache
        uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
        with:
          path: /syzkaller/.cache
          key: ${{ runner.os }}-syzenv-
      - name: run
        run: |
          cd gopath/src/github.com/google/syzkaller
          .github/workflows/run.sh make presubmit_build
      - name: codecov
        uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be # v4.3.1
        with:
          codecov_yml_path: ${{env.GOPATH}}/src/github.com/google/syzkaller/.github/codecov.yml
          file: ${{env.GOPATH}}/src/github.com/google/syzkaller/.coverage.txt
          flags: unittests
          token: ${{ secrets.CODECOV_TOKEN }}
          verbose: true

  dashboard:
    runs-on: syz-env-x86
    env:
      GOPATH: /__w/syzkaller/syzkaller/gopath
      CI: true
      TERM: dumb
      GITHUB_ACTIONS: true
    steps:
      - name: checkout
        uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
        with:
          path: gopath/src/github.com/google/syzkaller
      - name: restore cache
        uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
        with:
          path: /syzkaller/.cache
          key: ${{ runner.os }}-syzenv-
      - name: run
        run: |
          cd gopath/src/github.com/google/syzkaller
          .github/workflows/run.sh timeout --signal=SIGINT 15m make presubmit_dashboard
      - name: codecov
        uses: codecov/codecov-action@5ecb98a3c6b747ed38dc09f787459979aebb39be # v4.3.1
        with:
          codecov_yml_path: ${{env.GOPATH}}/src/github.com/google/syzkaller/.github/codecov.yml
          file: ${{env.GOPATH}}/src/github.com/google/syzkaller/.coverage.txt
          flags: dashboard
          token: ${{ secrets.CODECOV_TOKEN }}
          verbose: true

  arch:
    runs-on: ubuntu-latest
    container: gcr.io/syzkaller/env:latest
    env:
      GOPATH: /__w/syzkaller/syzkaller/gopath
      CI: true
      TERM: dumb
    strategy:
      matrix:
        target: [ presubmit_arch_linux, presubmit_arch_freebsd, presubmit_arch_netbsd, presubmit_arch_openbsd, presubmit_arch_darwin, presubmit_arch_windows, presubmit_arch_executor ]
    steps:
      - name: checkout
        uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
        with:
          path: gopath/src/github.com/google/syzkaller
      - name: restore cache
        uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
        with:
          path: /syzkaller/.cache
          key: ${{ runner.os }}-syzenv-
      - name: run
        run: |
          cd gopath/src/github.com/google/syzkaller
          .github/workflows/run.sh make ${{ matrix.target }}

  race:
    runs-on: syz-env-x86
    timeout-minutes: 15 # Q1 2024 experiments may affect timeout, let's relax it
    env:
      GOPATH: /__w/syzkaller/syzkaller/gopath
      CI: true
      TERM: dumb
    steps:
      - name: checkout
        uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
        with:
          path: gopath/src/github.com/google/syzkaller

      # https://github.com/golang/go/issues/61608 to cache -race results.
      - name: restore cache
        uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
        with:
          path: /syzkaller/.cache
          key: ${{ runner.os }}-syzenv-

      - name: run
        run: |
          cd gopath/src/github.com/google/syzkaller
          .github/workflows/run.sh make presubmit_race

  race_dashboard:
    runs-on: syz-env-x86
    env:
      GOPATH: /__w/syzkaller/syzkaller/gopath
      CI: true
      TERM: dumb
    steps:
      - name: checkout
        uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
        with:
          path: gopath/src/github.com/google/syzkaller
      - name: restore cache
        uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
        with:
          path: /syzkaller/.cache
          key: ${{ runner.os }}-syzenv-
      - name: run
        run: |
          cd gopath/src/github.com/google/syzkaller
          .github/workflows/run.sh make presubmit_race_dashboard

  old:
    runs-on: ubuntu-latest
    container: gcr.io/syzkaller/old-env:latest
    env:
      GOPATH: /__w/syzkaller/syzkaller/gopath
      GOMODCACHE: /syzkaller/.cache/gomod
      CI: true
      TERM: dumb
    steps:
      - name: checkout
        uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
        with:
          path: gopath/src/github.com/google/syzkaller
      - name: restore cache
        uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
        with:
          path: /syzkaller/.cache
          key: ${{ runner.os }}-syzenv-
      - name: run
        run: |
          cd gopath/src/github.com/google/syzkaller
          .github/workflows/run.sh make presubmit_old
  gvisor:
    runs-on: ubuntu-latest
    container:
      image: gcr.io/syzkaller/syzbot:latest
      options: --privileged
    env:
      GOPATH: /__w/syzkaller/syzkaller/gopath
      GOMODCACHE: /syzkaller/.cache/gomod
      CI: true
      TERM: dumb
      GITHUB_ACTIONS: true
    steps:
      - name: checkout
        uses: actions/checkout@c85c95e3d7251135ab7dc9ce3241c5835cc595a9 # v3.5.3
        with:
          path: gopath/src/github.com/google/syzkaller
      - name: restore cache
        uses: actions/cache/restore@1bd1e32a3bdc45362d1e726936510720a7c30a57 # v4.2.0
        with:
          path: /syzkaller/.cache
          key: ${{ runner.os }}-syzenv-
      - name: run
        run: |
          cd gopath/src/github.com/google/syzkaller
          make
          .github/workflows/run.sh bash -xe tools/gvisor-smoke-test.sh