Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 53 additions & 21 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,58 @@ on: [push, pull_request]
name: Test

jobs:
test:
strategy:
matrix:
go-version:
- 1.20.x
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
services:
redis:
image: redis
ports:
- 6379:6379
steps:
- name: Checkout code
uses: actions/checkout@v3
test:
strategy:
matrix:
go-version:
- 1.20.x
os: [ubuntu-latest]
runs-on: codebuild-stellaraf-actions-public-${{ github.run_id }}-${{ github.run_attempt }}
services:
redis:
image: redis
ports:
- 6379:6379
steps:
- name: Checkout code
uses: actions/checkout@v4

- name: Install Go
uses: actions/setup-go@v4
with:
go-version: ${{ matrix.go-version }}
- name: Install Go
uses: actions/setup-go@v5
with:
go-version: ${{ matrix.go-version }}

- name: Test
run: go test ./... -v
cache: false
- name: Resolve Go compiler version
id: go-cache
run: |
echo "version=$(go env GOVERSION)" >> "$GITHUB_OUTPUT"
- name: Export temporary AWS cache credentials
shell: bash
run: |
python3 - <<'PYTHON'
import json, os, subprocess
credentials = json.loads(subprocess.check_output(['aws', 'configure', 'export-credentials', '--format', 'process']))
with open(os.environ['GITHUB_ENV'], 'a') as output:
for source, target in [('AccessKeyId', 'AWS_ACCESS_KEY_ID'), ('SecretAccessKey', 'AWS_SECRET_ACCESS_KEY'), ('SessionToken', 'AWS_SESSION_TOKEN')]:
value = credentials[source]
if not value or '\n' in value or '\r' in value:
raise RuntimeError('Invalid temporary credential value')
print('::add-mask::' + value)
output.write(target + '=' + value + '\n')
PYTHON
- name: Restore Go dependencies and build cache from S3
uses: tespkg/actions-cache@e07e2d4953dc8c020d447363e5064e36d04f3cf9
with:
region: us-west-1
bucket: stellaraf-public-ci-961341522852-us-west-1
path: |
/tmp/stellar-go/pkg/mod
/tmp/stellar-go-build
key: cache/${{ github.repository }}/${{ github.ref }}/go/${{ runner.os }}/${{ runner.arch }}/${{ steps.go-cache.outputs.version }}/${{ hashFiles('**/go.sum') }}
use-fallback: false
- name: Test
run: go test ./... -v
env:
GOPATH: /tmp/stellar-go
GOCACHE: /tmp/stellar-go-build
Loading