Merge pull request #223 from jonhoo/ci

Move CI to GitHub Actions
This commit is contained in:
Jon Gjengset 2022-02-19 11:02:54 -08:00 committed by GitHub
commit 60e1260d3c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
10 changed files with 221 additions and 134 deletions

View file

@ -1,22 +0,0 @@
task:
name: freebsd-stable
freebsd_instance:
image_family: freebsd-12-1
env:
RUST_BACKTRACE: 1
setup_script:
- pkg install -y curl git
- curl https://sh.rustup.rs -sSf --output rustup.sh
- sh rustup.sh -y
- . $HOME/.cargo/env
check_script:
- . $HOME/.cargo/env
- cargo check --all-targets --all-features
build_script:
- . $HOME/.cargo/env
- cargo build --all-targets --verbose --all-features
test_script:
- . $HOME/.cargo/env
- cargo test --examples --all-features
- cargo test --doc --all-features
- cargo test --lib --all-features

34
.github/workflows/coverage.yml vendored Normal file
View file

@ -0,0 +1,34 @@
on:
push:
branches: [master]
pull_request:
name: coverage
jobs:
test:
runs-on: ubuntu-latest
container:
image: xd009642/tarpaulin
options: --security-opt seccomp=unconfined
steps:
- uses: actions/checkout@v2
- name: Generate code coverage
run: |
cargo tarpaulin --verbose --timeout 120 --out Xml
env:
TEST_HOST: greenmail
- name: Upload to codecov.io
uses: codecov/codecov-action@v2
with:
fail_ci_if_error: true
services:
greenmail:
image: greenmail/standalone:1.6.3
ports:
- 3025:3025
- 3110:3110
- 3143:3143
- 3465:3465
- 3993:3993
- 3995:3995
env:
GREENMAIL_OPTS: "-Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.auth.disabled -Dgreenmail.verbose"

25
.github/workflows/features.yml vendored Normal file
View file

@ -0,0 +1,25 @@
on:
push:
branches: [master]
pull_request:
name: cargo hack
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: actions/checkout@v2
- name: Install cargo-hack
uses: actions-rs/install@v0.1
with:
crate: cargo-hack
version: latest
use-tool-cache: true
- name: cargo hack
uses: actions-rs/cargo@v1
with:
command: hack
args: --feature-powerset check --all-targets

40
.github/workflows/minimal.yml vendored Normal file
View file

@ -0,0 +1,40 @@
on:
push:
branches: [master]
pull_request:
name: With dependencies at minimal versions
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: nightly
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: actions/checkout@v2
- name: cargo update -Zminimal-versions
uses: actions-rs/cargo@v1
with:
command: update
toolchain: nightly
args: -Zminimal-versions
- name: cargo test
uses: actions-rs/cargo@v1
with:
command: test
services:
greenmail:
image: greenmail/standalone:1.6.3
ports:
- 3025:3025
- 3110:3110
- 3143:3143
- 3465:3465
- 3993:3993
- 3995:3995
env:
GREENMAIL_OPTS: "-Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.auth.disabled -Dgreenmail.verbose"

19
.github/workflows/msrv.yml vendored Normal file
View file

@ -0,0 +1,19 @@
on:
push:
branches: [master]
pull_request:
name: Minimum Supported Rust Version
jobs:
check:
runs-on: ubuntu-latest
steps:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: 1.46.0 # bitflags requires 1.46+
override: true
- uses: actions/checkout@v2
- name: cargo +1.46.0 check
uses: actions-rs/cargo@v1
with:
command: check

24
.github/workflows/os-check.yml vendored Normal file
View file

@ -0,0 +1,24 @@
on:
push:
branches: [master]
pull_request:
name: cargo check
jobs:
os-check:
runs-on: ${{ matrix.os }}
name: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
os: [macos-latest, windows-latest]
steps:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
- uses: actions/checkout@v2
- name: cargo check
uses: actions-rs/cargo@v1
with:
command: check
args: --all-features --all-targets

36
.github/workflows/style.yml vendored Normal file
View file

@ -0,0 +1,36 @@
on:
push:
branches: [master]
pull_request:
name: lint
jobs:
style:
runs-on: ubuntu-latest
name: ${{ matrix.toolchain }}
strategy:
fail-fast: false
matrix:
toolchain: [stable, beta]
steps:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
components: rustfmt, clippy
- uses: actions/checkout@v2
- name: cargo fmt --check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --check
- name: cargo doc
uses: actions-rs/cargo@v1
if: always()
with:
command: doc
args: --no-deps --all-features
- name: cargo clippy
uses: actions-rs/clippy-check@v1
if: always()
with:
token: ${{ secrets.GITHUB_TOKEN }}

34
.github/workflows/test.yml vendored Normal file
View file

