diff --git a/.github/dependabot.yml b/.github/dependabot.yml index 9525b5e..e9ad69a 100644 --- a/.github/dependabot.yml +++ b/.github/dependabot.yml @@ -1,6 +1,6 @@ version: 2 updates: -- package-ecosystem: cargo +- package-ecosystem: gomod directory: "/" schedule: interval: weekly diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index a991d03..a172f48 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -8,49 +8,18 @@ jobs: runs-on: ubuntu-latest steps: - name: Checkout repository - uses: actions/checkout@v1 - - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: actions/checkout@v2 + - name: Setup Go + uses: actions/setup-go@v2 with: - toolchain: stable - override: true - target: x86_64-unknown-linux-musl - - run: cargo build --release --verbose + go-version: '1.16' + - name: Run build + run: bash build-static.sh - name: upload artifact of build output uses: actions/upload-artifact@v2 with: name: build - path: target/release/agent - - test: - name: test - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v1 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - profile: minimal - - run: cargo test --verbose - - rustfmt: - name: rustfmt - runs-on: ubuntu-latest - steps: - - name: Checkout repository - uses: actions/checkout@v1 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: stable - override: true - profile: minimal - components: rustfmt - - name: Check formatting - run: cargo fmt -- --check + path: agent commitlint: runs-on: ubuntu-latest @@ -64,7 +33,7 @@ jobs: release: name: Publish new release - needs: [build, test, rustfmt, commitlint] + needs: [build, commitlint] if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' runs-on: ubuntu-latest steps: diff --git a/README.md b/README.md index f4632dd..1e85014 100644 --- a/README.md +++ b/README.md @@ -5,14 +5,13 @@ To build the filesystem of the agent VM, see details in https://github.com/codeb ## Build ```sh -cargo build +go build ``` -With musl (for Alpine Linux): +Static (for Alpine Linux): ```sh -rustup target add x86_64-unknown-linux-musl -cargo build --target x86_64-unknown-linux-musl +go build -tags netgo -ldflags '-extldflags "-static"' ``` ## Run diff --git a/Cargo.lock b/archive/rust/Cargo.lock similarity index 100% rename from Cargo.lock rename to archive/rust/Cargo.lock diff --git a/Cargo.toml b/archive/rust/Cargo.toml similarity index 100% rename from Cargo.toml rename to archive/rust/Cargo.toml diff --git a/src/main.rs b/archive/rust/src/main.rs similarity index 100% rename from src/main.rs rename to archive/rust/src/main.rs diff --git a/src/routes/c.rs b/archive/rust/src/routes/c.rs similarity index 100% rename from src/routes/c.rs rename to archive/rust/src/routes/c.rs diff --git a/src/routes/cmd.rs b/archive/rust/src/routes/cmd.rs similarity index 100% rename from src/routes/cmd.rs rename to archive/rust/src/routes/cmd.rs diff --git a/src/routes/go.rs b/archive/rust/src/routes/go.rs similarity index 100% rename from src/routes/go.rs rename to archive/rust/src/routes/go.rs diff --git a/src/routes/health.rs b/archive/rust/src/routes/health.rs similarity index 100% rename from src/routes/health.rs rename to archive/rust/src/routes/health.rs diff --git a/src/routes/mod.rs b/archive/rust/src/routes/mod.rs similarity index 100% rename from src/routes/mod.rs rename to archive/rust/src/routes/mod.rs diff --git a/src/routes/python.rs b/archive/rust/src/routes/python.rs similarity index 100% rename from src/routes/python.rs rename to archive/rust/src/routes/python.rs diff --git a/src/run/c.rs b/archive/rust/src/run/c.rs similarity index 100% rename from src/run/c.rs rename to archive/rust/src/run/c.rs diff --git a/src/run/command.rs b/archive/rust/src/run/command.rs similarity index 100% rename from src/run/command.rs rename to archive/rust/src/run/command.rs diff --git a/src/run/go.rs b/archive/rust/src/run/go.rs similarity index 100% rename from src/run/go.rs rename to archive/rust/src/run/go.rs diff --git a/src/run/mod.rs b/archive/rust/src/run/mod.rs similarity index 100% rename from src/run/mod.rs rename to archive/rust/src/run/mod.rs diff --git a/src/run/python.rs b/archive/rust/src/run/python.rs similarity index 100% rename from src/run/python.rs rename to archive/rust/src/run/python.rs diff --git a/build-rootfs.sh b/build-rootfs.sh index 73181d1..86f72b8 100755 --- a/build-rootfs.sh +++ b/build-rootfs.sh @@ -9,7 +9,7 @@ mount rootfs.ext4 /tmp/my-rootfs docker run -i --rm \ -v /tmp/my-rootfs:/my-rootfs \ - -v "$(pwd)/target/x86_64-unknown-linux-musl/release/agent:/usr/local/bin/agent" \ + -v "$(pwd)/agent:/usr/local/bin/agent" \ -v "$(pwd)/openrc-service.sh:/etc/init.d/agent" \ alpine sh