Skip to content

CI

CI #556

Workflow file for this run

name: CI
on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
create:
tags:
- v*
env:
CARGO_TERM_COLOR: always
jobs:
build:
name: build for the web
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build deps
run: sudo apt-get update && sudo apt-get install -y libatk1.0-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
- uses: Swatinem/rust-cache@v1
- name: Install toolchain
uses: actions-rs/toolchain@v1
with:
toolchain: stable
target: wasm32-unknown-unknown
- name: Install trunk
uses: baptiste0928/cargo-install@v1
with:
crate: trunk
- name: Build for web
run: trunk build --release --public-url mpc_valet
- name: Upload site
uses: actions/upload-artifact@v3
with:
name: dist
path: dist
test:
name: test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build deps
run: sudo apt-get update && sudo apt-get install -y libatk1.0-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
- uses: Swatinem/rust-cache@v1
- name: Run tests
run: cargo test --verbose
style:
name: style
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build deps
run: sudo apt-get update && sudo apt-get install -y libatk1.0-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
- uses: Swatinem/rust-cache@v1
- name: Run clippy
run: cargo clippy
dependabot:
name: 'Dependabot automerge'
needs:
- build
- test
- style
permissions:
pull-requests: write
contents: write
runs-on: ubuntu-latest
if: ${{ github.actor == 'dependabot[bot]' && github.event_name == 'pull_request'}} # Detect that the PR author is dependabot
steps:
- uses: fastify/[email protected]
with:
github-token: ${{ secrets.GITHUB_TOKEN }}
release:
needs:
- build
- test
- style
runs-on: ubuntu-latest
permissions:
contents: write
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: ncipollo/release-action@v1
with:
token: ${{ secrets.GITHUB_TOKEN }}
generateReleaseNotes: true
release_web:
name: release web
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v3
- name: Download dist
uses: actions/[email protected]
with:
name: dist
path: dist
- name: Deploy to github pages
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: dist
release_crate:
name: release crate
runs-on: ubuntu-latest
needs: release
steps:
- uses: actions/checkout@v3
- uses: Swatinem/rust-cache@v1
- name: Build deps
run: sudo apt-get update && sudo apt-get install -y libatk1.0-dev libgtk-3-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev libspeechd-dev libxkbcommon-dev libssl-dev
- name: Publish crate
run: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}