Skip to content

build(deps): bump pulldown-cmark from 0.13.0 to 0.13.1 (#147) #137

build(deps): bump pulldown-cmark from 0.13.0 to 0.13.1 (#147)

build(deps): bump pulldown-cmark from 0.13.0 to 0.13.1 (#147) #137

Workflow file for this run

name: Continuous Integration
on:
push:
branches: ["master"]
tags:
- "v*"
pull_request:
branches: ["master"]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
BINARY_NAME: mlc
RUSTFLAGS: "-Dwarnings"
jobs:
test_own_readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Cache
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run
run: cargo run -- ./README.md -d
formatting:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v6
with:
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.head_ref || github.ref }}
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
components: rustfmt, clippy
- name: Run rustfmt
run: cargo fmt
- name: Run clippy with auto-fix
run: cargo clippy --fix --all-targets --all-features --allow-dirty --allow-staged
- name: Check for formatting changes
id: check_changes
run: |
if [[ -n "$(git status --porcelain)" ]]; then
echo "changes=true" >> $GITHUB_OUTPUT
else
echo "changes=false" >> $GITHUB_OUTPUT
fi
- name: Commit and push formatting and clippy changes
if: steps.check_changes.outputs.changes == 'true'
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add .
git commit -m "Auto-format code with rustfmt and clippy"
git push origin ${{ github.head_ref || github.ref_name }}
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
- run: cargo test --verbose
build_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- uses: awalsh128/cache-apt-pkgs-action@v1
with:
packages: musl-tools # provides musl-gcc
version: 1.0
- name: "Get the Rust toolchain"
uses: dtolnay/rust-toolchain@stable
with:
targets: x86_64-unknown-linux-musl
components: rustfmt, clippy
- name: Cache
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cargo build --release --verbose --target=x86_64-unknown-linux-musl
- uses: actions/upload-artifact@v7
with:
name: linux
path: ./target/x86_64-unknown-linux-musl/release/${{ env.BINARY_NAME }}
build_linux_arm64:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: "Get the Rust toolchain"
uses: dtolnay/rust-toolchain@stable
with:
targets: aarch64-unknown-linux-musl
- name: Install cross
run: cargo install cross --git https://github.com/cross-rs/cross
- name: Cache
uses: actions/cache@v5
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-aarch64-${{ hashFiles('**/Cargo.lock') }}
- name: Build
run: cross build --release --verbose --target=aarch64-unknown-linux-musl
- uses: actions/upload-artifact@v7
with:
name: linux-arm64
path: ./target/aarch64-unknown-linux-musl/release/${{ env.BINARY_NAME }}
build_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Build
run: cargo build --verbose --release
- uses: actions/upload-artifact@v7
with:
name: windows
path: ./target/release/${{ env.BINARY_NAME }}.exe
build_osx:
runs-on: macos-latest
steps:
- uses: actions/checkout@v6
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: aarch64-apple-darwin
- name: Build
run: |
cargo build --verbose --release --target aarch64-apple-darwin
ls ./target
- uses: actions/upload-artifact@v7
with:
name: apple-darwin-arm64
path: target/aarch64-apple-darwin/release/${{ env.BINARY_NAME }}
release_docker:
runs-on: ubuntu-latest
needs: [build_osx, build_windows, build_linux, build_linux_arm64, test]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v6
- name: Download artifact
uses: actions/download-artifact@v8
with:
name: linux
path: ./target/release
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Set env
run: |
version=${GITHUB_REF#refs/*/}
version=${version:1}
echo "RELEASE_VERSION=$version" >> $GITHUB_ENV
- run: echo Push docker image $RELEASE_VERSION
- name: Login to Docker Hub
uses: docker/login-action@v4
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PW }}
- name: Build and push
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: becheran/mlc:latest,becheran/mlc:${{ env.RELEASE_VERSION }}
release:
runs-on: ubuntu-latest
needs: [release_docker]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v8
with:
name: linux
path: mlc-x86_64-linux
- uses: actions/download-artifact@v8
with:
name: linux-arm64
path: mlc-aarch64-linux
- uses: actions/download-artifact@v8
with:
name: windows
path: mlc-x86_64-windows
- uses: actions/download-artifact@v8
with:
name: apple-darwin-arm64
path: mlc-aarch64-apple-darwin
- name: Rename files
run: |
ls
ls mlc-x86_64-linux
ls mlc-aarch64-linux
ls mlc-aarch64-apple-darwin
ls mlc-x86_64-windows
mv ./mlc-x86_64-linux/mlc mlc
rm -rd ./mlc-x86_64-linux
mv ./mlc mlc-x86_64-linux
mv ./mlc-aarch64-linux/mlc mlc
rm -rd ./mlc-aarch64-linux
mv ./mlc mlc-aarch64-linux
mv ./mlc-aarch64-apple-darwin/mlc mlc
rm -rd ./mlc-aarch64-apple-darwin
mv ./mlc mlc-aarch64-apple-darwin
mv ./mlc-x86_64-windows/mlc.exe mlc-x86_64-windows.exe
rm -rd ./mlc-x86_64-windows
ls
- name: GitHub Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
mlc-x86_64-linux
mlc-aarch64-linux
mlc-aarch64-apple-darwin
mlc-x86_64-windows.exe