forked from p4lang/p4c
-
Notifications
You must be signed in to change notification settings - Fork 0
72 lines (61 loc) · 2.38 KB
/
ci-bazel.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
name: "bazel"
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
jobs:
build_direct: # Build p4c directly.
runs-on: ubuntu-latest
env:
BAZEL: bazelisk-linux-amd64
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Mount bazel cache
uses: actions/cache@v2
with:
# See https://docs.bazel.build/versions/master/output_directories.html
path: "~/.cache/bazel"
# Create cash entry for every run (by using unique key derived from commit hash).
# See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
key: ${{ runner.os }}-build-direct-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-direct-
- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.7.1/$BAZEL"
chmod +x $BAZEL
sudo mv $BAZEL /usr/local/bin/bazel
- name: Install Flex, Bison, and GMP
run: sudo apt-get update && sudo apt-get install bison flex libfl-dev libgmp-dev
- name: Build p4c
run: bazel build //... --verbose_failures --distinct_host_configuration=false
build_indirect: # Build 3rd party Bazel project depending on p4c as a subproject.
runs-on: ubuntu-latest
env:
BAZEL: bazelisk-linux-amd64
steps:
- uses: actions/checkout@v2
with:
submodules: recursive
- name: Mount bazel cache
uses: actions/cache@v2
with:
# See https://docs.bazel.build/versions/master/output_directories.html
path: "~/.cache/bazel"
# Create cash entry for every run (by using unique key derived from commit hash).
# See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
key: ${{ runner.os }}-build-indirect-${{ github.sha }}
restore-keys: |
${{ runner.os }}-build-indirect-
- name: Install bazelisk
run: |
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.4.0/$BAZEL"
chmod +x $BAZEL
sudo mv $BAZEL /usr/local/bin/bazel
- name: Install Flex, Bison, and GMP
run: sudo apt-get update && sudo apt-get install bison flex libfl-dev libgmp-dev
- name: Build bazel/example
run: cd ./bazel/example && bazel build //... --verbose_failures --distinct_host_configuration=false