From f4be3a556de77bcdf5db5a676df84b555d7c515e Mon Sep 17 00:00:00 2001 From: Matthieu Casanova Date: Tue, 19 Dec 2023 21:01:41 +0100 Subject: [PATCH] disable CD --- .github/workflows/cd.yml | 342 +++++++++++++++--------------- .github/workflows/rust-clippy.yml | 110 +++++----- .github/workflows/rust.yml | 83 ++++++-- Cargo.toml | 1 + README.md | 1 + 5 files changed, 289 insertions(+), 248 deletions(-) diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml index d2553db..7b67996 100644 --- a/.github/workflows/cd.yml +++ b/.github/workflows/cd.yml @@ -1,171 +1,171 @@ -name: Continuous Deployment -permissions: - contents: write -on: - push: - tags: - - "v*.*.*" - -jobs: - create-github-release: - name: create-github-release - runs-on: ubuntu-latest - steps: - - name: Create artifacts directory - run: mkdir artifacts - - - name: Get the release version from the tag - if: env.VERSION == '' - run: | - if [[ -n "${{ github.event.inputs.tag }}" ]]; then - echo "Manual run against a tag; overriding actual tag in the environment..." - echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV - else - echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV - fi - - - name: Validate version environment variable - run: | - echo "Version being built against is version ${{ env.VERSION }}"! - - - name: Save version number to artifact - run: echo "${{ env.VERSION }}" > artifacts/release-version - - - name: Upload artifacts - uses: actions/upload-artifact@v1 - with: - name: artifacts - path: artifacts - - build-release: - name: build-release - needs: [create-github-release] - runs-on: ${{ matrix.job.os }} - env: - RUST_BACKTRACE: 1 - strategy: - fail-fast: false - matrix: - rust: [stable] - job: - - { os: "macOS-latest", target: "x86_64-apple-darwin", artifact_prefix: "macos" } - - { os: "windows-latest", target: "x86_64-pc-windows-msvc", artifact_prefix: "windows" } - - { os: "ubuntu-latest", target: "x86_64-unknown-linux-gnu", artifact_prefix: "linux", } - - { os: "ubuntu-latest", target: "x86_64-unknown-linux-musl", artifact_prefix: "linux-musl", } - - { os: "ubuntu-latest", target: "aarch64-unknown-linux-gnu", artifact_prefix: "aarch64-gnu", use-cross: true, test-bin: "--bin image2text" } - - { os: "ubuntu-latest", target: "aarch64-unknown-linux-musl", artifact_prefix: "aarch64-musl", use-cross: true, test-bin: "--bin image2text" } - - { os: "ubuntu-latest", target: "arm-unknown-linux-gnueabihf", artifact_prefix: "arm-gnu", use-cross: true, test-bin: "--bin image2text" } - - { os: "ubuntu-latest", target: "arm-unknown-linux-musleabihf", artifact_prefix: "arm-musl", use-cross: true, test-bin: "--bin image2text" } - - steps: - - name: Checkout repository - uses: actions/checkout@v2 - with: - fetch-depth: 1 - - - name: Get shared artifacts - uses: actions/download-artifact@v2 - with: - name: artifacts - path: artifacts - - - name: Set release version - shell: bash - run: | - release_version="$(cat ./artifacts/release-version)" - echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV - - - name: Validate release environment variables - run: | - echo "Release version: ${{ env.RELEASE_VERSION }}" - - - name: Install toolchain - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.rust }} - override: true - target: ${{ matrix.job.target }} - profile: minimal # minimal component installation (ie, no documentation) - - - name: Installing needed macOS dependencies - if: matrix.job.os == 'macos-latest' - run: brew install openssl@1.1 - - - name: Installing needed Ubuntu dependencies - if: matrix.job.os == 'ubuntu-latest' - shell: bash - run: | - sudo apt-get -y update - sudo apt-get -y install -qq pkg-config libssl-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev musl-tools - case ${{ matrix.job.target }} in - arm-unknown-linux-*) sudo apt-get -y install gcc-arm-linux-gnueabihf ;; - aarch64-unknown-linux-*) sudo apt-get -y install gcc-aarch64-linux-gnu ;; - esac - - - name: Build - uses: actions-rs/cargo@v1 - with: - use-cross: ${{ matrix.job.use-cross }} - command: build - args: --release --verbose --target=${{ matrix.job.target }} - toolchain: ${{ matrix.rust }} - - - name: Test - uses: actions-rs/cargo@v1 - with: - use-cross: ${{ matrix.job.use-cross }} - command: test - args: --target=${{ matrix.job.target }} ${{ matrix.job.test-bin }} - - - name: Packaging final binary (Windows) - if: matrix.job.os == 'windows-latest' - shell: bash - run: | - cd target/${{ matrix.job.target }}/release - BINARY_NAME=image2text.exe - # strip the binary - strip $BINARY_NAME - RELEASE_NAME=image2text-${{ matrix.job.artifact_prefix }} - tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME - # create sha checksum files - certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256 - echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV - - - name: Packaging final binary (macOS and Linux) - if: matrix.job.os != 'windows-latest' - shell: bash - run: | - # set the right strip executable - STRIP="strip"; - case ${{ matrix.job.target }} in - arm-*-linux-*) STRIP="arm-linux-gnueabihf-strip" ;; - aarch64-*-linux-*) STRIP="aarch64-linux-gnu-strip" ;; - esac; - cd target/${{ matrix.job.target }}/release - BINARY_NAME=image2text - # strip the binary - "$STRIP" "$BINARY_NAME" - RELEASE_NAME=image2text-${{ matrix.job.artifact_prefix }} - tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME - # create sha checksum files - shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256 - echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV - - - name: Releasing assets - uses: softprops/action-gh-release@v1 - with: - files: | - target/${{ matrix.job.target }}/release/${{ env.RELEASE_NAME }}.tar.gz - target/${{ matrix.job.target }}/release/${{ env.RELEASE_NAME }}.sha256 - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - - name: Add SHA to artifacts - run: | - cp target/${{ matrix.job.target }}/release/${{ env.RELEASE_NAME }}.sha256 artifacts/ - - - name: Upload artifacts - uses: actions/upload-artifact@v1 - with: - name: artifacts - path: artifacts \ No newline at end of file +#name: Continuous Deployment +#permissions: +# contents: write +#on: +# push: +# tags: +# - "v*.*.*" +# +#jobs: +# create-github-release: +# name: create-github-release +# runs-on: ubuntu-latest +# steps: +# - name: Create artifacts directory +# run: mkdir artifacts +# +# - name: Get the release version from the tag +# if: env.VERSION == '' +# run: | +# if [[ -n "${{ github.event.inputs.tag }}" ]]; then +# echo "Manual run against a tag; overriding actual tag in the environment..." +# echo "VERSION=${{ github.event.inputs.tag }}" >> $GITHUB_ENV +# else +# echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV +# fi +# +# - name: Validate version environment variable +# run: | +# echo "Version being built against is version ${{ env.VERSION }}"! +# +# - name: Save version number to artifact +# run: echo "${{ env.VERSION }}" > artifacts/release-version +# +# - name: Upload artifacts +# uses: actions/upload-artifact@v1 +# with: +# name: artifacts +# path: artifacts +# +# build-release: +# name: build-release +# needs: [create-github-release] +# runs-on: ${{ matrix.job.os }} +# env: +# RUST_BACKTRACE: 1 +# strategy: +# fail-fast: false +# matrix: +# rust: [stable] +# job: +# - { os: "macOS-latest", target: "x86_64-apple-darwin", artifact_prefix: "macos" } +# - { os: "windows-latest", target: "x86_64-pc-windows-msvc", artifact_prefix: "windows" } +# - { os: "ubuntu-latest", target: "x86_64-unknown-linux-gnu", artifact_prefix: "linux", } +# - { os: "ubuntu-latest", target: "x86_64-unknown-linux-musl", artifact_prefix: "linux-musl", } +# - { os: "ubuntu-latest", target: "aarch64-unknown-linux-gnu", artifact_prefix: "aarch64-gnu", use-cross: true, test-bin: "--bin image2text" } +# - { os: "ubuntu-latest", target: "aarch64-unknown-linux-musl", artifact_prefix: "aarch64-musl", use-cross: true, test-bin: "--bin image2text" } +# - { os: "ubuntu-latest", target: "arm-unknown-linux-gnueabihf", artifact_prefix: "arm-gnu", use-cross: true, test-bin: "--bin image2text" } +# - { os: "ubuntu-latest", target: "arm-unknown-linux-musleabihf", artifact_prefix: "arm-musl", use-cross: true, test-bin: "--bin image2text" } +# +# steps: +# - name: Checkout repository +# uses: actions/checkout@v2 +# with: +# fetch-depth: 1 +# +# - name: Get shared artifacts +# uses: actions/download-artifact@v2 +# with: +# name: artifacts +# path: artifacts +# +# - name: Set release version +# shell: bash +# run: | +# release_version="$(cat ./artifacts/release-version)" +# echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV +# +# - name: Validate release environment variables +# run: | +# echo "Release version: ${{ env.RELEASE_VERSION }}" +# +# - name: Install toolchain +# uses: actions-rs/toolchain@v1 +# with: +# toolchain: ${{ matrix.rust }} +# override: true +# target: ${{ matrix.job.target }} +# profile: minimal # minimal component installation (ie, no documentation) +# +# - name: Installing needed macOS dependencies +# if: matrix.job.os == 'macos-latest' +# run: brew install openssl@1.1 +# +# - name: Installing needed Ubuntu dependencies +# if: matrix.job.os == 'ubuntu-latest' +# shell: bash +# run: | +# sudo apt-get -y update +# sudo apt-get -y install -qq pkg-config libssl-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev musl-tools +# case ${{ matrix.job.target }} in +# arm-unknown-linux-*) sudo apt-get -y install gcc-arm-linux-gnueabihf ;; +# aarch64-unknown-linux-*) sudo apt-get -y install gcc-aarch64-linux-gnu ;; +# esac +# +# - name: Build +# uses: actions-rs/cargo@v1 +# with: +# use-cross: ${{ matrix.job.use-cross }} +# command: build +# args: --release --verbose --target=${{ matrix.job.target }} +# toolchain: ${{ matrix.rust }} +# +# - name: Test +# uses: actions-rs/cargo@v1 +# with: +# use-cross: ${{ matrix.job.use-cross }} +# command: test +# args: --target=${{ matrix.job.target }} ${{ matrix.job.test-bin }} +# +# - name: Packaging final binary (Windows) +# if: matrix.job.os == 'windows-latest' +# shell: bash +# run: | +# cd target/${{ matrix.job.target }}/release +# BINARY_NAME=image2text.exe +# # strip the binary +# strip $BINARY_NAME +# RELEASE_NAME=image2text-${{ matrix.job.artifact_prefix }} +# tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME +# # create sha checksum files +# certutil -hashfile $RELEASE_NAME.tar.gz sha256 | grep -E [A-Fa-f0-9]{64} > $RELEASE_NAME.sha256 +# echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV +# +# - name: Packaging final binary (macOS and Linux) +# if: matrix.job.os != 'windows-latest' +# shell: bash +# run: | +# # set the right strip executable +# STRIP="strip"; +# case ${{ matrix.job.target }} in +# arm-*-linux-*) STRIP="arm-linux-gnueabihf-strip" ;; +# aarch64-*-linux-*) STRIP="aarch64-linux-gnu-strip" ;; +# esac; +# cd target/${{ matrix.job.target }}/release +# BINARY_NAME=image2text +# # strip the binary +# "$STRIP" "$BINARY_NAME" +# RELEASE_NAME=image2text-${{ matrix.job.artifact_prefix }} +# tar czvf $RELEASE_NAME.tar.gz $BINARY_NAME +# # create sha checksum files +# shasum -a 256 $RELEASE_NAME.tar.gz > $RELEASE_NAME.sha256 +# echo "RELEASE_NAME=$RELEASE_NAME" >> $GITHUB_ENV +# +# - name: Releasing assets +# uses: softprops/action-gh-release@v1 +# with: +# files: | +# target/${{ matrix.job.target }}/release/${{ env.RELEASE_NAME }}.tar.gz +# target/${{ matrix.job.target }}/release/${{ env.RELEASE_NAME }}.sha256 +# env: +# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} +# +# - name: Add SHA to artifacts +# run: | +# cp target/${{ matrix.job.target }}/release/${{ env.RELEASE_NAME }}.sha256 artifacts/ +# +# - name: Upload artifacts +# uses: actions/upload-artifact@v1 +# with: +# name: artifacts +# path: artifacts \ No newline at end of file diff --git a/.github/workflows/rust-clippy.yml b/.github/workflows/rust-clippy.yml index a0b1fdc..94ecb46 100644 --- a/.github/workflows/rust-clippy.yml +++ b/.github/workflows/rust-clippy.yml @@ -1,55 +1,55 @@ -# This workflow uses actions that are not certified by GitHub. -# They are provided by a third-party and are governed by -# separate terms of service, privacy policy, and support -# documentation. -# rust-clippy is a tool that runs a bunch of lints to catch common -# mistakes in your Rust code and help improve your Rust code. -# More details at https://github.com/rust-lang/rust-clippy -# and https://rust-lang.github.io/rust-clippy/ - -name: rust-clippy analyze - -on: - push: - branches: [ "main" ] - pull_request: - # The branches below must be a subset of the branches above - branches: [ "main" ] - schedule: - - cron: '29 2 * * 3' - -jobs: - rust-clippy-analyze: - name: Run rust-clippy analyzing - runs-on: ubuntu-latest - permissions: - contents: read - security-events: write - actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status - steps: - - name: Checkout code - uses: actions/checkout@v2 - - - name: Install Rust toolchain - uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1 - with: - profile: minimal - toolchain: stable - components: clippy - override: true - - - name: Install required cargo - run: cargo install clippy-sarif sarif-fmt - - - name: Run rust-clippy - run: - cargo clippy - --all-features - --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt - continue-on-error: true - - - name: Upload analysis results to GitHub - uses: github/codeql-action/upload-sarif@v2 - with: - sarif_file: rust-clippy-results.sarif - wait-for-processing: true \ No newline at end of file +## This workflow uses actions that are not certified by GitHub. +## They are provided by a third-party and are governed by +## separate terms of service, privacy policy, and support +## documentation. +## rust-clippy is a tool that runs a bunch of lints to catch common +## mistakes in your Rust code and help improve your Rust code. +## More details at https://github.com/rust-lang/rust-clippy +## and https://rust-lang.github.io/rust-clippy/ +# +#name: rust-clippy analyze +# +#on: +# push: +# branches: [ "main" ] +# pull_request: +# # The branches below must be a subset of the branches above +# branches: [ "main" ] +# schedule: +# - cron: '29 2 * * 3' +# +#jobs: +# rust-clippy-analyze: +# name: Run rust-clippy analyzing +# runs-on: ubuntu-latest +# permissions: +# contents: read +# security-events: write +# actions: read # only required for a private repository by github/codeql-action/upload-sarif to get the Action run status +# steps: +# - name: Checkout code +# uses: actions/checkout@v2 +# +# - name: Install Rust toolchain +# uses: actions-rs/toolchain@16499b5e05bf2e26879000db0c1d13f7e13fa3af #@v1 +# with: +# profile: minimal +# toolchain: stable +# components: clippy +# override: true +# +# - name: Install required cargo +# run: cargo install clippy-sarif sarif-fmt +# +# - name: Run rust-clippy +# run: +# cargo clippy +# --all-features +# --message-format=json | clippy-sarif | tee rust-clippy-results.sarif | sarif-fmt +# continue-on-error: true +# +# - name: Upload analysis results to GitHub +# uses: github/codeql-action/upload-sarif@v2 +# with: +# sarif_file: rust-clippy-results.sarif +# wait-for-processing: true \ No newline at end of file diff --git a/.github/workflows/rust.yml b/.github/workflows/rust.yml index d54fa2f..8565f95 100644 --- a/.github/workflows/rust.yml +++ b/.github/workflows/rust.yml @@ -1,22 +1,61 @@ -name: Rust - -on: - push: - branches: [ "master" ] - pull_request: - branches: [ "master" ] - -env: - CARGO_TERM_COLOR: always - -jobs: - build: - - runs-on: ubuntu-latest - - steps: - - uses: actions/checkout@v3 - - name: Build - run: cargo build --verbose - - name: Run tests - run: cargo test --verbose +#name: Rust +# +#on: +# push: +# tags: +# - "v*.*.*" +# +#env: +# CARGO_TERM_COLOR: always +# +#jobs: +# build_linux: +# +# runs-on: ubuntu-latest +# +# steps: +# - uses: actions/checkout@v3 +# - name: Install cross +# run: cargo install cross +# - name: Install dependencies +# run: sudo apt-get install libatk1.0-dev libgtk-3-dev libgtk-3-dev +# - name: Install gdk-sys +# run: cargo add gdk-sys@0.18.0 +# - name: Build x86_64-unknown-linux-gnu +# run: cross build --target x86_64-unknown-linux-gnu --verbose +## - name: Build arm-unknown-linux-gnu +## run: cross build --target arm-unknown-linux-gnueabi --verbose +## - name: Build aarch64-unknown-linux-gnu +## run: cross build --target aarch64-unknown-linux-gnu --verbose +# +## build_windows: +## runs-on: windows-latest +## steps: +## - uses: actions/checkout@v3 +## - name: Install Rust +## uses: actions-rs/toolchain@v1 +## with: +## toolchain: stable +## target: x86_64-pc-windows-msvc +## - name: Install gdk-sys +## run: cargo add gdk-sys@0.18.0 +## - name: Build +## run: cargo build --verbose +## - name: Run tests +## run: cargo test --verbose +## +## build_macos: +## runs-on: macos-latest +## steps: +## - uses: actions/checkout@v3 +## - name: Install Rust +## uses: actions-rs/toolchain@v1 +## with: +## toolchain: stable +## target: x86_64-apple-darwin +## - name: Install gdk-sys +## run: cargo add gdk-sys@0.18.0 +## - name: Build +## run: cargo build --verbose +## - name: Run tests +## run: cargo test --verbose \ No newline at end of file diff --git a/Cargo.toml b/Cargo.toml index 195984a..d1efdde 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,5 +7,6 @@ edition = "2021" [dependencies] speedy2d = "2.0.0" +env_logger = "0.10.1" chrono = "0.4.31" rfd = "0.12.1" \ No newline at end of file diff --git a/README.md b/README.md index f26c656..6500cdb 100644 --- a/README.md +++ b/README.md @@ -43,5 +43,6 @@ Sound is not supported and it is probable that many limitations are still presen This project depends on - speedy2d (https://crates.io/crates/speedy2d) +- env_logger (https://crates.io/crates/env_logger) - chrono (https://crates.io/crates/chrono) - rfd (https://crates.io/crates/rfd) \ No newline at end of file