name: CI on: push: branches: - main pull_request: branches: - main jobs: build: name: Google Cloud Build # This is a pull request, and gcloud would fail for external PRs. if: (!github.head_ref) || (!github.base_ref) runs-on: ubuntu-latest steps: - uses: actions/checkout@master - uses: GoogleCloudPlatform/github-actions/setup-gcloud@master with: version: '275.0.0' service_account_key: ${{ secrets.GCLOUD_AUTH }} - name: Build, Test, Push to GCR run: | BRANCH_NAME=$GITHUB_REPOSITORY/$(expr $GITHUB_REF : '.*/\(.*\)') && \ BRANCH_NAME=${BRANCH_NAME,,} && \ gcloud builds submit . --config cloudbuild.yaml --project zealous-zebra --substitutions BRANCH_NAME=$BRANCH_NAME test: name: Build and test on ${{ matrix.os }} runs-on: ${{ matrix.os }} strategy: matrix: os: [ubuntu-latest, windows-latest, macOS-latest] steps: - uses: actions/checkout@v1 - uses: actions-rs/toolchain@v1 with: toolchain: stable override: true - name: cargo fetch uses: actions-rs/cargo@v1 with: command: fetch - name: Run tests uses: actions-rs/cargo@v1 with: command: test args: --verbose --all - name: Build uses: actions-rs/cargo@v1 with: command: build args: --verbose --release grcov: name: Code Coverage runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: toolchain: stable override: true - name: Run cargo-tarpaulin uses: actions-rs/tarpaulin@v0.1 with: version: '0.12.3' timeout: 300 - name: Upload coverage report to Codecov uses: codecov/codecov-action@v1 clippy: name: Clippy runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: toolchain: nightly components: clippy override: true - name: Run clippy uses: actions-rs/clippy@master # Next gen Clippy Action, unstable with: args: --all-features --all-targets fmt: name: Rustfmt runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - uses: actions-rs/toolchain@v1 with: toolchain: stable override: true - run: rustup component add rustfmt - uses: actions-rs/cargo@v1 with: command: fmt args: --all -- --check