-
Notifications
You must be signed in to change notification settings - Fork 0
82 lines (82 loc) · 2.86 KB
/
build-and-test.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
name: gh.build-and-test
on: [push]
jobs:
build:
runs-on: ubuntu-latest
container:
image: rust:1.50.0
steps:
- uses: actions/checkout@v1
- name: Apt update
run: apt-get update
- name: Rustup install beta
run: rustup toolchain install beta
- name: Rustup use beta
run: rustup default beta
- name: Build main
run: cargo build
- name: Run tests
run: cargo test -- --nocapture
dist:
runs-on: ubuntu-latest
container:
image: rust:1.50.0
steps:
- uses: actions/checkout@v2
- name: Update apt
run: apt-get update
- name: Install packages
run: apt-get install -y libssl-dev postgresql-client libpq-dev gcc-arm-linux-gnueabihf
- name: Download openssl
run: cd /tmp && wget https://www.openssl.org/source/openssl-1.1.1g.tar.gz
- name: Extract openssl
run: cd /tmp && tar xzf openssl-1.1.1g.tar.gz
- name: Configure openssl
run: cd /tmp/openssl-1.1.1g && ./config shared
env:
MACHINE: armv7
ARCH: arm
CC: arm-linux-gnueabihf-gcc
- name: Build openssl
run: cd /tmp/openssl-1.1.1g && make
env:
MACHINE: armv7
ARCH: arm
CC: arm-linux-gnueabihf-gcc
- name: Add target
run: rustup target add armv7-unknown-linux-gnueabihf
- name: Add target components
run: rustup component add --target armv7-unknown-linux-gnueabihf rust-src rust-std rustc-dev
- name: Build w/ target
run: cargo build --target armv7-unknown-linux-gnueabihf --release
env:
OPENSSL_LIB_DIR: /tmp/openssl-1.1.1g/
OPENSSL_INCLUDE_DIR: /tmp/openssl-1.1.1g/include
- name: Prepare distributable
run: mkdir -p target/dist/carp
- name: Populate distributable
run: cp target/armv7-unknown-linux-gnueabihf/release/carp target/dist/carp/carp
- name: Compress distributable
run: tar cvzf ./carp-armv7-unknown-linux-gnueabihf.tar.gz -C target/dist carp
- name: Create release
if: startsWith(github.ref, 'refs/tags/')
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
- name: Upload asset
if: startsWith(github.ref, 'refs/tags/')
id: upload_release_asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./carp-armv7-unknown-linux-gnueabihf.tar.gz
asset_name: carp-armv7-unknown-linux-gnueabihf.tar.gz
asset_content_type: application/tar+gzip