Skip to content

Commit

Permalink
Merge pull request #146 from SalOne22/image-integration
Browse files Browse the repository at this point in the history
Image integration
  • Loading branch information
SalOne22 committed Dec 14, 2023
2 parents dd2d143 + d7dc437 commit ec2dabb
Show file tree
Hide file tree
Showing 13 changed files with 961 additions and 531 deletions.
2 changes: 2 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
[target.aarch64-unknown-linux-gnu]
linker="aarch64-linux-gnu-gcc"
[target.aarch64-unknown-linux-musl]
linker="aarch64-linux-musl-gcc"

[target.x86_64-pc-windows-msvc]
rustflags = ["-C", "target-feature=+crt-static"]
2 changes: 1 addition & 1 deletion .github/workflows/combine-prs.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Combine PRs
name: combine pr's

on:
workflow_dispatch:
Expand Down
19 changes: 10 additions & 9 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: deploy
on:
push:
tags:
- 'v*.*.*'
- "v*.*.*"
workflow_dispatch:

permissions:
Expand All @@ -21,31 +21,32 @@ jobs:
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-gnu
- x86_64-pc-windows-gnu
- aarch64-unknown-linux-musl
- x86_64-pc-windows-msvc
- i686-pc-windows-msvc
- x86_64-apple-darwin
- aarch64-apple-darwin

steps:
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Get the rimage version πŸͺΆ
- name: get the rimage version
id: rimage-meta
run:
echo "version=$(cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "rimage").version')"
>> "$GITHUB_OUTPUT"

- name: Retrieve ${{ matrix.target }} binary πŸ”ƒ
- name: retrieve ${{ matrix.target }} binary
uses: dawidd6/action-download-artifact@v2
with:
workflow: rimage.yml
commit: ${{ github.sha }}
name: rimage binary (${{ matrix.target }})
path: target

- name: Build archives πŸ—
- name: build archives
working-directory: target
run: |
ARCHIVE_NAME="rimage-${{ steps.rimage-meta.outputs.version }}-${{ matrix.target }}"
Expand All @@ -65,10 +66,10 @@ jobs:
tar -vczf "${ARCHIVE_NAME}.tar.gz" "$ARCHIVE_NAME"/*;;
esac
- name: Create release notes πŸ“‘
- name: create release notes
run: tail -n +5 CHANGELOG.md | sed -e '/## \[v/,$d' > RELEASE_NOTES.txt

- name: Create release
- name: create release
uses: softprops/action-gh-release@v1
with:
name: v${{ steps.rimage-meta.outputs.version }}
Expand Down
171 changes: 93 additions & 78 deletions .github/workflows/rimage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,56 +2,66 @@ name: rimage

on:
push:
branches:
- main
paths-ignore:
- '**/*.md'
pull_request:
branches:
- main
paths-ignore:
- '**/*.md'
types:
- opened
- synchronize
workflow_dispatch:

jobs:
test:
name: test

runs-on: ${{ matrix.os }}
timeout-minutes: 60

if: github.ref_type != 'tag' && (github.event_name != 'pull_request' || github.event.pull_request.head.repo.fork)

strategy:
fail-fast: false
matrix:
target:
- x86_64-unknown-linux-gnu
- x86_64-unknown-linux-musl
- aarch64-unknown-linux-gnu
- x86_64-pc-windows-gnu
- aarch64-unknown-linux-musl
- x86_64-pc-windows-msvc
- i686-pc-windows-msvc
- x86_64-apple-darwin
- aarch64-apple-darwin
- wasm32-unknown-emscripten

include:
- target: x86_64-unknown-linux-gnu
os: ubuntu-latest
target-apt-arch: amd64
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
target-apt-arch: amd64
- target: aarch64-unknown-linux-gnu
os: ubuntu-latest
target-apt-arch: arm64
- target: x86_64-pc-windows-gnu
os: windows-latest
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
target-apt-arch: arm64
- target: x86_64-pc-windows-msvc
os: windows-2019
os: windows-latest
- target: i686-pc-windows-msvc
os: windows-latest
- target: x86_64-apple-darwin
os: macos-latest
- target: aarch64-apple-darwin
os: macos-latest
- target: wasm32-unknown-emscripten
os: macos-latest

env:
CARGO_BUILD_TARGET: ${{ matrix.target }}

