Skip to content

Commit

Permalink
github_actions: redo github actions (#17)
Browse files Browse the repository at this point in the history
* github_actions: redo github actions

Migrate github build and lint workflows off of deprecated actions
Add rust-toolchain.toml for easier setup

* github_actions: remove duplicate linting, fix warning elevation

Remove duplicate linting from build action
Remove default rustflags from toolchain action, preventing warning
escalation

* github_actions: upgrade dependencies

* github_action: remove cross dependency

Add .cargo/config.toml for linker specification
Add gcc and g++ requirements to github runner
Compile artifacts for armv7, aarch64, and x86_64
  • Loading branch information
ada-phillips authored Apr 27, 2024
1 parent 08c51a5 commit 4f00b38
Show file tree
Hide file tree
Showing 5 changed files with 84 additions and 46 deletions.
5 changes: 5 additions & 0 deletions .cargo/config.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
[target.armv7-unknown-linux-gnueabihf]
linker = "arm-linux-gnueabihf-gcc"

[target.aarch64-unknown-linux-gnu]
linker = "aarch64-linux-gnu-gcc"
86 changes: 55 additions & 31 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,56 +9,80 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/[email protected]

- uses: actions-rs/[email protected]
with:
toolchain: stable
target: armv7-unknown-linux-gnueabihf
components: clippy
override: true

- uses: actions-rs/[email protected]
with:
use-cross: true
command: build
args: --release --target armv7-unknown-linux-gnueabihf

- uses: actions/checkout@v4

- uses: SebRollen/[email protected]
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/[email protected]
- 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/[email protected]
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/[email protected]
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/[email protected]
with:
name: odyssey_x86_64
path: odyssey_x86_64/*

- uses: ncipollo/[email protected]
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/[email protected]
if: github.ref != 'refs/heads/main'
with:
artifacts: odyssey.tar.gz
artifacts: "*odyssey*.tar.gz"
tag: BRANCH_${{github.ref_name}}
skipIfReleaseExists: false
allowUpdates: true
Expand Down
24 changes: 14 additions & 10 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
10 changes: 5 additions & 5 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,20 +7,20 @@ 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"] }
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"
5 changes: 5 additions & 0 deletions rust-toolchain.toml
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 4f00b38

Please sign in to comment.