Skip to content

Commit

Permalink
ci: use subcommands in helper and stop using jq
Browse files Browse the repository at this point in the history
  • Loading branch information
TheButlah committed May 22, 2024
1 parent 6067cd1 commit 6d7888c
Show file tree
Hide file tree
Showing 9 changed files with 200 additions and 154 deletions.
23 changes: 13 additions & 10 deletions .github/workflows/rust-ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ jobs:

- name: Configure cargo to exclude platform-specific crates
run: |
tmp=($(scripts/get_excludes.py))
tmp=($(scripts/rust_ci_helper.py excludes))
EXCLUDES=""
for e in ${tmp[@]}; do
EXCLUDES+="--exclude ${e} "
Expand Down Expand Up @@ -157,33 +157,36 @@ jobs:
CI_PROFILE="artifact"
fi
echo CI_PROFILE=${CI_PROFILE} >>${GITHUB_ENV}
- name: Compile ${{ matrix.target }} Binaries
- name: Build linux artifacts
run: |
set -Eeuxo pipefail
uname -a
nix develop -c env
nix develop -c scripts/build_rust_artifacts.py \
--out_dir binaries --cargo_profile ${CI_PROFILE}
ls -aRsh binaries
nix develop -c scripts/rust_ci_helper.py \
build_linux_artifacts \
--out_dir linux_artifacts \
--cargo_profile ${CI_PROFILE}
ls -aRsh linux_artifacts
- name: Bundle artifacts
run: |
set -Eeuxo pipefail
mkdir artifacts
for b in binaries/*; do
mkdir final_artifacts
for b in linux_artifacts/*; do
b="$(basename ${b})"
# We make sure that the tarball is idempotent:
# https://stackoverflow.com/a/54908072
tar --sort=name --owner=root:0 --group=root:0 --mtime='@0' \
-vahcf artifacts/${b}.tar.zst -C binaries/${b} .
-vahcf final_artifacts/${b}.tar.zst -C linux_artifacts/${b} .
done
ls -aRsh artifacts
ls -aRsh final_artifacts
- name: Upload artifacts
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # pin@v3
with:
name: artifacts
path: artifacts
path: final_artifacts
if-no-files-found: error

cargo-deny:
Expand Down
17 changes: 12 additions & 5 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ change things in a backwards-incompatible way at any time!
- Prefer using cargo [workspace inheritance] when possible.
- Prefer cross-platform code. Please consult [deps tests](deps-tests) for more
info.
- Any binaries that do not run on all platforms must be documented as such in
their README.md file and added to the tests in `deps-tests`.
- All crates and binaries must support at least
`{x86_64-aarch64}-unknown-linux-gnu` as a compilation target. Any other targets
which are not supported must be specified in
`package.metadata.orb.unsupported_targets`. Windows is implicitly not
supported as a compilation target.
- Use `#![forbid(unsafe_code)]` whenever possible. This narrows the surface
area for debugging memory safety issues.
- Prefer the [nix crate][nix crate] for safe unix APIs instead of raw unsafe
Expand All @@ -28,12 +31,16 @@ change things in a backwards-incompatible way at any time!
- All first-party crates should start with the `orb-` prefix for the crate name,
and the crates' directories should omit this prefix. For example, the `attest`
dir contains the `orb-attest` crate.
- All binaries intended for deployment to orbs, should have a .deb produced by
CI. CI will produce any such .deb for crates with a `package.metadata.deb`
section in the Cargo.toml.

## First time Setup

1. [Install nix][install nix]. This works for both mac and linux, windows is
only supported via [WSL2][WSL2].
2. Ensure that you have these lines in your `~/.config/nix/nix.conf`:
1. [Install nix][install nix]. This works for both mac and linux, if you are
using a windows machine, you must first set up [WSL2][WSL2].
2. Ensure that you have these lines in your `~/.config/nix/nix.conf`. This is
done automatically by the above installer:
```
experimental-features = nix-command flakes
max-jobs = auto
Expand Down
2 changes: 2 additions & 0 deletions mcu-util/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ unsupported_targets = [
"aarch64-apple-darwin",
"x86_64-apple-darwin",
]

[package.metadata.deb]
2 changes: 2 additions & 0 deletions orb-backend-state/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ zbus.workspace = true

[build-dependencies]
orb-build-info = { path = "../build-info", features = ["build-script"] }

[package.metadata.deb]
2 changes: 2 additions & 0 deletions orb-slot-ctrl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -21,3 +21,5 @@ thiserror.workspace = true

[build-dependencies]
orb-build-info = { path = "../build-info", features = ["build-script"] }

[package.metadata.deb]
2 changes: 2 additions & 0 deletions orb-thermal-cam-ctrl/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,5 @@ unsupported_targets = [
"aarch64-apple-darwin",
"x86_64-apple-darwin",
]

[package.metadata.deb]
94 changes: 0 additions & 94 deletions scripts/build_rust_artifacts.py

This file was deleted.

45 changes: 0 additions & 45 deletions scripts/get_excludes.py

This file was deleted.

Loading

0 comments on commit 6d7888c

Please sign in to comment.