-
Notifications
You must be signed in to change notification settings - Fork 6
105 lines (105 loc) · 4.56 KB
/
rust.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
name: auto_release
on:
push:
branches: [ "**"]
pull_request:
branches: [ "master" ]
permissions:
contents: write
env:
CARGO_TERM_COLOR: always
jobs:
standard:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set outputs
id: vars
run: echo "sha_short=$(git rev-parse --short=8 HEAD)" >> $GITHUB_OUTPUT
- name: build
id: build
uses: arloor/rust_musl_action@latest
with:
use_musl: false
extra_deps: cmake
args: -p rust_http_proxy --no-default-features --features aws_lc_rs
apt_mirror: mirrors.mit.edu
rust_flags: -C target-feature=+crt-static
- name: docker build and push
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
ls -lh ${{ steps.build.outputs.release_dir }}
dockerfile="Dockerfile.static"
podman build -f ${dockerfile} . -t docker.io/arloor/rust_http_proxy:latest --build-arg TARGET_PATH=/x86_64-unknown-linux-gnu
podman login docker.io -u arloor -p ${{ secrets.REGISTRY_PASSWORD }}
# podman push docker.io/arloor/rust_http_proxy:${{ steps.vars.outputs.sha_short }}
podman push docker.io/arloor/rust_http_proxy:latest
- name: create master release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
GH_TOKEN: ${{ github.token }}
run: |
version=latest
if $(gh release delete ${version} -y --cleanup-tag);
then echo "delete old release";
else echo "no old release";
fi
git config --local user.email "[email protected]"
git config --local user.name "arloor"
gh release create ${version} ${{ steps.build.outputs.release_dir }}rust_http_proxy -n "$version" --latest -t "$version"
- name: create version release
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/')
env:
GH_TOKEN: ${{ github.token }}
run: |
# 从Cargo.toml中提取版本号
version=$(grep -E ^version rust_http_proxy/Cargo.toml|awk -F "[\"]" '{print $2}')
version="v${version}"
if [ -z "$version" ]; then echo "version not found"; exit 1; fi
if $(gh release delete ${version} -y --cleanup-tag);
then echo "delete old release";
else echo "no old release";
fi
git config --local user.email "[email protected]"
git config --local user.name "arloor"
gh release create ${version} ${{ steps.build.outputs.release_dir }}rust_http_proxy -n "$version" --latest -t "$version"
bpf:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: build bpf
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
id: build_bpf
uses: arloor/rust_musl_action@latest
with:
use_musl: false
extra_deps: cmake zlib1g-dev libelf-dev pkg-config clang autoconf autopoint flex bison gawk make libbpf-dev
after_install: |
# ls -lh /usr/lib/x86_64-linux-gnu/libelf.a
export LIBBPF_SYS_LIBRARY_PATH=/usr/lib:/usr/lib64
echo -e "\e[31mLIBBPF_SYS_LIBRARY_PATH=$LIBBPF_SYS_LIBRARY_PATH\e[0m"
args: -p rust_http_proxy --no-default-features --features aws_lc_rs,bpf_static
apt_mirror: mirrors.mit.edu
rust_flags: -C target-feature=+crt-static
debug: false
- name: docker build and push
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
run: |
ls -lh ${{ steps.build_bpf.outputs.release_dir }}
dockerfile="Dockerfile.static"
podman build -f ${dockerfile} . -t docker.io/arloor/rust_http_proxy:bpf --build-arg TARGET_PATH=/x86_64-unknown-linux-gnu
podman login docker.io -u arloor -p ${{ secrets.REGISTRY_PASSWORD }}
podman push docker.io/arloor/rust_http_proxy:bpf
- name: create bpf release
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
env:
GH_TOKEN: ${{ github.token }}
run: |
version='bpf'
if $(gh release delete ${version} -y --cleanup-tag);
then echo "delete old release";
else echo "no old release";
fi
git config --local user.email "[email protected]"
git config --local user.name "arloor"
gh release create ${version} ${{ steps.build_bpf.outputs.release_dir }}rust_http_proxy -n "$version" -t "$version" --prerelease