-
Notifications
You must be signed in to change notification settings - Fork 15
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
8 changed files
with
338 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -65,6 +65,62 @@ jobs: | |
path: | | ||
runtime/init-container/initramfs.cpio.gz | ||
runtime/init-container/vmlinuz-virt | ||
build-self-test-img: | ||
name: Build self test image | ||
runs-on: ubuntu-20.04 | ||
env: | ||
gvmkit-build_tag: v0.3.13 | ||
gvmkit-build_dir: gvmkit-build | ||
gvmkit-build_archive: gvmkit-build-x86_64-unknown-linux-gnu.tar.gz | ||
self-test-img_tag: self-test | ||
rust_stable: 1.70.0 | ||
defaults: | ||
run: | ||
working-directory: self_test_img | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
|
||
- name: Install Rust ${{ env.rust_stable }} | ||
uses: actions-rs/toolchain@v1 | ||
with: | ||
toolchain: ${{ env.rust_stable }} | ||
components: rustfmt, clippy | ||
|
||
- name: Check lockfile | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
command: tree | ||
args: --locked | ||
|
||
- name: Build Docker image for GPU | ||
uses: docker/build-push-action@v4 | ||
with: | ||
push: false | ||
tags: ${{ env.self-test-img_tag }} | ||
|
||
- name: Download gvmkit-build | ||
if: startsWith(github.ref, 'refs/tags/') | ||
uses: robinraju/[email protected] | ||
with: | ||
repository: golemfactory/gvmkit-build-rs | ||
tag: ${{ env.gvmkit-build_tag }} | ||
fileName: ${{ env.gvmkit-build_archive }} | ||
extract: true | ||
out-file-path: ${{ env.gvmkit-build_dir }} | ||
tarBall: false | ||
zipBall: false | ||
|
||
- name: Build GVMkit image | ||
if: startsWith(github.ref, 'refs/tags/') | ||
run: | | ||
${{ env.gvmkit-build_dir }}/gvmkit-build ${{ env.self-test-img_tag }}:latest -o ${{ env.self-test-img_gvmi }} | ||
- uses: actions/upload-artifact@v2 | ||
with: | ||
name: self_test_img | ||
path: | | ||
${{ env.self-test-img_gvmi }} | ||
build: | ||
name: Build Release | ||
|
@@ -85,15 +141,10 @@ jobs: | |
- run: | | ||
ls -R | ||
test -f runtime/init-container/initramfs.cpio.gz | ||
- name: Download self-test image | ||
uses: robinraju/[email protected] | ||
- uses: actions/download-artifact@v2 | ||
with: | ||
repository: ${{ env.self-test-img_repository }} | ||
tag: ${{ env.self-test-img_tag }} | ||
fileName: self-test.gvmi | ||
out-file-path: runtime/image/ | ||
tarBall: false | ||
zipBall: false | ||
name: self_test_img | ||
path: runtime/image/ | ||
- name: Install Musl | ||
run: | | ||
sudo apt-get install -y musl-tools musl | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2,6 +2,7 @@ | |
members = [ | ||
"runtime", | ||
"gvmkit", | ||
"self_test_img" | ||
] | ||
|
||
[patch.crates-io] | ||
|
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
[package] | ||
name = "ya-self-test" | ||
version = "0.1.0" | ||
edition = "2021" | ||
|
||
[[bin]] | ||
name = "ya-self-test" | ||
path = "src/main.rs" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
FROM rust:1.70.0 as rust_builder | ||
RUN rustup target add x86_64-unknown-linux-musl | ||
|
||
FROM rust_builder as builder | ||
WORKDIR /data | ||
COPY . . | ||
RUN cargo install --path . --target x86_64-unknown-linux-musl | ||
|
||
FROM scratch | ||
VOLUME [ "/mnt/out" ] | ||
WORKDIR / | ||
COPY --from=builder /usr/local/cargo/bin/ya-self-test /ya-self-test | ||
CMD [ "/ya-self-test" ] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
all: build | ||
|
||
build: src | ||
docker build -t self-test . | ||
gvmkit-build self-test:latest -o self-test.gvmi | ||
|
||
.PHONY: all | ||
|
||
.PHONY: clean | ||
clean: | ||
cargo clean | ||
rm -f self-test.gvmi |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
use std::{env, fs}; | ||
|
||
fn main() { | ||
let args: Vec<String> = env::args().collect(); | ||
|
||
let output = "{}"; | ||
|
||
if args.len() == 2 { | ||
fs::write(&args[1], output).expect("Unable to write file"); | ||
} else { | ||
print!("{}", output); | ||
} | ||
} |