-
Notifications
You must be signed in to change notification settings - Fork 3
41 lines (33 loc) · 1.22 KB
/
static-build-and-upload.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
name: static build and upload
on:
pull_request:
push:
branches:
- main
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref || github.run_id }}
cancel-in-progress: true
jobs:
static-build:
runs-on: ubuntu-22.04
permissions:
id-token: write
contents: read
steps:
- uses: actions/checkout@main
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Set up nix dev env
run: nix develop --command echo 0
- name: Build `lightswitch` statically linked with glibc
run: nix develop --ignore-environment --command bash -c 'RUSTFLAGS="-C target-feature=+crt-static" cargo build --release --target x86_64-unknown-linux-gnu'
- name: Show size
run: ls -lah target/x86_64-unknown-linux-gnu/release/lightswitch
- name: Run `ldd`
run: ldd target/x86_64-unknown-linux-gnu/release/lightswitch
- name: Upload binary
if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
uses: actions/upload-artifact@main
with:
name: lightswitch-x86_64
path: target/x86_64-unknown-linux-gnu/release/lightswitch