steps:
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Set up Ubuntu multiarch βš™οΈ
- name: set up ubuntu multiarch
if: startsWith(matrix.os, 'ubuntu') && matrix.target-apt-arch != 'amd64'
run: |
readonly DISTRO_CODENAME=jammy
Expand All @@ -62,58 +72,77 @@ jobs:
echo "deb [arch=${{ matrix.target-apt-arch }}] http://ports.ubuntu.com/ $DISTRO_CODENAME$suite main universe multiverse" | \
sudo tee -a /etc/apt/sources.list >/dev/null
done
- name: install musl development files
if: endsWith(matrix.target, '-musl')
run: |
sudo apt-get -yq update
sudo apt-get -yq install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu
sudo apt-get -yq install musl-tools musl-dev:${{ matrix.target-apt-arch }}
- name: Setup cache πŸ’Ύ
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ matrix.target }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: install aarch64 cross compiler
if: startsWith(matrix.target, 'aarch64-unknown-linux')
run: |
sudo apt-get -yq update
sudo apt-get -yq install gcc-aarch64-linux-gnu g++-aarch64-linux-gnu libc6:arm64
- name: Setup nasm πŸ§‘β€πŸ’»
uses: ilammy/setup-nasm@v1
- name: set musl-g++
if: matrix.target == 'x86_64-unknown-linux-musl'
run: sudo ln -s /bin/g++ /bin/musl-g++

- name: Setup libjxl πŸ§‘β€πŸ’» (x86_64 macos)
if: matrix.target == 'x86_64-apple-darwin'
run: brew install jpeg-xl
- name: set aarch64-linux-musl-g++
if: matrix.target == 'aarch64-unknown-linux-musl'
run: sudo ln -s /bin/aarch64-linux-gnu-g++ /bin/aarch64-linux-musl-g++

- name: Setup rust toolchain πŸ¦€
- uses: Swatinem/rust-cache@v2

- name: install rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
target: ${{ matrix.target }}

- name: Build πŸ— (not msvc)
if: matrix.target != 'x86_64-pc-windows-msvc'
uses: actions-rs/cargo@v1
with:
command: build
args: --all-features --release
- uses: ilammy/setup-nasm@v1

- name: Build πŸ— (msvc)
if: matrix.target == 'x86_64-pc-windows-msvc'
shell: cmd
- name: install dependencies (linux)
if: matrix.os == 'ubuntu-latest'
run: |
call "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Auxiliary/Build/vcvars64.bat"
set CC=C:/Program Files/LLVM/bin/clang.exe
set CXX=C:/Program Files/LLVM/bin/clang++.exe
cargo build --all-features --release
- name: Test πŸ§ͺ
if: matrix.target == 'x86_64-unknown-linux-gnu' || matrix.target == 'x86_64-apple-darwin'
uses: actions-rs/cargo@v1
with:
command: test
args: --all-features --release
sudo apt-get -yq update
sudo apt-get -yq install ninja-build meson
- name: install dependencies (macos)
if: matrix.os == 'macos-latest'
run: |
brew install ninja meson
- name: install dependencies (windows)
if: matrix.os == 'windows-latest'
run: |
choco install -y ninja
pip install meson
- name: install emcc
if: matrix.target == 'wasm32-unknown-emscripten'
run: brew install emscripten

- name: build
if: matrix.target != 'wasm32-unknown-emscripten'
run: cargo build --all-features --release

- name: test
if: startsWith(matrix.target, 'aarch64') != true && matrix.target != 'wasm32-unknown-emscripten'
run: cargo test --all-features

- name: Upload CLI binary as artifact πŸ’Ύ
- name: check wasm
if: matrix.target == 'wasm32-unknown-emscripten'
run: |
export EMSCRIPTEN_CMAKE_FILE="$(brew --cellar emscripten)/$(brew list --versions emscripten | tr ' ' '\n' | tail -1)/libexec/cmake/Modules/Platform/Emscripten.cmake"
cargo check --all-features
env:
CC: "emcc"
CXX: "emcc"

- name: upload cli binary as artifact
uses: actions/upload-artifact@v3
with:
name: rimage binary (${{ matrix.target }})
Expand All @@ -126,38 +155,24 @@ jobs:
runs-on: ubuntu-latest

steps:
- name: Checkout πŸ›ŽοΈ
uses: actions/checkout@v4
- uses: actions/checkout@v4

- name: Setup cache πŸ’Ύ
uses: actions/cache@v3
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
target/
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }}
- name: install dependencies
run: |
sudo apt-get -yq update
sudo apt-get -yq install ninja-build meson nasm
- name: Setup nasm πŸ§‘β€πŸ’»
uses: ilammy/setup-nasm@v1
- uses: Swatinem/rust-cache@v2

- name: Setup rust toolchain πŸ¦€
- name: setup rust toolchain
uses: actions-rs/toolchain@v1
with:
profile: minimal
toolchain: stable
components: rustfmt, clippy

- name: Formatting check πŸͺ„
uses: actions-rs/cargo@v1
with:
command: fmt
args: --all -- --check
- name: formatting check
run: cargo fmt --all -- --check

- name: Clippy check πŸ”Ž
uses: actions-rs/cargo@v1
with:
command: clippy
args: --all-features -- -D warnings
- name: clippy check
run: cargo clippy --all-features -- -D warnings
4 changes: 1 addition & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
/target
/.vscode
cachegrind.*
dhat.*
heaptrack.*
/.idea
Loading

0 comments on commit ec2dabb

Please sign in to comment.