-
Notifications
You must be signed in to change notification settings - Fork 1
151 lines (125 loc) · 4.18 KB
/
build.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
140
141
142
143
144
145
146
147
148
149
150
151
on:
push:
branches:
- gha-builder
jobs:
build-linux:
name: build on linux
runs-on: ubuntu-20.04
strategy:
fail-fast: false
matrix:
target:
- aarch64-unknown-linux-gnu
- arm-unknown-linux-gnueabihf
#- x86_64-unknown-freebsd
- x86_64-unknown-linux-musl
steps:
- uses: actions/checkout@v2.1.0
- name: login to ghcr
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: install tools
run: sudo apt-get install -y build-essential capnproto musl-tools
- name: install rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
components: ''
- name: deal with rust cache
uses: Swatinem/rust-cache@v1
with:
key: target-${{ matrix.target }}
- name: cache cargo-cross
id: cache-cargo-cross
uses: actions/cache@v2
env:
cache-name: cargo_cross_git
with:
path: ~/.cargo/bin/cross
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('~/.cargo/bin/cross') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: build cargo-cross
if: steps.cache-cargo-cross.outputs.cache-hit != 'true'
run: cargo install --force --git https://github.com/rust-embedded/cross cross
- name: set up docker buildx
uses: docker/setup-buildx-action@v1
- name: build cross image
uses: docker/build-push-action@v2
with:
context: _cross-builder
build-args: |
CROSS_BASE=${{ matrix.target }}
tags: habnabit/cross:${{ matrix.target }}
load: true
cache-from: type=gha
cache-to: type=gha,mode=max
- name: rust build
run: cross build --target ${{ matrix.target }} --release
- name: copy out
uses: actions/upload-artifact@v2
with:
name: prompt-utils-${{ matrix.target }}
path: target/${{ matrix.target }}/release/hab-prompt-utils
retention-days: 1
build-macos:
name: build on macos
runs-on: macos-latest
strategy:
fail-fast: false
matrix:
target:
- aarch64-apple-darwin
- x86_64-apple-darwin
steps:
- uses: actions/checkout@v2.1.0
- name: install tools
run: |
brew install capnp
- name: install rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
components: ''
- name: deal with rust cache
uses: Swatinem/rust-cache@v1
- name: rust build
run: cargo build --target ${{ matrix.target }} --release
- name: copy out
uses: actions/upload-artifact@v2
with:
name: prompt-utils-${{ matrix.target }}
path: target/${{ matrix.target }}/release/hab-prompt-utils
retention-days: 1
commit:
name: commit results
needs: [build-linux, build-macos]
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2.1.0
with:
ref: main
- name: download the artifacts
uses: actions/download-artifact@v2
with:
path: oh-my-zsh/helper-bins
- name: copy in
run: |
cd oh-my-zsh/helper-bins
mv ./prompt-utils-arm-unknown-linux-gnueabihf/hab-prompt-utils lfs-Linux-armv6l
mv ./prompt-utils-x86_64-apple-darwin/hab-prompt-utils lfs-Darwin-x86_64
mv ./prompt-utils-aarch64-apple-darwin/hab-prompt-utils lfs-Darwin-arm64
mv ./prompt-utils-aarch64-unknown-linux-gnu/hab-prompt-utils lfs-Linux-aarch64
#mv ./prompt-utils-x86_64-unknown-freebsd/hab-prompt-utils lfs-FreeBSD-amd64
mv ./prompt-utils-x86_64-unknown-linux-musl/hab-prompt-utils lfs-Linux-x86_64
chmod +x */hab-prompt-utils
- name: and commit
uses: stefanzweifel/git-auto-commit-action@v4
with:
commit_message: auto built binaries