-
Notifications
You must be signed in to change notification settings - Fork 13
139 lines (120 loc) · 4.13 KB
/
commit.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
name: commit
on:
push:
branches:
- main
pull_request:
jobs:
build_and_test:
strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, macos-latest, windows-2019]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v3
- uses: arduino/setup-protoc@v2
with:
version: "23.1"
repo-token: ${{ secrets.DEV_GITHUB_TOKEN }}
- uses: dtolnay/[email protected]
with:
components: clippy
- uses: actions/github-script@v6
with:
script: |
core.exportVariable('ACTIONS_CACHE_URL', process.env.ACTIONS_CACHE_URL || '');
core.exportVariable('ACTIONS_RUNTIME_TOKEN', process.env.ACTIONS_RUNTIME_TOKEN || '')
- name: Env
run: |
env|sort
- name: Build and run tests on windows
if: runner.os == 'Windows'
shell: pwsh
run: |
Set-ExecutionPolicy -ExecutionPolicy RemoteSigned -Scope CurrentUser
Invoke-RestMethod -Uri https://get.scoop.sh | Invoke-Expression
scoop install sccache
# Set environment variables
$env:SCCACHE_GHA_ENABLED = "on"
$env:RUSTC_WRAPPER = (Get-Command sccache).Source
$env:XET_GLOBAL_DEDUP_POLICY = "never"
# Change directory and build the Rust project
cd rust
cargo build --verbose --profile=opt-test
# Configure Git global settings
git config --global user.email "[email protected]"
git config --global user.name "XetData Automation"
cargo test --profile=opt-test
# Run intergration tests
cd ..
cd gitxet/
cargo build --verbose --profile=opt-test
cargo test --profile=opt-test
- name: Lint (Linux only)
if: runner.os == 'Linux'
run: |
rustup component add rustfmt
for d in * ; do
if [[ ! -e "$d/Cargo.toml" ]] ; then
continue
fi
pushd $d
# cargo format.
cargo fmt
cargo clippy -r --verbose -- -D warnings # elevates warnings to errors
if [[ -n "$(git status --porcelain)" ]] ; then
echo "cargo fmt not run; please run scripts/ready-pull-request.sh and resubmit."
exit 1
fi
if [[ -e ./Cargo.lock ]] ; then
cargo generate-lockfile
if [[ -n "$(git status --porcelain)" ]] ; then
echo "Cargo.lock for $d not up to date; please run scripts/ready-pull-request.sh and resubmit."
exit 1
fi
fi
popd
done
- name: Build
if: runner.os != 'Windows'
shell: bash
run: |
set +x
export RUST_BACKTRACE=1
cd rust
if [ $RUNNER_OS = 'macOS' ]; then
brew install openssl@3
# Upgrading make is required for cargo to play nicely with building openssl
brew install make
export PATH="/usr/local/opt/make/libexec/gnubin:$PATH"
fi
cargo build --verbose --features "strict openssl_vendored"
- name: Test Environment
if: runner.os != 'Windows'
shell: bash
run: |
set +x
if [ $RUNNER_OS = 'macOS' ]; then
brew install md5sha1sum
fi
cd rust
# we need a basic git configuration for the tests to pass
git config --global user.email [email protected]
git config --global user.name "XetData Automation"
- name: Test
if: runner.os != 'Windows'
shell: bash
run: |
set +x
export RUST_BACKTRACE=1
cd rust
cargo test --no-fail-fast --features "strict openssl_vendored"
- name: Integration tests
if: runner.os != 'Windows'
shell: bash
run: |
set +x
export RUST_BACKTRACE=1
cd gitxet
cargo test --no-fail-fast --features "openssl_vendored"