@ -0,0 +1,34 @@
on:
push:
branches: [master]
pull_request:
name: cargo test
jobs:
test:
runs-on: ubuntu-latest
name: ${{ matrix.toolchain }}
strategy:
matrix:
toolchain: [stable, beta, nightly]
steps:
- uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: ${{ matrix.toolchain }}
- uses: actions/checkout@v2
- name: cargo test
uses: actions-rs/cargo@v1
with:
command: test
services:
greenmail:
image: greenmail/standalone:1.6.3
ports:
- 3025:3025
- 3110:3110
- 3143:3143
- 3465:3465
- 3993:3993
- 3995:3995
env:
GREENMAIL_OPTS: "-Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.auth.disabled -Dgreenmail.verbose"

View file

@ -21,7 +21,7 @@ default = ["native-tls"]
native-tls = { version = "0.2.2", optional = true } native-tls = { version = "0.2.2", optional = true }
rustls-connector = { version = "0.13.1", optional = true } rustls-connector = { version = "0.13.1", optional = true }
regex = "1.0" regex = "1.0"
bufstream = "0.1" bufstream = "0.1.3"
imap-proto = "0.14.1" imap-proto = "0.14.1"
nom = { version = "6.0", default-features = false } nom = { version = "6.0", default-features = false }
base64 = "0.13" base64 = "0.13"
@ -30,11 +30,17 @@ lazy_static = "1.4"
ouroboros = "0.9.5" ouroboros = "0.9.5"
[dev-dependencies] [dev-dependencies]
lettre = "0.9" lettre = "0.9.2"
lettre_email = "0.9" lettre_email = "0.9.2"
rustls-connector = "0.13.0" rustls-connector = "0.13.0"
structopt = "0.3" structopt = "0.3"
# to make -Zminimal-versions work
encoding = "0.2.32"
hostname = "0.1.3"
failure = "0.1.8"
mime = "0.3.4"
[[example]] [[example]]
name = "basic" name = "basic"
required-features = ["default"] required-features = ["default"]

View file

@ -1,109 +0,0 @@
jobs:
- job: test
displayName: cargo test --{examples,doc,lib}
strategy:
matrix:
Linux-stable:
vmImage: ubuntu-latest
rust: stable
Linux-beta:
vmImage: ubuntu-latest
rust: beta
Linux-nightly:
vmImage: ubuntu-latest
rust: nightly
MacOS:
vmImage: macOS-10.14
rust: stable
Windows:
vmImage: windows-2019
rust: stable
continueOnError: $[eq(variables.rust, 'nightly')]
pool:
vmImage: $(vmImage)
steps:
- template: install-rust.yml@templates
parameters:
rust: $(rust)
- script: cargo check --all-targets --all-features
displayName: cargo check
- script: cargo test --examples --all-features
displayName: cargo test --examples
- script: cargo test --doc --all-features
displayName: cargo test --doc
- script: cargo test --lib --all-features
displayName: cargo test --lib
- script: |
set -e
rustup component add rustfmt
cargo fmt --all -- --check
displayName: cargo fmt --check
condition: and(eq( variables['rust'], 'beta' ), eq( variables['Agent.OS'], 'Linux' ))
- script: |
set -e
rustup component add clippy
cargo clippy -- -D warnings
displayName: cargo clippy
condition: and(eq( variables['rust'], 'beta' ), eq( variables['Agent.OS'], 'Linux' ))
# This represents the minimum Rust version supported.
# Tests are not run as tests may require newer versions of rust.
- job: msrv
pool:
vmImage: ubuntu-latest
displayName: "Minimum supported Rust version: 1.46.0"
dependsOn: []
steps:
- template: install-rust.yml@templates
parameters:
rust: 1.46.0 # bitflags requires 1.46+
- script: cargo check
displayName: cargo check
- job: integration
displayName: cargo test --tests
pool:
vmImage: ubuntu-latest
services:
greenmail: greenmail
steps:
- template: install-rust.yml@templates
- script: cargo test --tests
displayName: cargo test
- template: coverage.yml@templates
parameters:
token: $(CODECOV_TOKEN_SECRET)
services:
greenmail: greenmail
env:
TEST_HOST: greenmail
- job: features
displayName: "Check feature combinations"
pool:
vmImage: ubuntu-latest
steps:
- template: install-rust.yml@templates
parameters:
rust: stable
- script: cargo install cargo-hack
displayName: install cargo-hack
- script: cargo hack --feature-powerset check --all-targets
displayName: cargo hack
resources:
repositories:
- repository: templates
type: github
name: crate-ci/azure-pipelines
ref: refs/heads/v0.4
endpoint: jonhoo
containers:
- container: greenmail
image: greenmail/standalone:1.6.3
ports:
- 3025:3025
- 3110:3110
- 3143:3143
- 3465:3465
- 3993:3993
- 3995:3995
env:
GREENMAIL_OPTS: "-Dgreenmail.setup.test.all -Dgreenmail.hostname=0.0.0.0 -Dgreenmail.auth.disabled -Dgreenmail.verbose"