Skip to content

Commit 6e768de

Browse files
authored
Add GHA to invoke RPC integration tests on commits to master (stellar#5161)
# Description As part of stellar/pod-fsr#2, we want Stellar Core to run RPC integration tests to catch failures prior to downstream integration. # Checklist - [x] Reviewed the [contributing](https://github.com/stellar/stellar-core/blob/master/CONTRIBUTING.md#submitting-changes) document - [x] Rebased on top of master (no merge commits) Not Applicable: - [ ] Ran `clang-format` v8.0.0 (via `make format` or the Visual Studio extension) - [ ] Compiles - [x] Ran all tests - [ ] If change impacts performance, include supporting evidence per the [performance document](https://github.com/stellar/stellar-core/blob/master/performance-eval/performance-eval.md)
2 parents 3589a69 + 48aead6 commit 6e768de

3 files changed

Lines changed: 75 additions & 0 deletions

File tree

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
name: 'Setup the Go environment'
2+
description: 'Installs go and restores/saves the build/module cache'
3+
runs:
4+
using: "composite"
5+
steps:
6+
- name: Set up Go
7+
uses: actions/setup-go@v6
8+
with:
9+
go-version: '1.25'
10+
# unfortunately we cannot use the provided caching because it uses the
11+
# same cache for all workflows/jobs, leading to undesired cache clashes,
12+
# causing uncached test runs etc ...
13+
# You can see the cache key at https://github.com/actions/setup-go/blob/4e0b6c77c6448caafaff5eed51516cad78e7639a/src/cache-restore.ts#L34
14+
# There is a ticket to add prefixes for the cache, which should solve it https://github.com/actions/setup-go/issues/358
15+
cache: false
16+
17+
# Restore original modification time of files based on the date of the most
18+
# recent commit that modified them as mtimes affect the Go test cache.
19+
# See https://github.com/golang/go/issues/58571 for details
20+
- name: Restore modification time of checkout files
21+
uses: chetan/git-restore-mtime-action@075f9bc9d159805603419d50f794bd9f33252ebe
22+
23+
24+
# KEY_PREFIX must uniquely identify the specific instance of a job executing.
25+
- shell: bash
26+
run: |
27+
echo 'KEY_PREFIX=${{ github.workflow }}-${{ github.job }}-${{ runner.os }}-${{ inputs.go-version }}-matrix(${{ join(matrix.*,'|') }})' >> $GITHUB_OUTPUT
28+
echo "GOCACHE=$(go env GOCACHE)" >> $GITHUB_OUTPUT
29+
echo "GOMODCACHE=$(go env GOMODCACHE)" >> $GITHUB_OUTPUT
30+
if [ ${{ runner.os }} != 'Windows' ]; then echo SUDO='sudo' >> $GITHUB_OUTPUT; fi
31+
id: variables
32+
33+
# Cache the Go Modules downloaded during the job.
34+
- uses: actions/cache@v4
35+
with:
36+
path: ${{ steps.variables.outputs.GOMODCACHE }}
37+
key: ${{ steps.variables.outputs.KEY_PREFIX }}-go-mod-${{ hashFiles('**/go.sum') }}
38+
restore-keys: ${{ steps.variables.outputs.KEY_PREFIX }}-go-mod-
39+
40+
# Cache any build and test artifacts during the job, which will speed up
41+
# rebuilds and cause test runs to skip tests that have no reason to rerun.
42+
- uses: actions/cache@v4
43+
with:
44+
path: ${{ steps.variables.outputs.GOCACHE }}
45+
key: ${{ steps.variables.outputs.KEY_PREFIX }}-go-build-${{ github.ref }}-${{ hashFiles('**', '!.git') }}
46+
restore-keys: |
47+
${{ steps.variables.outputs.KEY_PREFIX }}-go-build-${{ github.ref }}-
48+
${{ steps.variables.outputs.KEY_PREFIX }}-go-build-
49+
50+
# Reset the cache for master/protected branches, to ensure they build and run the tests from zero
51+
# and that the module cache is cleaned (otherwise it accumulates orphan dependencies over time).
52+
- if: github.ref_protected
53+
shell: bash
54+
run: ${{ steps.variables.outputs.SUDO }} rm -rf ${{ steps.variables.outputs.GOMODCACHE }} ${{ steps.variables.outputs.GOCACHE }}
55+

.github/workflows/rpc.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
name: RPC Integration Tests
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- master
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
rpc:
15+
uses: stellar/stellar-rpc/.github/workflows/integration-tests.yml@efd9eb95f1ed8a7d69d28f12e89762c3ecb64bcc
16+
with:
17+
rpc_git_ref: protocol-next
18+
core_git_ref: ${{ github.sha }}
19+
protocol_version: '27'

docker/Dockerfile.testing

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -30,6 +30,7 @@ ENV PATH "/root/.cargo/bin:$PATH"
3030
RUN ./configure CC="${CC}" CXX="${CXX}" CFLAGS="${CFLAGS}" CXXFLAGS="${CXXFLAGS}" ${CONFIGURE_FLAGS}
3131
RUN sh -c 'make -j $(nproc)'
3232
RUN make install
33+
RUN make clean
3334

3435
# Deploy stage, only includes stuff needed to run.
3536
FROM ubuntu:noble

0 commit comments

Comments
 (0)