-
Notifications
You must be signed in to change notification settings - Fork 5
161 lines (137 loc) · 5.25 KB
/
on-pull-request.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
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
name: on-pull-request
on:
pull_request_target:
branches: [main]
env:
CARGO_TERM_COLOR: always
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
TEST_CACHE_NAME: rust-integration-test-ci-cache-${{ github.sha }}
TEST_STORE_NAME: rust-integration-test-ci-store-${{ github.sha }}
TEST_AUTH_CACHE_NAME: rust-integration-test-ci-cache-auth-${{ github.sha }}
jobs:
verify-user-permissions:
runs-on: ubuntu-latest
steps:
- name: Get User Permission
id: checkAccess
uses: actions-cool/check-user-permission@v2
with:
require: write
username: ${{ github.triggering_actor }}
- name: Check User Permission
if: steps.checkAccess.outputs.require-result == 'false'
run: |
echo "${{ github.triggering_actor }} does not have permissions on this repo."
echo "Current permission level is ${{ steps.checkAccess.outputs.user-permission }}"
echo "Job originally triggered by ${{ github.actor }}"
exit 1
rustfmt:
name: main - Style & Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.merge_commit_sha || github.event.pull_request.head.sha }}
- name: Log rust versions
run: |
set -e
set -x
rustc --version
cargo --version
rustup show
- name: Verify README generation
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v2
with:
project_status: official
project_stability: beta
project_type: sdk
sdk_language: Rust
dev_docs_slug: rust
- name: Verify Example README generation
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v2
with:
project_status: official
project_stability: beta
project_type: other
template_file: ./example/README.template.md
output_file: ./example/README.md
- name: Verify Rust Example README generation
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v2
with:
project_status: official
project_stability: beta
project_type: other
template_file: ./example/rust/README.template.md
output_file: ./example/rust/README.md
- name: Verify CDK Lambda Example README generation
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v2
with:
project_status: official
project_stability: beta
project_type: other
template_file: ./example/aws/cdk-lambda/README.template.md
output_file: ./example/aws/cdk-lambda/README.md
- name: Verify Zip Lambda Example README generation
uses: momentohq/standards-and-practices/github-actions/oss-readme-template@gh-actions-v2
with:
project_status: official
project_stability: beta
project_type: other
template_file: ./example/aws/zip-lambda/README.template.md
output_file: ./example/aws/zip-lambda/README.md
- name: Commitlint and Other Shared Build Steps
uses: momentohq/standards-and-practices/github-actions/shared-build@gh-actions-v1
- uses: Swatinem/rust-cache@v2
- name: Lint (rustfmt and clippy)
run: make lint
- name: Compile docs
run: make docs
build_rust:
needs: verify-user-permissions
runs-on: ubuntu-24.04
env:
MOMENTO_API_KEY: ${{ secrets.ALPHA_TEST_AUTH_TOKEN }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.merge_commit_sha || github.event.pull_request.head.sha }}
- uses: Swatinem/rust-cache@v2
- name: Build
run: make build
- name: Test Setup
run: make ci-test-setup
- name: Unit tests
run: make test-unit
- name: Integration Tests
run: make test-integration
- name: Doc Tests
run: make test-doctests
- name: Test Teardown
# We want the teardown to execute even if an earlier step fails, hence the `always()` condition
if: always()
run: make ci-test-teardown
- name: Run examples
run: make run-examples
rustfmt-build-examples:
name: examples - Style & Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.merge_commit_sha || github.event.pull_request.head.sha }}
- name: Commitlint and Other Shared Build Steps
uses: momentohq/standards-and-practices/github-actions/shared-build@gh-actions-v1
- uses: Swatinem/rust-cache@v2
- name: rustfmt -> rigorous lint via Clippy -> build
id: validation
continue-on-error: true
run: make build-examples
- name: Send CI failure mail
if: ${{ steps.validation.outcome == 'failure' }}
uses: ./.github/actions/error-email-action
with:
username: ${{secrets.MOMENTO_ROBOT_GMAIL_USERNAME}}
password: ${{secrets.MOMENTO_ROBOT_GMAIL_PASSWORD}}
- name: Flag Job Failure
if: ${{ steps.validation.outcome == 'failure' }}
run: exit 1