22
33on :
44 push :
5- branches :
6- - main
5+ branches : [ main ]
76 pull_request :
87
98env :
@@ -15,25 +14,49 @@ jobs:
1514 fail-fast : false
1615
1716 matrix :
18- os :
19- - { prettyname: Windows, fullname: windows-latest }
20- - { prettyname: macOS, fullname: macos-latest }
21- - { prettyname: Linux, fullname: ubuntu-latest }
17+ include :
18+ - os : windows-latest
19+ target : x86_64-pc-windows-msvc
2220
23- threadingMode : [ 'SingleThread', 'MultiThreaded' ]
21+ - os : ubuntu-latest
22+ target : x86_64-unknown-linux-gnu
2423
25- timeout-minutes : 60
24+ - os : macos-latest
25+ target : x86_64-apple-darwin
2626
27- runs-on : ${{matrix.os.fullname}}
27+ name : Build & Test (${{ matrix.target }})
28+ runs-on : ${{ matrix.os }}
29+
30+ env :
31+ RA_TARGET : ${{ matrix.target }}
2832
2933 steps :
30- - uses : actions/checkout@v2
34+ - name : Checkout repository
35+ uses : actions/checkout@v3
36+
37+ - name : Install Rust toolchain
38+ uses : actions-rs/toolchain@v1
39+ with :
40+ toolchain : stable
41+ target : ${{ matrix.target }}
42+ profile : minimal
43+ override : true
44+
45+ - name : Install Rust library source
46+ if : matrix.target == 'x86_64-unknown-linux-gnu'
47+ uses : actions-rs/toolchain@v1
48+ with :
49+ toolchain : stable
50+ target : ${{ matrix.target }}
51+ profile : minimal
52+ override : true
53+ components : rust-src
3154
3255 - name : Build
33- run : cargo build --verbose
56+ run : cargo build --verbose --target ${{ matrix.target }}
3457
3558 - name : Run tests
36- run : cargo test --verbose
59+ run : cargo test --verbose --target ${{ matrix.target }}
3760
3861 lint :
3962 name : Formatter
4366 runs-on : ubuntu-latest
4467
4568 steps :
46- - uses : actions/checkout@v2
69+ - name : Checkout repository
70+ uses : actions/checkout@v3
4771
4872 - name : Install Rust
4973 run : |
5781
5882 - name : Check code for possible improvements
5983 run : cargo clippy -- -D warnings
84+
85+ # Prepare the Pull Request Payload artifact. If this fails, we
86+ # we fail silently using the `continue-on-error` option. It's
87+ # nice if this succeeds, but if it fails for any reason, it
88+ # does not mean that our lint-test checks failed.
89+ - name : Prepare Pull Request Payload artifact
90+ id : prepare-artifact
91+ if : always() && github.event_name == 'pull_request'
92+ continue-on-error : true
93+ run : cat $GITHUB_EVENT_PATH | jq '.pull_request' > pull_request_payload.json
94+
95+ # This only makes sense if the previous step succeeded. To
96+ # get the original outcome of the previous step before the
97+ # `continue-on-error` conclusion is applied, we use the
98+ # `.outcome` value. This step also fails silently.
99+ - name : Upload a Build Artifact
100+ if : always() && steps.prepare-artifact.outcome == 'success'
101+ continue-on-error : true
102+ uses : actions/upload-artifact@v2
103+ with :
104+ name : pull-request-payload
105+ path : pull_request_payload.json
0 commit comments