Skip to content

Commit

Permalink
Update CI/CD and swap arg parser
Browse files Browse the repository at this point in the history
  • Loading branch information
de-luca committed Aug 12, 2023
1 parent 8a6efbb commit ba42e1b
Show file tree
Hide file tree
Showing 8 changed files with 170 additions and 94 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/clippy-fmt.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
name: Clippy Fmt

on:
push:
branches:
- '*'

jobs:
clippy_fmt:
runs-on: ubuntu-latest
Expand Down
38 changes: 0 additions & 38 deletions .github/workflows/docker-img.yml

This file was deleted.

49 changes: 46 additions & 3 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,44 @@ on:
tags:
- '*'

env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}

jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v2

- uses: actions-rs/toolchain@v1
with:
toolchain: stable
override: true
components: clippy, rustfmt
profile: minimal

- uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
key: cargo-${{ hashFiles('**/Cargo.toml') }}

- uses: actions-rs/cargo@v1
with:
use-cross: true
command: build
args: --release --target x86_64-unknown-linux-musl

- name: get version
id: version
run: echo ::set-output name=version::${GITHUB_REF/refs\/tags\//}

- name: build
run: docker run --rm -u root -v "$(pwd)":/home/rust/src ekidd/rust-musl-builder cargo build --release

- name: archive
id: archive
run: |
Expand All @@ -32,3 +57,21 @@ jobs:
with:
artifacts: ${{ steps.archive.outputs.asset }}
token: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/login-action@v1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}

- uses: docker/metadata-action@v3
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

- uses: docker/build-push-action@v2
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
137 changes: 106 additions & 31 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@ tokio = { version = "1.5.0", features = ["full"] }
warp = { version = "0.3", features = ["tls"] }
tokio-stream = "0.1.1"
futures-util = "0.3"
argh = "0.1.5"
clap = { version = "4.3.19", features = ["derive"] }
10 changes: 1 addition & 9 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,13 +1,5 @@
FROM ekidd/rust-musl-builder as builder
ADD --chown=rust:rust ./ /home/rust/src
RUN cargo build --release

# FROM alpine:latest as certs
# RUN apk add --no-cache ca-certificates

FROM scratch
ENV RUST_LOG=info
# COPY --from=certs /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=builder /home/rust/src/target/x86_64-unknown-linux-musl/release/beacon /bin/beacon
COPY target/x86_64-unknown-linux-musl/release/beacon /bin/beacon
EXPOSE 7878
ENTRYPOINT [ "/bin/beacon" ]
3 changes: 2 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,5 +45,6 @@ cargo clippy

### Static build
```shell
docker run --rm -it -v "$(pwd)":/home/rust/src ekidd/rust-musl-builder cargo build --release
cargo install cross --git https://github.com/cross-rs/cross
cross build --release --target x86_64-unknown-linux-musl
```

0 comments on commit ba42e1b

Please sign in to comment.