Skip to content

add devcontainer.json #117

add devcontainer.json

add devcontainer.json #117

Workflow file for this run

name: Rust
on:
push:
branches: ["main"]
pull_request:
env:
CARGO_TERM_COLOR: always
jobs:
build-and-test:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
components: rustfmt
- uses: peaceiris/actions-mdbook@v1
- name: format check
uses: actions-rs/cargo@v1
with:
command: fmt
args: --check
- name: cargo build
uses: actions-rs/cargo@v1
with:
command: build
# must run mdbook test right after `cargo build` or it fails to find the crate
- name: mdbook test
run: mdbook test chorus_book -L ./target/debug/deps
- name: cargo test
uses: actions-rs/cargo@v1
with:
command: test
publish-book:
runs-on: ubuntu-22.04
needs: ["build-and-test"]
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v3
- uses: peaceiris/actions-mdbook@v1
- run: mdbook build chorus_book
- name: Upload artifact
uses: actions/upload-pages-artifact@v2
with:
path: ./chorus_book/book
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v2
publish-crates:
runs-on: ubuntu-22.04
needs: ["build-and-test"]
environment:
name: crates-io
url: "https://crates.io/crates/chorus_lib"
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 2
- uses: actions-rs/toolchain@v1
with:
toolchain: stable
- uses: salsify/action-detect-and-tag-new-version@v2
id: detect_and_tag
with:
# reading the version from `chorus_lib` but the value is from the root `Cargo.toml` and is used for all packages
version-command: "cargo read-manifest --manifest-path ./chorus_lib/Cargo.toml | jq -r .version"
- name: cargo publish (chorus_derive)
if: steps.detect_and_tag.outputs.tag
uses: actions-rs/cargo@v1
with:
command: publish
args: -p chorus_derive
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: cargo publish (chorus_lib)
if: steps.detect_and_tag.outputs.tag
uses: actions-rs/cargo@v1
with:
command: publish
args: -p chorus_lib
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
- name: Create GitHub Release
if: steps.detect_and_tag.outputs.tag
uses: softprops/action-gh-release@v1
with:
tag_name: ${{steps.detect_and_tag.outputs.tag}}