Skip to content

Commit 9590de3

Browse files
committed
Upgrade various things to newer versions.
Signed-off-by: Steffen Smolka <[email protected]>
1 parent a41e728 commit 9590de3

File tree

8 files changed

+79
-25
lines changed

8 files changed

+79
-25
lines changed

.github/workflows/any-branch-uploads.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
if: ${{ github.repository == 'p4lang/p4runtime' }}
1111
runs-on: [ubuntu-latest]
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
- name: Build spec
1515
run: |
1616
docker run -v `pwd`/docs/v1:/usr/src/p4-spec p4lang/p4rt-madoko:latest make

.github/workflows/ci-build-proto.yml

Lines changed: 55 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -14,33 +14,75 @@ on:
1414

1515
jobs:
1616
build:
17-
runs-on: ubuntu-22.04
18-
env:
19-
BAZEL: bazelisk-linux-amd64
17+
strategy:
18+
matrix:
19+
os:
20+
- ubuntu-22.04
21+
- ubuntu-24.04
22+
- ubuntu-latest
23+
runs-on: ${{ matrix.os }}
2024
steps:
21-
- uses: actions/checkout@v2
25+
- uses: actions/checkout@v4
2226
with:
2327
submodules: recursive
24-
28+
2529
- name: Mount bazel cache
26-
uses: actions/cache@v2
30+
uses: actions/cache/restore@v4
2731
with:
2832
# See https://docs.bazel.build/versions/master/output_directories.html
2933
path: "~/.cache/bazel"
3034
# Create a new cache entry whenever Bazel files change.
3135
# See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
32-
key: bazel-${{ runner.os }}-build-${{ hashFiles('**/*.bzl', '**/*.bazel') }}
36+
key: bazel-${{ matrix.os }}-${{ hashFiles('**/*.bazel*') }}
3337
restore-keys: |
34-
bazel-${{ runner.os }}-build-
38+
bazel-${{ matrix.os }}-
3539
36-
- name: Install bazelisk
37-
run: |
38-
curl -LO "https://github.com/bazelbuild/bazelisk/releases/download/v1.15.0/$BAZEL"
39-
chmod +x $BAZEL
40-
sudo mv $BAZEL /usr/local/bin/bazel
40+
- name: Save start time
41+
uses: josStorer/get-current-time@v2
42+
id: start-time
43+
with:
44+
# Unix timestamp -- seconds since 1970.
45+
format: X
4146

4247
- name: Build proto/
4348
run: cd proto && bazel build //... && bazel test //...
4449

4550
- name: Build bazel/example/
4651
run: cd bazel/example/ && bazel build //...
52+
53+
- name: Save end time
54+
# Always save the end time so we can calculate the build duration.
55+
if: always()
56+
uses: josStorer/get-current-time@v2
57+
id: end-time
58+
with:
59+
# Unix timestamp -- seconds since 1970.
60+
format: X
61+
62+
- name: Calculate build duration
63+
# Always calculate the build duration so we can update the cache if needed.
64+
if: always()
65+
run: |
66+
START=${{ steps.start-time.outputs.formattedTime }}
67+
END=${{ steps.end-time.outputs.formattedTime }}
68+
DURATION=$(( $END - $START ))
69+
echo "duration=$DURATION" | tee "$GITHUB_ENV"
70+
71+
- name: Compress cache
72+
# Always compress the cache so we can update the cache if needed.
73+
if: always()
74+
run: rm -rf $(bazel info repository_cache)
75+
76+
- name: Save bazel cache
77+
uses: actions/cache/save@v4
78+
# Only create a new cache entry if we're on the main branch or the build takes >5mins.
79+
#
80+
# NOTE: Even though `always()` evaluates to true, and `true && x == x`,
81+
# the `always() &&` prefix is not redundant! The call to `always()` has a
82+
# side effect, which is to override the default behavior of automagically
83+
# canceling this step if a previous step failed.
84+
# (Don't blame me, blame GitHub Actions!)
85+
if: always() && (github.ref_name == 'main' || env.duration > 300)
86+
with:
87+
path: "~/.cache/bazel"
88+
key: bazel-${{ matrix.os }}-${{ hashFiles('**/*.bazel*') }}-${{ github.run_id }}

.github/workflows/codegen.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
check-codegen:
1515
runs-on: [ubuntu-latest]
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
- name: Compile protobufs
1919
run: |
2020
docker build -t p4runtime-ci -f codegen/Dockerfile .

.github/workflows/main-branch-uploads.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
if: ${{ github.repository == 'p4lang/p4runtime' }}
1111
runs-on: [ubuntu-latest]
1212
steps:
13-
- uses: actions/checkout@v3
13+
- uses: actions/checkout@v4
1414
with:
1515
# fetch all history for all branches and tags
1616
fetch-depth: 0

.github/workflows/spec.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ jobs:
1414
madoko-lint:
1515
runs-on: [ubuntu-latest]
1616
steps:
17-
- uses: actions/checkout@v3
17+
- uses: actions/checkout@v4
1818
- name: Run linter
1919
run: |
2020
./tools/madokolint.py docs/v1/P4Runtime-Spec.mdk
2121
2222
build-spec:
2323
runs-on: [ubuntu-latest]
2424
steps:
25-
- uses: actions/checkout@v3
25+
- uses: actions/checkout@v4
2626
- name: Build spec
2727
run: |
2828
docker run -v `pwd`/docs/v1:/usr/src/p4-spec p4lang/p4rt-madoko:latest make

.github/workflows/tag-uploads.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
env:
1313
TAG: ${{ github.ref_name }}
1414
steps:
15-
- uses: actions/checkout@v3
15+
- uses: actions/checkout@v4
1616
with:
1717
# fetch all history for all branches and tags
1818
fetch-depth: 0

bazel/example/.bazelrc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
# bazelrc file
1+
# Use C++17.
2+
build --cxxopt=-std=c++17
3+
build --host_cxxopt=-std=c++17
24

3-
# C++14 required for recent gRPC versions
4-
build --cxxopt='-std=c++14'
5+
# Use Clang.
6+
build --action_env=CC=clang
7+
build --action_env=CXX=clang++
8+
9+
# Print test errors.
10+
common --test_output=errors //...

proto/.bazelrc

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,10 @@
1-
# bazelrc file
1+
# Use C++17.
2+
build --cxxopt=-std=c++17
3+
build --host_cxxopt=-std=c++17
24

3-
# C++14 required for recent gRPC versions
4-
build --cxxopt='-std=c++14'
5+
# Use Clang.
6+
build --action_env=CC=clang
7+
build --action_env=CXX=clang++
8+
9+
# Print test errors.
10+
common --test_output=errors //...

0 commit comments

Comments
 (0)