Skip to content

Commit aa81473

Browse files
committed
update docs and check the cache hit
1 parent bbaf4e1 commit aa81473

File tree

1 file changed

+54
-16
lines changed

1 file changed

+54
-16
lines changed

book/src/ci/ci.md

Lines changed: 54 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -2,31 +2,65 @@
22

33
Here we describe our good practices for structuring different types of tests in Continuous Integration (GitHub Actions).
44

5-
The simplest flow can look like:
6-
75
Set up secrets in your GitHub repository
86
```
97
gh secret set CTF_SIMULATED_KEY_1 --body "..."
108
```
119

1210
Add a workflow
1311
```yaml
14-
name: Run E2E tests
15-
12+
name: Framework Golden Tests Examples
1613
on:
1714
push:
1815

1916
jobs:
2017
test:
21-
runs-on: ubuntu-latest
18+
defaults:
19+
run:
20+
working-directory: framework/examples/myproject
2221
env:
23-
CTF_CONFIGS: smoke.toml
24-
CTF_LOG_LEVEL: info
25-
CTF_LOKI_STREAM: "false"
26-
PRIVATE_KEY: ${{ secrets.CTF_SIMULATED_KEY_1 }}
22+
LOKI_TENANT_ID: promtail
23+
LOKI_URL: http://localhost:3030/loki/api/v1/push
24+
runs-on: ubuntu-latest
25+
permissions:
26+
id-token: write
27+
contents: read
28+
strategy:
29+
fail-fast: false
30+
matrix:
31+
test:
32+
- name: TestSmoke
33+
config: smoke.toml
34+
count: 1
35+
timeout: 10m
36+
- name: TestLoad
37+
config: load.toml
38+
count: 1
39+
timeout: 10m
40+
- name: TestChaos
41+
config: chaos.toml
42+
count: 1
43+
timeout: 10m
2744
steps:
28-
- name: Check out code
29-
uses: actions/checkout@v3
45+
- name: Checkout repo
46+
uses: actions/checkout@0ad4b8fadaa221de15dcec353f45205ec38ea70b # v4.1.4
47+
- name: Configure AWS credentials using OIDC
48+
uses: aws-actions/configure-aws-credentials@e3dd6a429d7300a6a4c196c26e071d42e0343502 # v4.0.2
49+
with:
50+
role-to-assume: ${{ secrets.PUBLIC_AWS_ECR_ROLE }}
51+
aws-region: us-east-1
52+
- name: Authenticate to ECR Public
53+
id: login-ecr-public
54+
uses: aws-actions/amazon-ecr-login@062b18b96a7aff071d4dc91bc00c4c1a7945b076 # v2.0.1
55+
with:
56+
registry-type: public
57+
- name: Check for changes in Framework
58+
uses: dorny/paths-filter@de90cc6fb38fc0963ad72b210f1f284cd68cea36 # v3.0.2
59+
id: changes
60+
with:
61+
filters: |
62+
src:
63+
- 'framework/**'
3064
- name: Set up Go
3165
uses: actions/setup-go@v4
3266
with:
@@ -37,14 +71,18 @@ jobs:
3771
path: |
3872
~/.cache/go-build
3973
~/go/pkg/mod
40-
key: go-modules-${{ hashFiles('**/go.sum') }}-${{ runner.os }}
74+
key: go-modules-${{ hashFiles('framework/examples/myproject/go.sum') }}-${{ runner.os }}-framework-golden-examples
4175
restore-keys: |
42-
go-modules-${{ hashFiles('**/go.sum') }}-${{ runner.os }}
76+
go-modules-${{ runner.os }}-framework-golden-examples
77+
go-modules-${{ runner.os }}
4378
- name: Install dependencies
4479
run: go mod download
45-
- name: Run tests
46-
working-directory: e2e/capabilities
47-
run: go test -v -run TestDON
80+
- name: Run Docker Component Tests
81+
if: steps.changes.outputs.src == 'true'
82+
env:
83+
CTF_CONFIGS: ${{ matrix.test.config }}
84+
run: |
85+
go test -timeout ${{ matrix.test.timeout }} -v -count ${{ matrix.test.count }} -run ${{ matrix.test.name }}
4886
```
4987
5088
If you need to structure a lot of different end-to-end tests follow [this](https://github.com/smartcontractkit/.github/tree/main/.github/workflows) guide.

0 commit comments

Comments
 (0)