Auto merge of #708 - Mark-Simulacrum:correct-logs, r=Mark-Simulacrum #229
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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 |