-
Notifications
You must be signed in to change notification settings - Fork 3
90 lines (84 loc) · 3.17 KB
/
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
name: Pull Request
run-name: Pull Request for ${{ github.ref_name }} by ${{ github.actor }}
concurrency:
group: ${{ github.head_ref || github.run_id }}
cancel-in-progress: true
permissions: write-all
on:
pull_request: {}
workflow_dispatch: {}
push:
branches:
- trunk-merge/**
env:
CARGO_TERM_COLOR: always
jobs:
build_release:
strategy:
matrix:
target: [x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu]
name: Build CLI for ${{ matrix.target }}
# trunk-ignore(actionlint/runner-label)
runs-on: ubuntu-latest-8-cores
steps:
- uses: actions/checkout@v3
- name: Install musl-gcc
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
mkdir -p target
- name: Add target ${{ matrix.target }}
run: rustup target add ${{ matrix.target }}
- name: Install JUnit transformer
run: cargo install cargo2junit
- name: Run tests
run: cargo test -q -- -Z unstable-options --format json --report-time | cargo2junit > ${{ github.workspace }}/target/junit.xml
- name: Build release CLI binary
run: cargo build -q --all --release --target ${{ matrix.target }}
- name: Run UPX
uses: crazy-max/ghaction-upx@v3
with:
version: latest
files: target/${{ matrix.target }}/release/trunk-analytics-cli
args: --best --lzma
- name: Check size
run: ls -lh target/${{ matrix.target }}/release/trunk-analytics-cli
- name: Upload results cli release built from source
if: "!cancelled()"
env:
TRUNK_API_ADDRESS: https://api.trunk-staging.io/v1/metrics/createBundleUpload
run: |
target/${{ matrix.target }}/release/trunk-analytics-cli upload \
--junit-paths ${{ github.workspace }}/target/**/*junit.xml \
--org-url-slug trunk-staging-org \
--token ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }}
- name: Check dynamic deps
run: ldd target/${{ matrix.target }}/release/trunk-analytics-cli
continue-on-error: true
build:
name: Unit Tests
runs-on: ubuntu-latest-8-cores
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build -q --all
- name: Install JUnit transformer
run: cargo install cargo2junit
- name: Run tests
run: cargo test --verbose -- -Z unstable-options --format json --report-time | cargo2junit > ${{ github.workspace }}/target/junit.xml
- name: Upload results using action
if: "!cancelled()"
uses: trunk-io/analytics-uploader@main
with:
junit-paths: ${{ github.workspace }}/target/**/*junit.xml
org-slug: trunk
token: ${{ secrets.TRUNK_PROD_ORG_API_TOKEN }}
- name: Upload results cli release built from source
if: "!cancelled()"
env:
TRUNK_API_ADDRESS: https://api.trunk-staging.io/v1/metrics/createBundleUpload
run: |
cargo run --release -- upload \
--junit-paths ${{ github.workspace }}/target/**/*junit.xml \
--org-url-slug trunk-staging-org \
--token ${{ secrets.TRUNK_STAGING_ORG_API_TOKEN }}