diff --git a/.cargo/config.toml b/.cargo/config.toml new file mode 100644 index 0000000..e2f942b --- /dev/null +++ b/.cargo/config.toml @@ -0,0 +1,5 @@ +[target.armv7-unknown-linux-gnueabihf] +linker = "arm-linux-gnueabihf-gcc" + +[target.aarch64-unknown-linux-gnu] +linker = "aarch64-linux-gnu-gcc" diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 414e7b7..41e3537 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -9,56 +9,80 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v4.1.1 - - - uses: actions-rs/toolchain@v1.0.6 - with: - toolchain: stable - target: armv7-unknown-linux-gnueabihf - components: clippy - override: true - - - uses: actions-rs/cargo@v1.0.1 - with: - use-cross: true - command: build - args: --release --target armv7-unknown-linux-gnueabihf - + - uses: actions/checkout@v4 + - uses: SebRollen/toml-action@v1.2.0 id: read_toml with: file: 'Cargo.toml' field: 'package.version' - - name: Copy & Compress output - id: compress - run: | - cp target/armv7-unknown-linux-gnueabihf/release/odyssey odyssey - cp target/armv7-unknown-linux-gnueabihf/release/default.yaml default.yaml - cp target/armv7-unknown-linux-gnueabihf/release/apiHelper.py apiHelper.py - tar -czvf odyssey.tar.gz odyssey default.yaml apiHelper.py - echo "archive=$ARCHIVE" >> $GITHUB_OUTPUT + - name: install dependencies + run: sudo apt install -y gcc-arm-linux-gnueabihf g++-arm-linux-gnueabihf g++-aarch64-linux-gnu gcc-aarch64-linux-gnu gcc g++ + + - name: Update Rust Toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 + with: + rustflags: "" - - uses: actions/upload-artifact@v4.3.1 + - name: Compile, Copy, and Compress armv7 + run: | + cargo build --release --target armv7-unknown-linux-gnueabihf + mkdir odyssey_armv7 + mv target/armv7-unknown-linux-gnueabihf/release/odyssey odyssey_armv7 + cp default.yaml odyssey_armv7 + cp apiHelper.py odyssey_armv7 + tar -czvf odyssey_armv7.tar.gz odyssey_armv7 + + - name: upload armv7 artifact + uses: actions/upload-artifact@v4.3.1 + with: + name: odyssey_armv7 + path: odyssey_armv7/* + + - name: Compile, Copy, and Compress aarch64 + run: | + cargo build --release --target aarch64-unknown-linux-gnu + mkdir odyssey_aarch64 + mv target/aarch64-unknown-linux-gnu/release/odyssey odyssey_aarch64 + cp default.yaml odyssey_aarch64 + cp apiHelper.py odyssey_aarch64 + tar -czvf odyssey_aarch64.tar.gz odyssey_aarch64 + + - name: upload aarch64 artifact + uses: actions/upload-artifact@v4.3.1 with: - name: odyssey - path: | - odyssey - default.yaml - apiHelper.py + name: odyssey_aarch64 + path: odyssey_aarch64/* + + - name: Compile, Copy, and Compress x86_64 + run: | + cargo build --release --target x86_64-unknown-linux-gnu + mkdir odyssey_x86_64 + mv target/x86_64-unknown-linux-gnu/release/odyssey odyssey_x86_64 + cp default.yaml odyssey_x86_64 + cp apiHelper.py odyssey_x86_64 + tar -czvf odyssey_x86_64.tar.gz odyssey_x86_64 + + - name: upload x86_64 artifact + uses: actions/upload-artifact@v4.3.1 + with: + name: odyssey_x86_64 + path: odyssey_x86_64/* - uses: ncipollo/release-action@v1.14.0 if: github.ref == 'refs/heads/main' with: - artifacts: odyssey.tar.gz + artifacts: "odyssey*.tar.gz" tag: v${{ steps.read_toml.outputs.value }} skipIfReleaseExists: true generateReleaseNotes: true commit: ${{github.sha}} + - uses: ncipollo/release-action@v1.14.0 if: github.ref != 'refs/heads/main' with: - artifacts: odyssey.tar.gz + artifacts: "*odyssey*.tar.gz" tag: BRANCH_${{github.ref_name}} skipIfReleaseExists: false allowUpdates: true diff --git a/.github/workflows/lint.yml b/.github/workflows/lint.yml index e746a2f..9974853 100644 --- a/.github/workflows/lint.yml +++ b/.github/workflows/lint.yml @@ -7,15 +7,19 @@ jobs: lint: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v3 - - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - target: armv7-unknown-linux-gnueabihf - components: clippy - override: true - - uses: actions-rs/clippy-check@v1 + - uses: actions/checkout@v4 + + - name: Install Rust Toolchain + uses: actions-rust-lang/setup-rust-toolchain@v1 with: - token: ${{ secrets.GITHUB_TOKEN }} - args: --all-features + rustflags: "" + + - name: Install Cross + run: cargo install cross --git https://github.com/cross-rs/cross + + - name: Clippy Linting + run: cargo clippy --all-features + + - name: Rustfmt Check + uses: actions-rust-lang/rustfmt@v1 diff --git a/Cargo.toml b/Cargo.toml index 1d41403..04f74a2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -7,12 +7,12 @@ edition = "2021" [dependencies] clap = { version = "4.1.6", features = ["derive"] } -#rocket = "0.5.0-rc.2" -config = "0.13.1" +cross = "0.2.5" +config = "0.14.0" serde = "1.0" serde_yaml = "0.9" -zip = "0.6.4" -itertools = "0.10.5" +zip = "1.1.1" +itertools = "0.12.1" png = "0.17.7" framebuffer = "0.3.1" tokio = { version = "1", features = ["full"] } @@ -20,7 +20,7 @@ futures = "0.3.26" async-trait = "0.1.64" regex = "1" serialport = { version = "4.2.0", default-features = false } -poem = { version = "1.3.55", features = ["websocket", "multipart"]} +poem = { version = "3.0.0", features = ["websocket", "multipart"]} glob = "0.3.1" log = "0.4.17" simple_logger = "4.1.0" diff --git a/rust-toolchain.toml b/rust-toolchain.toml new file mode 100644 index 0000000..afb8820 --- /dev/null +++ b/rust-toolchain.toml @@ -0,0 +1,5 @@ +[toolchain] +channel = "stable" +components = [ "rustfmt", "rustc-dev" ] +targets = [ "x86_64-unknown-linux-gnu", "armv7-unknown-linux-gnueabihf", "aarch64-unknown-linux-gnu" ] +profile = "default"