-
Notifications
You must be signed in to change notification settings - Fork 2
174 lines (152 loc) · 4.86 KB
/
Copy pathrust.yml
File metadata and controls
174 lines (152 loc) · 4.86 KB
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
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
name: Rust
on:
workflow_dispatch:
push:
branches: [ master ]
paths-ignore:
- 'README.md'
- '**/*.nix'
- 'nix/envrc'
- 'flake.lock'
pull_request:
branches: [ master ]
paths-ignore:
- 'README.md'
- '**/*.nix'
- 'nix/envrc'
- 'flake.lock'
env:
CARGO_TERM_COLOR: always
CARGO_NET_RETRY: 10
RUST_BACKTRACE: short
jobs:
check:
runs-on: ubuntu-latest
name: Build scherzo
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true
- name: Install nix
uses: cachix/install-nix-action@v16
with:
extra_nix_config: |
experimental-features = nix-command flakes
nix_path: nixpkgs=channel:nixos-unstable
- name: Install dependencies
run: |
sudo apt update -yy
sudo apt install -yy --no-install-recommends protobuf-compiler clang
- name: Install rust
run: rustup update && rustup component add rustfmt clippy
- name: Cache rust
uses: Swatinem/rust-cache@v1
with:
key: cache-debug
- name: Install Cargo Deny
run: cargo install --locked cargo-deny
- name: Cargo Deny
run: cargo deny check
- name: Test (with sled DB)
run: nix-shell -p mold --run "cargo test --no-default-features --features sled,voice"
- name: Test (with sqlite DB)
run: nix-shell -p mold --run "cargo test --no-default-features --features sqlite,voice"
build-release:
needs: check
if: github.event_name == 'push'
runs-on: ubuntu-latest
name: Build release binaries
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
submodules: true
- name: Install nix
uses: cachix/install-nix-action@v16
with:
extra_nix_config: |
experimental-features = nix-command flakes
nix_path: nixpkgs=channel:nixos-unstable
- name: Install dependencies
run: |
sudo apt update -yy
sudo apt install -yy --no-install-recommends protobuf-compiler clang
- name: Install rust
run: rustup update && rustup component add rustfmt clippy
- name: Cache rust
uses: Swatinem/rust-cache@v1
with:
key: cache-release-1
- name: Build release
run: nix-shell -p mold --run "cargo build --release --no-default-features --features sled,voice,jemalloc"
- name: Build release (migrate binary)
run: nix-shell -p mold --run "cargo build --release --no-default-features --features sled,sqlite,jemalloc --bin scherzo_migrate"
#- name: UPX
# run: |
# ./upx target/x86_64-unknown-linux-gnu/release/scherzo
# ./upx target/x86_64-unknown-linux-gnu/release/scherzo_cmd
- name: Upload release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
wget -q https://github.com/TheAssassin/pyuploadtool/releases/download/continuous/pyuploadtool-x86_64.AppImage
chmod +x pyuploadtool-x86_64.AppImage
./pyuploadtool-x86_64.AppImage target/release/scherzo target/release/scherzo_cmd target/release/scherzo_migrate
update:
needs: build-release
name: Update Scherzo at harmonyapp.io
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
- name: Checkout repo
uses: actions/checkout@v3
with:
repository: 'harmony-development/ansible'
- run: 'echo "$SSH_KEY" > key && chmod 600 key'
shell: bash
env:
SSH_KEY: ${{secrets.ACTIONS_SSH_KEY}}
- run: 'echo "$KNOWN_HOSTS" > known_hosts && chmod 600 known_hosts'
shell: bash
env:
KNOWN_HOSTS: ${{secrets.ACTIONS_SSH_KNOWN_HOSTS}}
- run: 'ansible-playbook only-scherzo.yml --key-file key'
shell: bash
env:
SSH_HOST: ${{secrets.ACTIONS_SSH_HOST}}
- name: Trigger integration testing
if: ${{ github.ref == 'refs/heads/master' }}
uses: peter-evans/repository-dispatch@v1
with:
token: ${{ secrets.INTEGRATION_TEST_PAT }}
repository: harmony-development/integration-testing
event-type: dep-updated
docker:
needs: build-release
name: Update scherzo docker image
runs-on: ubuntu-latest
if: github.event_name == 'push'
steps:
-
name: Set up QEMU
uses: docker/setup-qemu-action@v1
-
name: Set up Docker Buildx
uses: docker/setup-buildx-action@v1
-
name: Login to DockerHub
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
-
name: Build and push
id: docker_build
uses: docker/build-push-action@v2
with:
push: true
tags: yusdacra/scherzo:latest
-
name: Image digest
run: echo ${{ steps.docker_build.outputs.digest }}