-
Notifications
You must be signed in to change notification settings - Fork 91
150 lines (124 loc) · 3.79 KB
/
bors.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
140
141
142
143
144
145
146
147
148
149
150
name: bors build
on:
push:
branches:
- try
- auto
jobs:
lint:
name: Linting
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Install Rust nightly
run: rustup update nightly && rustup default nightly && rustup component add rustfmt clippy
- name: Check the code formatting with rustfmt
run: cargo fmt --all -- --check
- name: Ensure there are no warnings with Clippy
run: cargo clippy --all -- -Dwarnings
- name: Check if the configuration is correct
run: |
cargo run -- create-lists
cargo run -- check-config
test:
name: Testing
strategy:
matrix:
os: [ubuntu-latest, windows-latest]
channel: [nightly]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Rust ${{ matrix.channel }}
shell: bash
run: rustup update --no-self-update $CHANNEL && rustup default $CHANNEL
env:
CHANNEL: ${{ matrix.channel }}
- name: Build Crater
shell: bash
run: cargo build
- name: Run Crater tests
shell: bash
run: |
cargo run -- create-lists
cargo test
minicrater:
name: Minicrater
strategy:
matrix:
os: [ubuntu-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v2
- name: Install Rust nightly
run: rustup update --no-self-update nightly && rustup default nightly
- name: Run minicrater
shell: bash
run: |
cargo run -- create-lists
cargo test -- --ignored --nocapture --test-threads 1
env:
MINICRATER_FAST_WORKSPACE_INIT: 1
MINICRATER_SHOW_OUTPUT: 1
docker-build:
name: Build the Docker image
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Build the Docker image
run: docker build -t crater .
- name: Prepare the Docker image to be uploaded
run: |
mkdir -p /tmp/docker-images
docker save crater | gzip > /tmp/docker-images/crater.tar.gz
- name: Upload the image to GitHub Actions artifacts
uses: actions/upload-artifact@v2
with:
name: docker-images
path: /tmp/docker-images
docker-upload:
name: Upload the Docker images to ECR
runs-on: ubuntu-latest
needs:
- lint
- test
- minicrater
- docker-build
steps:
- name: Download the image from GitHub Actions artifacts
uses: actions/download-artifact@v2
with:
name: docker-images
path: docker-images
- name: Load the downloaded image
run: cat docker-images/crater.tar.gz | gunzip | docker load
- name: Upload the Docker image to ECR
uses: rust-lang/simpleinfra/github-actions/upload-docker-image@master
with:
image: crater
repository: crater
region: us-west-1
aws_access_key_id: "${{ secrets.aws_access_key_id }}"
aws_secret_access_key: "${{ secrets.aws_secret_access_key }}"
if: github.ref == 'refs/heads/auto'
# These jobs doesn't actually test anything, but they're only used to tell
# bors the build completed, as there is no practical way to detect when a
# workflow is successful listening to webhooks only.
#
# ALL THE PREVIOUS JOBS NEEDS TO BE ADDED TO THE `needs` SECTION OF THIS JOB!
end-success:
name: bors build finished
if: success()
runs-on: ubuntu-latest
needs: [docker-upload]
steps:
- name: Mark the job as successful
run: exit 0
end-failure:
name: bors build finished
if: "!success()"
runs-on: ubuntu-latest
needs: [docker-upload]
steps:
- name: Mark the job as a failure
run: exit 1