-
-
Notifications
You must be signed in to change notification settings - Fork 36
167 lines (159 loc) · 5.15 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
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
# This workflow is where we run tests depending on what files have been
# modified. This allows us to segment modified areas of the code and run only
# the tests corresponding to any changes.
#
# One exception is that we want to run all tests if the 'core' has been modified in
# any way.
name: CI
on:
pull_request:
# Cancel in progress workflows on pull_requests.
# https://docs.github.com/en/actions/using-jobs/using-concurrency#example-using-a-fallback-value
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true
jobs:
# JOB to run change detection
changes:
runs-on: ubuntu-latest
# Required permissions
permissions:
pull-requests: read
# Set job outputs to values from filter step
outputs:
core: ${{ steps.filter.outputs.core }}
go: ${{ steps.filter.outputs.go }}
javascript: ${{ steps.filter.outputs.javascript }}
python: ${{ steps.filter.outputs.python }}
rust: ${{ steps.filter.outputs.rust }}
steps:
- uses: actions/checkout@v3
# For pull requests it's not necessary to checkout the code
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
core:
- 'private_set_intersection/c/**'
- 'private_set_intersection/cpp/**'
- 'private_set_intersection/proto/**'
- 'private_set_intersection/BUILD'
- 'private_set_intersection/*.bzl'
- 'tools/BUILD'
- 'tools/common.bzl'
- '.clang-format'
- '.bazelrc'
- '.bazelversion'
- 'WORKSPACE'
go:
- 'private_set_intersection/go/**'
- '.bazelrc'
- '.bazelversion'
- 'WORKSPACE'
javascript:
- 'private_set_intersection/javascript/**'
- '*.json'
- '*.js'
- '.prettier*'
- '.eslint*'
- '.bazelrc'
- '.bazelversion'
- 'WORKSPACE'
python:
- 'private_set_intersection/python/**'
- '.flake8'
- '.pyproject.toml'
- '.bazelrc'
- '.bazelversion'
- 'WORKSPACE'
rust:
- 'private_set_intersection/rust/**'
- 'third_party/**'
- '.bazelrc'
- '.bazelversion'
- 'WORKSPACE'
Core:
needs: changes
if: ${{ needs.changes.outputs.core == 'true' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
steps:
- uses: actions/checkout@v3
- name: Run tests nix
timeout-minutes: 60
run: .github/workflows/scripts/run_tests_core.sh
- name: Linters
run: .github/workflows/scripts/lint_cpp.sh
if: ${{ matrix.os == 'ubuntu-22.04' }}
JS:
needs: changes
if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.javascript == 'true' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
steps:
- uses: actions/checkout@v3
- name: Run tests nix
timeout-minutes: 60
run: .github/workflows/scripts/run_tests_js.sh
Python:
needs: changes
if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.python == 'true' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
python-version: ['3.8', '3.9', '3.10']
steps:
- uses: actions/checkout@v3
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v4
with:
python-version: ${{ matrix.python-version }}
- name: Run tests nix
timeout-minutes: 30
run: .github/workflows/scripts/run_tests_python.sh
- name: Python linters
run: .github/workflows/scripts/lint_python.sh
Go:
needs: changes
if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.go == 'true' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
golang-version: ['1.17', '1.18', '1.19']
steps:
- name: Set up Golang ${{ matrix.golang-version }}
uses: actions/setup-go@v3
with:
go-version: ${{ matrix.golang-version }}
id: go
- name: Install Go dependencies
run: go install golang.org/x/lint/golint@latest
- uses: actions/checkout@v3
- name: Run tests nix
timeout-minutes: 30
run: .github/workflows/scripts/run_tests_go.sh
- name: Go linters
run: .github/workflows/scripts/lint_go.sh
Rust:
needs: changes
if: ${{ needs.changes.outputs.core == 'true' || needs.changes.outputs.rust == 'true' }}
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-22.04, macos-12]
steps:
- name: Install toolchains
uses: actions-rs/toolchain@v1
with:
toolchain: stable
default: true
- uses: actions/checkout@v3
- name: Run tests nix
timeout-minutes: 30
run: .github/workflows/scripts/run_tests_rust.sh