-
-
Notifications
You must be signed in to change notification settings - Fork 0
51 lines (43 loc) · 1.48 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
name: Build
on:
push:
branches: [ "main", "dev" ]
pull_request:
branches: [ "main", "dev" ]
env:
CARGO_TERM_COLOR: always
jobs:
build:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- name: Cache cargo dependencies
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --verbose
- name: Setup SSH for tests
env:
USER_TEST: usertest
run: |
sudo service ssh start
mkdir ${HOME}/.ssh
ssh-keyscan -H localhost | tee -a ${HOME}/.ssh/known_hosts
ssh-keygen -t ed25519 -N "" -f ${HOME}/.ssh/id_ed25519
sudo useradd -m -d /home/${USER_TEST} -N ${USER_TEST}
sudo usermod -a -G sudo ${USER_TEST}
echo '%sudo ALL=(ALL) NOPASSWD:ALL' | sudo tee /etc/sudoers.d/sudo-nopasswd
sudo -u ${USER_TEST} mkdir /home/${USER_TEST}/.ssh
cat ${HOME}/.ssh/id_ed25519.pub | sudo -u ${USER_TEST} tee -a /home/${USER_TEST}/.ssh/authorized_keys
sudo chmod 700 /home/${USER_TEST}/.ssh
sudo chmod 600 /home/${USER_TEST}/.ssh/authorized_keys
echo "127.0.0.1 localhost2" | sudo tee -a /etc/hosts > /dev/null
- name: Run tests
run: cargo test --verbose