-
Notifications
You must be signed in to change notification settings - Fork 1.4k
99 lines (88 loc) · 3.29 KB
/
cross.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
name: Cross
on:
workflow_call:
jobs:
cross-linux:
name: Cross - ${{ matrix.target }}
runs-on: ubuntu-latest
timeout-minutes: 45
env:
CARGO_INCREMENTAL: 0
strategy:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-gnu
- aarch64-unknown-linux-musl
- armv7-unknown-linux-gnueabihf
- armv7-unknown-linux-musleabihf
- arm-unknown-linux-gnueabi
- arm-unknown-linux-musleabi
steps:
- name: (PR comment) Get PR branch
if: ${{ github.event_name == 'issue_comment' }}
uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch
- name: (PR comment) Set latest commit status as pending
if: ${{ github.event_name == 'issue_comment' }}
uses: myrotvorets/set-commit-status-action@v2.0.1
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
context: Cross
status: pending
- name: (PR comment) Checkout PR branch
if: ${{ github.event_name == 'issue_comment' }}
uses: actions/checkout@v3
with:
ref: ${{ steps.comment-branch.outputs.head_ref }}
- name: Checkout branch
if: ${{ github.event_name != 'issue_comment' }}
uses: actions/checkout@v3
- uses: actions/cache@v4
name: Cache Cargo registry + index
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- run: echo "::add-matcher::.github/matchers/rust.json"
- run: 'cargo install cross --version 0.2.4 --force --locked'
# Why is this build, not check? Because we need to make sure the linking phase works.
# aarch64 and musl in particular are notoriously hard to link.
# While it may be tempting to slot a `check` in here for quickness, please don't.
- run: make cross-build-${{ matrix.target }}
- uses: actions/upload-artifact@v3
with:
name: "vector-debug-${{ matrix.target }}"
path: "./target/${{ matrix.target }}/debug/vector"
- name: (PR comment) Set latest commit status as failed
uses: myrotvorets/set-commit-status-action@v2.0.1
if: failure() && github.event_name == 'issue_comment'
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
context: Cross
status: 'failure'
update-pr-status:
name: (PR comment) Signal result to PR
runs-on: ubuntu-20.04
timeout-minutes: 5
needs: cross-linux
if: needs.cross-linux.result == 'success' && github.event_name == 'issue_comment'
steps:
- name: (PR comment) Get PR branch
uses: xt0rted/pull-request-comment-branch@v2
id: comment-branch
- name: (PR comment) Submit PR result as success
uses: myrotvorets/set-commit-status-action@v2.0.1
with:
sha: ${{ steps.comment-branch.outputs.head_sha }}
token: ${{ secrets.GITHUB_TOKEN }}
context: Cross
status: 'success'