Skip to content

dep: upgrade dependencies #129

dep: upgrade dependencies

dep: upgrade dependencies #129

Workflow file for this run

name: Rust
on:
push:
branches: ["master", "remove-gitlab"]
tags:
- "v*"
pull_request:
branches: ["master"]
workflow_dispatch:
env:
CARGO_TERM_COLOR: always
BINARY_NAME: mlc
jobs:
test_own_readme:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Cache
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
target
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: Run
run: cargo run -- ./README.md -d
build_linux:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run tests
run: cargo test --verbose
- 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@v3
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@v3
with:
name: linux
path: ./target/x86_64-unknown-linux-musl/release/${{ env.BINARY_NAME }}
build_windows:
runs-on: windows-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
- name: Run tests
run: cargo test --verbose
- name: Build
run: cargo build --verbose --release
- uses: actions/upload-artifact@v3
with:
name: windows
path: ./target/release/${{ env.BINARY_NAME }}.exe
build_osx:
runs-on: macos-latest
steps:
- uses: actions/checkout@v4
- uses: actions-rust-lang/setup-rust-toolchain@v1
with:
target: aarch64-apple-darwin
- name: Run tests
run: cargo test --verbose
- name: Build
run: |
cargo build --verbose --release --target aarch64-apple-darwin
ls ./target
- uses: actions/upload-artifact@v3
with:
name: apple-darwin
path: target/aarch64-apple-darwin/release/${{ env.BINARY_NAME }}
release:
runs-on: ubuntu-latest
needs: [release_docker]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/download-artifact@v3
with:
name: linux
path: mlc-x86_64-linux
- uses: actions/download-artifact@v3
with:
name: windows
path: mlc-x86_64-windows
- uses: actions/download-artifact@v3
with:
name: apple-darwin
path: mlc-x86_64-apple-darwin
- name: Rename files
run: |
ls
ls mlc-x86_64-linux
ls mlc-x86_64-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-x86_64-apple-darwin/mlc mlc
rm -rd ./mlc-x86_64-apple-darwin
mv ./mlc mlc-x86_64-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@v1
with:
files: |
mlc-x86_64-linux
mlc-x86_64-apple-darwin
mlc-x86_64-windows.exe
release_docker:
runs-on: ubuntu-latest
needs: [build_osx, build_windows, build_linux]
if: startsWith(github.ref, 'refs/tags/')
steps:
- uses: actions/checkout@v4
- name: Download artifact
uses: actions/download-artifact@v3
with:
name: linux
path: ./target/release
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2
- 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@v2
with:
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_PW }}
- name: Build and push
uses: docker/build-push-action@v3
with:
context: .
push: true
tags: becheran/mlc:latest,becheran/mlc:${{ env.RELEASE_VERSION }}