-
Notifications
You must be signed in to change notification settings - Fork 32
139 lines (122 loc) · 4.15 KB
/
release.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
name: release
on:
push:
tags: ["jql-v[0-9]+.[0-9]+.[0-9]+*"]
jobs:
performance:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
ref: "main"
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Install hyperfine and jql - jq is already available!
run: cargo install hyperfine && cargo install jql
- name: Run performance benchmarks
run: ./performance.sh
- name: Create pull-request
uses: peter-evans/create-pull-request@v5
with:
author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com>
body: Update PERFORMANCE.md file
branch: performance
commit-message: "chore(performance): update benchmarks"
committer: GitHub <[email protected]>
delete-branch: true
labels: enhancement
reviewers: yamafaktory
title: "[Performance] Update benchmarks"
token: ${{ secrets.GITHUB_TOKEN }}
build-release:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# Linux
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
archive: tar.gz
archive-cmd: tar czf
sha-cmd: sha256sum
- os: ubuntu-latest
target: aarch64-unknown-linux-musl
archive: tar.gz
archive-cmd: tar czf
sha-cmd: sha256sum
- os: ubuntu-latest
target: arm-unknown-linux-musleabihf
archive: tar.gz
archive-cmd: tar czf
sha-cmd: sha256sum
- os: ubuntu-latest
target: loongarch64-unknown-linux-gnu
archive: tar.gz
archive-cmd: tar czf
sha-cmd: sha256sum
# Darwin
- os: macos-latest
target: x86_64-apple-darwin
archive: zip
archive-cmd: zip -r
sha-cmd: shasum -a 256
- os: macos-latest
target: aarch64-apple-darwin
archive: zip
archive-cmd: zip -r
sha-cmd: shasum -a 256
# Windows
- os: windows-latest
target: x86_64-pc-windows-msvc
archive: zip
archive-cmd: 7z a
sha-cmd: sha256sum
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup Rust toolchain
uses: dtolnay/rust-toolchain@master
with:
target: ${{ matrix.target }}
toolchain: stable
- uses: Swatinem/rust-cache@v2
- name: Build Linux
if: matrix.os == 'ubuntu-latest'
run: |
cargo install cross --git https://github.com/cross-rs/cross
cross build --release --target ${{ matrix.target }}
- name: Build Darwin & Windows
if: matrix.os == 'macos-latest' || matrix.os == 'windows-latest'
run: cargo build --release --target ${{ matrix.target }}
- name: Package Artifacts
shell: bash
run: |
src=$(pwd)
stage=$(mktemp -d)
ver=${GITHUB_REF#refs/tags/}
asset_name="$ver-${{ matrix.target }}.${{ matrix.archive }}"
ASSET_PATH="$src/$asset_name"
CHECKSUM_PATH="$ASSET_PATH.sha256"
cp target/${{ matrix.target }}/release/jql $stage/
cd $stage
${{ matrix.archive-cmd }} $ASSET_PATH *
cd $src
${{ matrix.sha-cmd }} $asset_name > $CHECKSUM_PATH
if [ "$RUNNER_OS" == "Windows" ]; then
echo "ASSET_PATH=$(cygpath -m $ASSET_PATH)" >> $GITHUB_ENV
echo "CHECKSUM_PATH=$(cygpath -m $CHECKSUM_PATH)" >> $GITHUB_ENV
else
echo "ASSET_PATH=$ASSET_PATH" >> $GITHUB_ENV
echo "CHECKSUM_PATH=$CHECKSUM_PATH" >> $GITHUB_ENV
fi
- name: Release
uses: softprops/action-gh-release@v1
if: startsWith(github.ref, 'refs/tags/')
with:
fail_on_unmatched_files: true
files: |
${{ env.ASSET_PATH }}
${{ env.CHECKSUM_PATH }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}