Skip to content

chore: fix clippy issues #303

chore: fix clippy issues

chore: fix clippy issues #303

name: Continuous-Integration
on: [ push, pull_request ]
jobs:
Lint:
name: Lint
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: "Install the toolchain"
uses: moonrepo/setup-rust@v0
with:
profile: minimal
components: clippy
- name: "Check with clippy"
run: |
cargo clippy -- -D warnings
Test:
name: Test
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v3
- name: "Install dependencies"
run: |
sudo add-apt-repository ppa:inkscape.dev/stable -y
sudo apt update
sudo apt-get install pkg-config libssl-dev openjdk-11-jre graphviz inkscape
inkscape --version
inkscape --help
shell: bash
- name: "Install the toolchain"
uses: moonrepo/setup-rust@v0
with:
profile: minimal
- name: "Perform the tests"
run: |
cargo test
Binary:
name: Binary
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- architecture: aarch64
system: linux
target: aarch64-unknown-linux-gnu
- architecture: x86_64
system: linux
target: x86_64-unknown-linux-gnu
- architecture: powerpc64le
system: linux
target: powerpc64le-unknown-linux-gnu
- architecture: s390x
system: linux
target: s390x-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- name: "Login to GitHub Container Registry"
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: "Install the dependencies"
run: |
sudo apt-get install pkg-config libssl-dev
sudo apt-get install pkg-config libssl-dev build-essential dpkg libc-bin liblzma-dev
shell: bash
- name: "Install the toolchain"
uses: moonrepo/setup-rust@v0
with:
profile: minimal
bins: cargo-deb
- name: "Install the target"
run: |
rustup target add ${{ matrix.target }}
- name: "Install cross"
run: |
cargo binstall --no-confirm cross
- name: "Build the binary"
run: |
cross build --release --target=${{ matrix.target }} --features vendored-openssl
- name: "Archive the binary"
run: |
tar -C target/${{ matrix.target }}/release/ -czf ${{ matrix.system }}_${{ matrix.architecture }}_plantuml-generator.tar.gz plantuml-generator
- name: "Upload the binary"
uses: actions/upload-artifact@v3
with:
name: ${{ matrix.system }}_${{ matrix.architecture }}_plantuml-generator
path: ${{ matrix.system }}_${{ matrix.architecture }}_plantuml-generator.tar.gz
DebianPackage:
name: Debian Package
runs-on: ubuntu-22.04
strategy:
matrix:
include:
- architecture: x86_64
target: x86_64-unknown-linux-gnu
steps:
- uses: actions/checkout@v3
- name: "Install the dependencies"
run: |
sudo apt-get install pkg-config libssl-dev build-essential dpkg libc-bin liblzma-dev
shell: bash
- name: "Install the toolchain"
uses: moonrepo/setup-rust@v0
with:
profile: minimal
bins: cargo-deb
- name: "Install the target"
run: |
rustup target add ${{ matrix.target }}
- name: "Build the deb package"
run: |
cargo deb --target=${{ matrix.target }} -- --release --features vendored-openssl
- name: "Upload the deb package"
uses: actions/upload-artifact@v3
with:
name: debian_${{ matrix.architecture }}_plantuml-generator
path: target/${{ matrix.target }}/debian/*.deb
DockerImage:
name: Docker Image
runs-on: ubuntu-22.04
needs: [ Lint, Test ]
if: ${{ github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/checkout@v3
- name: "Set up QEMU"
uses: docker/setup-qemu-action@v3
- name: "Login to Docker Hub"
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: "Set up Docker Buildx"
uses: docker/setup-buildx-action@v3
with:
install: true
- name: "Inject slug/short variables"
uses: rlespinasse/github-slug-action@v3.x
- name: "Build and push branches"
if: ${{ ! startsWith(github.ref, 'refs/tags/') }}
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64
tags: |
thibaultmorin/plantuml-generator:${{ env.GITHUB_REF_SLUG }}
build-args: |
git_sha=${{ github.sha }}
- name: "Process version of the tag"
if: ${{ startsWith(github.ref, 'refs/tags/') }}
id: version
uses: ncipollo/semantic-version-action@v1
- name: "Build and push tags"
if: ${{ startsWith(github.ref, 'refs/tags/') }}
uses: docker/build-push-action@v5
with:
push: true
platforms: linux/amd64
tags: |
thibaultmorin/plantuml-generator:${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}.${{ steps.version.outputs.patch }}
thibaultmorin/plantuml-generator:${{ steps.version.outputs.major }}.${{ steps.version.outputs.minor }}
thibaultmorin/plantuml-generator:${{ steps.version.outputs.major }}
build-args: |
git_sha=${{ github.sha }}
GithubRelease:
name: Github Release
runs-on: ubuntu-22.04
needs: [ Lint, Test, Binary, DebianPackage ]
if: ${{ startsWith(github.ref, 'refs/tags/') }}
steps:
- uses: actions/checkout@v3
- name: "Download all artifacts"
uses: actions/download-artifact@v3
with:
path: artifacts
- name: "List artifacts"
run: |
ls -R
working-directory: artifacts
- name: "Create the changelog"
id: build_changelog
uses: mikepenz/release-changelog-builder-action@v3
with:
ignorePreReleases: true
commitMode: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: "Create the release"
uses: ncipollo/release-action@v1
with:
allowUpdates: true
artifacts: "artifacts/**/*.tar.gz,artifacts/**/*.deb"
omitName: true
draft: false
body: ${{steps.build_changelog.outputs.changelog}}
token: ${{ secrets.GITHUB_TOKEN }}