mirror of
https://codeberg.org/icewind/prometheus-mdns-rs.git
synced 2026-06-03 09:54:21 +02:00
ci
This commit is contained in:
parent
3a01ab6293
commit
bf2b144980
3 changed files with 94 additions and 2 deletions
56
.github/workflows/ci.yaml
vendored
Normal file
56
.github/workflows/ci.yaml
vendored
Normal file
|
|
@ -0,0 +1,56 @@
|
|||
on: [push, pull_request]
|
||||
|
||||
name: CI
|
||||
|
||||
jobs:
|
||||
check:
|
||||
name: Check
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
profile: minimal
|
||||
toolchain: stable
|
||||
override: true
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: check
|
||||
|
||||
test:
|
||||
runs-on: ubuntu-latest
|
||||
name: Tests
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: test
|
||||
|
||||
build:
|
||||
name: Build Binaries
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: musl-tools
|
||||
run: |
|
||||
sudo apt-get install musl-tools
|
||||
- uses: actions/checkout@v2
|
||||
- uses: actions-rs/toolchain@v1
|
||||
with:
|
||||
toolchain: stable
|
||||
target: x86_64-unknown-linux-musl
|
||||
- uses: Swatinem/rust-cache@v1
|
||||
- uses: actions-rs/cargo@v1
|
||||
with:
|
||||
command: build
|
||||
args: --release --target x86_64-unknown-linux-musl
|
||||
- uses: actions/upload-artifact@v2
|
||||
with:
|
||||
name: taspromto
|
||||
path: target/x86_64-unknown-linux-musl/release/prometheus-mdns-sd-rs
|
||||
27
.github/workflows/docker.yaml
vendored
Normal file
27
.github/workflows/docker.yaml
vendored
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
name: docker-build
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- 'main'
|
||||
- 'master'
|
||||
|
||||
jobs:
|
||||
docker:
|
||||
runs-on: ubuntu-20.04
|
||||
steps:
|
||||
- name: Set up Docker Buildx
|
||||
uses: docker/setup-buildx-action@v1
|
||||
- name: Login to DockerHub
|
||||
uses: docker/login-action@v1
|
||||
with:
|
||||
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
||||
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
||||
- name: Build and push
|
||||
id: docker_build
|
||||
uses: docker/build-push-action@v2
|
||||
with:
|
||||
push: true
|
||||
tags: icewind1991/prometheus-mdns-sd:latest
|
||||
- name: Image digest
|
||||
run: echo ${{ steps.docker_build.outputs.digest }}
|
||||
13
Dockerfile
13
Dockerfile
|
|
@ -1,7 +1,16 @@
|
|||
FROM ekidd/rust-musl-builder AS build
|
||||
|
||||
ADD . ./
|
||||
RUN sudo chown -R rust:rust .
|
||||
COPY Cargo.toml Cargo.lock ./
|
||||
|
||||
# Build with a dummy main to pre-build dependencies
|
||||
RUN mkdir src && \
|
||||
sudo chown -R rust:rust . && \
|
||||
echo "fn main(){}" > src/main.rs && \
|
||||
cargo build --release && \
|
||||
rm -r src
|
||||
|
||||
COPY src/ ./src/
|
||||
RUN sudo chown -R rust:rust . && touch src/main.rs
|
||||
|
||||
RUN cargo build --release
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue