forked from rusty-celery/rusty-celery
-
Notifications
You must be signed in to change notification settings - Fork 0
207 lines (175 loc) · 5.73 KB
/
ci.yml
File metadata and controls
207 lines (175 loc) · 5.73 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
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
name: CI
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
# cancel-in-progress: true
on:
push:
branches:
- main
pull_request:
branches:
- main
# schedule:
# - cron: '0 10 * * *' # run at 10 AM UTC
jobs:
changelog:
name: CHANGELOG
runs-on: ubuntu-latest
# Only run this on pull requests.
if: github.event_name == 'pull_request'
steps:
- uses: actions/checkout@v3
with:
fetch-deptch: 0
- name: Check if source files have changed
run: |
git diff --name-only $(git merge-base origin/main HEAD) | grep 'src/' && echo "source_files_changed=true" >> $GITHUB_ENV || echo "source_files_changed=false" >> $GITHUB_ENV
- name: Check that CHANGELOG has been updated
if: env.source_files_changed == 'true'
run: |
# If this step fails, this means you haven't updated the CHANGELOG.md
# file with notes on your contribution.
git diff --name-only $(git merge-base origin/main HEAD) | grep '^CHANGELOG.md$' && echo "Thanks for helping keep our CHANGELOG up-to-date!"
build_checks:
name: ${{ matrix.task.name }} (${{ matrix.os }})
runs-on: ${{ matrix.os }}
env:
RUST_BACKTRACE: full
RUSTC_WRAPPER: sccache
RUSTV: ${{ matrix.rust }}
SCCACHE_CACHE_SIZE: 1G
CACHE_PREFIX: v0
AMQP_ADDR: amqp://127.0.0.1:5672//
REDIS_ADDR: redis://127.0.0.1:6379/
services: ${{ matrix.services }}
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest, macos-latest]
rust: [stable]
task:
- name: Lint
run: make check-clippy
include:
- os: ubuntu-latest
rust: stable
services: {}
task:
name: Format
run: make check-fmt
- os: ubuntu-latest
rust: nightly
services: {}
task:
name: Build docs
run: make build-docs
- os: ubuntu-latest
rust: stable
services:
rabbitmq:
image: rabbitmq
ports:
- 5672:5672
redis:
image: redis
ports:
- 6379:6379
task:
name: Run tests
run: make run-all-tests
- os: ubuntu-latest
services: {}
- os: macos-latest
services: {}
- os: ubuntu-latest
rust: nightly
services: {}
task:
name: Check minimal versions
run: make check-minimal-versions
steps:
- uses: actions/checkout@v3
- name: Prepare environment (ubuntu-latest)
run: |
echo "SCCACHE_DIR=$HOME/.cache/sccache" >> $GITHUB_ENV
- name: Prepare environment (macos-latest)
run: |
echo "SCCACHE_DIR=$HOME/Library/Caches/Mozilla.sccache" >> $GITHUB_ENV
- name: Install sccache (ubuntu-latest)
if: matrix.os == 'ubuntu-latest'
env:
LINK: https://github.com/mozilla/sccache/releases/download
SCCACHE_VERSION: v0.2.15
run: |
SCCACHE_FILE=sccache-$SCCACHE_VERSION-x86_64-unknown-linux-musl
URL="$LINK/$SCCACHE_VERSION/$SCCACHE_FILE.tar.gz"
echo "Downloading sccache from $URL"
mkdir -p $HOME/.local/bin
curl -L $URL | tar xz
mv -f $SCCACHE_FILE/sccache $HOME/.local/bin/sccache
chmod +x $HOME/.local/bin/sccache
echo "$HOME/.local/bin" >> $GITHUB_PATH
- name: Install sccache (macos-latest)
if: matrix.os == 'macos-latest'
run: |
# brew update # takes forever
brew install sccache
- name: Install Rust ${{ matrix.rust }}
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.rust }}
profile: minimal
override: true
- name: Install Musl Tools
if: ${{ matrix.os == 'ubuntu-latest' }}
run: |
sudo apt install -y musl-tools
sudo ln -s /usr/bin/musl-gcc /usr/local/bin/x86_64-linux-musl-gcc
echo "TARGET_CC=musl-gcc" | tee -a $GITHUB_ENV
rustup target add x86_64-unknown-linux-musl
- name: Cache cargo registry and sccache
uses: actions/cache@v3
continue-on-error: false
with:
path: |
~/.cargo/registry
~/.cargo/git
${{ env.SCCACHE_DIR }}
key: ${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.task.name }}-${{ hashFiles('**/Cargo.toml') }}
restore-keys: |
${{ env.CACHE_PREFIX }}-${{ runner.os }}-${{ matrix.task.name }}-
- name: Start sccache server
run: sccache --start-server
- name: ${{ matrix.task.name }}
run: ${{ matrix.task.run }}
- name: Stop sccache server
run: sccache --stop-server || true
test_python_example:
name: Check python example
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup Python
uses: actions/setup-python@v4
with:
python-version: 3.9
- name: Cache pip
uses: actions/cache@v3
with:
path: ~/.cache/pip # This path is specific to Ubuntu
key: pip ${{ runner.os }} ${{ env.pythonLocation }} ${{ hashFiles('requirements.txt') }} ${{ hashFiles('dev-requirements.txt') }}
- name: Install requirements
run: |
pip install -r requirements.txt -r dev-requirements.txt
- name: Check formatting
if: always()
run: |
black --check examples/
- name: Lint
if: always()
run: |
flake8 examples/
- name: Typecheck
if: always()
run: |
mypy --ignore-missing-imports examples/