language: python
python:
- "3.8"
install:
- pip install -r requirements.txt
script:
- python3 pytest.py
language: node_js
node_js:
- "12"
- "14"
- "16"
# Specify the operating system
os:
- linux
- osx
# Cache dependencies
cache:
directories:
- node_modules
# Install dependencies
install:
- npm ci
# Run tests
script:
- npm run test
- npm run build
# Run jobs in parallel
jobs:
include:
- stage: lint
node_js: "16"
script: npm run lint
- stage: coverage
node_js: "16"
script: npm run test:coverage
# Deploy to npm
deploy:
provider: npm
email: "[email protected]"
api_key: $NPM_TOKEN
on:
tags: true
branch: main
# Notifications
notifications:
email:
on_success: never
on_failure: always
slack:
rooms:
- secure: "encrypted-slack-webhook-url"
language: java
jdk:
- openjdk11
- openjdk14
# Cache dependencies
cache:
directories:
- $HOME/.m2
# Build stages
stages:
- test
- name: deploy
if: branch = main
jobs:
include:
- stage: test
name: "Unit Tests"
script: mvn test
- stage: test
name: "Integration Tests"
script: mvn verify -Pintegration-tests
- stage: deploy
name: "Deploy to Staging"
script: mvn deploy -Pstaging
# Notifications
notifications:
email:
recipients:
- [email protected]
on_success: change
on_failure: always
# Before install steps
before_install:
- chmod +x mvnw
# Main build script
script:
- ./mvnw clean install
# After success steps
after_success:
- bash <(curl -s https://codecov.io/bash)
# Only build these branches
branches:
only:
- main
- develop
language: cpp
compiler:
- gcc
- clang
before_install:
- sudo apt-get update
- sudo apt-get install -y cmake
script:
- mkdir build
- cd build
- cmake ..
- make
- make test
notifications:
email: false
language: php
php:
- 7.4
- 8.0
- 8.1
before_script:
- composer self-update
- composer install --no-interaction
script:
- vendor/bin/phpunit
- vendor/bin/phpcs
cache:
directories:
- $HOME/.composer/cache
notifications:
email: false
language: rust
rust:
- stable
- beta
- nightly
matrix:
allow_failures:
- rust: nightly
fast_finish: true
cache: cargo
before_script:
- rustup component add clippy
script:
- cargo build --verbose
- cargo test --verbose
- cargo clippy -- -D warnings
notifications:
email: false
language: go
go:
- 1.16.x
- 1.17.x
- 1.18.x
- tip
matrix:
allow_failures:
- go: tip
fast_finish: true
before_install:
- go get -t -v ./...
script:
- go test -race -coverprofile=coverage.txt -covermode=atomic
- go vet ./...
- diff -u <(echo -n) <(gofmt -d .)
after_success:
- bash <(curl -s https://codecov.io/bash)
notifications:
email: false
language: csharp
mono: none
dotnet: 6.0.100
install:
- dotnet restore
script:
- dotnet build
- dotnet test
notifications:
email: false
branches:
only:
- main
- develop
cache:
directories:
- $HOME/.nuget/packages
language: csharp
mono: none
dotnet: 6.0.100
install:
- dotnet restore
script:
- dotnet build
- dotnet test
notifications:
email: false
branches:
only:
- main
- develop
cache:
directories:
- $HOME/.nuget/packages
language: node_js
node_js:
- "12"
- "14"
- "16"
# Specify the operating system
os:
- linux
- osx
# Cache dependencies
cache:
directories:
- node_modules
# Install dependencies
install:
- npm ci
# Run tests
script:
- npm run test
- npm run build
# Run jobs in parallel
jobs:
include:
- stage: lint
node_js: "16"
script: npm run lint
- stage: coverage
node_js: "16"
script: npm run test:coverage
# Deploy to npm
deploy:
provider: npm
email: "[email protected]"
api_key: $NPM_TOKEN
on:
tags: true
branch: main
# Notifications
notifications:
email:
on_success: never
on_failure: always
slack:
rooms:
- secure: "encrypted-slack-webhook-url"
language: java
jdk:
- openjdk11
- openjdk14
# Cache dependencies
cache:
directories:
- $HOME/.m2
# Build stages
stages:
- test
- name: deploy
if: branch = main
jobs:
include:
- stage: test
name: "Unit Tests"
script: mvn test
- stage: test
name: "Integration Tests"
script: mvn verify -Pintegration-tests
- stage: deploy
name: "Deploy to Staging"
script: mvn deploy -Pstaging
# Notifications
notifications:
email:
recipients:
- [email protected]
on_success: change
on_failure: always
# Before install steps
before_install:
- chmod +x mvnw
# Main build script
script:
- ./mvnw clean install
# After success steps
after_success:
- bash <(curl -s https://codecov.io/bash)
# Only build these branches
branches:
only:
- main
- develop
language: cpp
compiler:
- gcc
- clang
before_install:
- sudo apt-get update
- sudo apt-get install -y cmake
script:
- mkdir build
- cd build
- cmake ..
- make
- make test
notifications:
email: false
language: php
php:
- 7.4
- 8.0
- 8.1
before_script:
- composer self-update
- composer install --no-interaction
script:
- vendor/bin/phpunit
- vendor/bin/phpcs
cache:
directories:
- $HOME/.composer/cache
notifications:
email: false
language: rust
rust:
- stable
- beta
- nightly
matrix:
allow_failures:
- rust: nightly
fast_finish: true
cache: cargo
before_script:
- rustup component add clippy
script:
- cargo build --verbose
- cargo test --verbose
- cargo clippy -- -D warnings
notifications:
email: false
language: go
go:
- 1.16.x
- 1.17.x
- 1.18.x
- tip
matrix:
allow_failures:
- go: tip
fast_finish: true
before_install:
- go get -t -v ./...
script:
- go test -race -coverprofile=coverage.txt -covermode=atomic
- go vet ./...
- diff -u <(echo -n) <(gofmt -d .)
after_success:
- bash <(curl -s https://codecov.io/bash)
notifications:
email: false
language: csharp
mono: none
dotnet: 6.0.100
install:
- dotnet restore
script:
- dotnet build
- dotnet test
notifications:
email: false
branches:
only:
- main
- develop
cache:
directories:
- $HOME/.nuget/packages
language: csharp
mono: none
dotnet: 6.0.100
install:
- dotnet restore
script:
- dotnet build
- dotnet test
notifications:
email: false
branches:
only:
- main
- develop
cache:
directories:
- $HOME/.nuget/packages
当您选择 Travis CI Enterprise 时,升级到最新版本只需五分钟,最大限度地减少您对运维或 IT 的依赖。我们的支持团队始终在那里为您解决意外问题。