-
Notifications
You must be signed in to change notification settings - Fork 16
136 lines (132 loc) · 5.04 KB
/
ci.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
name: CI
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
msrv:
name: "Verify builds on minimum stable rust version of ${{ matrix.rust }}"
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- { rust: 1.58.1, os: ubuntu-latest }
- { rust: 1.58.1, os: macos-latest }
- { rust: 1.58.1, os: windows-latest }
steps:
- uses: actions/checkout@v2
- name: Install Rust ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
- uses: Swatinem/rust-cache@v1
- name: Build against Rust ${{ matrix.rust }}
run: cargo build --release
unit_tests:
name: "Unit tests for Rust stable"
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: Swatinem/rust-cache@v1
- run: cargo test
tests:
name: "Test Rust ${{ matrix.rust }} for ${{ matrix.test }} w/ ${{ matrix.manager }} (${{ matrix.os }})"
runs-on: ${{ matrix.os }}
env:
WINSW_URL: https://github.com/winsw/winsw/releases/download/v3.0.0-alpha.11/WinSW-x64.exe
strategy:
fail-fast: false
matrix:
include:
- { rust: stable, os: ubuntu-latest, manager: systemd, test: systemd_for_user }
- { rust: stable, os: ubuntu-latest, manager: systemd, test: systemd_for_system, elevated: sudo env PATH="$PATH" }
- { rust: stable, os: macos-latest, manager: launchd, test: launchd_for_user }
- { rust: stable, os: macos-latest, manager: launchd, test: launchd_for_system, elevated: sudo }
- { rust: stable, os: windows-latest, manager: sc, test: sc_for_system }
- { rust: stable, os: windows-latest, manager: winsw, test: winsw_for_system }
steps:
- uses: actions/checkout@v2
- name: Install Rust ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.rust }}
- name: Download WinSW for Windows
if: matrix.os == 'windows-latest' && matrix.manager == 'winsw'
run: |
$winsw_dir = "$env:GITHUB_WORKSPACE\winsw"
New-Item -ItemType directory -Path $winsw_dir -Force
Invoke-WebRequest -Uri ${{ env.WINSW_URL }} -OutFile "$winsw_dir\WinSW.exe"
echo "$winsw_dir" | Out-File -Append -Encoding utf8 -FilePath $env:GITHUB_PATH
- uses: Swatinem/rust-cache@v1
- name: Run ${{ matrix.test }} for ${{ matrix.manager }}
run: |
${{ matrix.elevated }} rustup default stable
${{ matrix.elevated }} cargo test -p system-tests ${{ matrix.test }} -- --nocapture
# NOTE: This is disabled via `if: false` due to failures related to the test environment.
test-freebsd:
name: "Test Rust stable for ${{ matrix.test }} w/ ${{ matrix.manager }} (FreeBSD)"
runs-on: macos-12
if: false
env:
IGNORE_OSVERSION: yes
strategy:
fail-fast: false
matrix:
include:
- { manager: rc.d, test: rc_d_for_system }
steps:
- uses: actions/checkout@v2
- name: Run ${{ matrix.test }} for ${{ matrix.manager }}
uses: cross-platform-actions/action@no-vm-shutdown
with:
operating_system: freebsd
version: '13.2'
environment_variables: IGNORE_OSVERSION
shell: bash
sync_files: runner-to-vm
run: |
sudo pkg install -y curl && \
curl https://sh.rustup.rs -sSf | \
sh -s -- -y --profile minimal
. "$HOME/.cargo/env"
sudo --preserve-env cargo test -p system-tests ${{ matrix.test }} -- --nocapture
# Note: We need to delete target otherwise the vm teardown fails!
sudo rm -rf target/
test-alpine-openrc:
name: "Test Rust stable for ${{ matrix.test }} w/ ${{ matrix.manager }} (Alpine Linux)"
runs-on: ubuntu-latest
container: dockage/alpine:3.16-openrc
strategy:
fail-fast: false
matrix:
include:
- { manager: OpenRC, test: openrc_for_system }
steps:
- uses: actions/checkout@v2
- name: Install base dependencies
run: apk add --update --no-cache openrc busybox-initscripts build-base libc6-compat curl sudo
- name: Configure passwordless sudo
run: echo '%sudo ALL=(ALL) NOPASSWD:ALL' >> /etc/sudoers
- name: Force OpenRC to work inside container
run: |
sudo mkdir -p /run/openrc
sudo touch /run/openrc/softlevel
sudo rc-update --update
sudo rc-status -a
- name: Install stable toolchain
run: curl https://sh.rustup.rs -sSf | sh -s -- -y --profile minimal
- name: Run ${{ matrix.test }} for ${{ matrix.manager }} using sudo
run: |
. "$HOME/.cargo/env"
sudo --preserve-env cargo test -p system-tests ${{ matrix.test }} -- --nocapture