Bump fastrand from 2.1.0 to 2.1.1 (#1466) #3431
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
on: | |
push: | |
branches: | |
- "develop" | |
- "dev/*" | |
tags: | |
- "v*.*.*" | |
pull_request: | |
branches: | |
- "develop" | |
name: Build Pipeline | |
permissions: | |
checks: write | |
packages: write | |
pull-requests: write | |
security-events: read | |
statuses: write | |
contents: write | |
jobs: | |
check: | |
name: Check on ${{ matrix.host }} against ${{ matrix.toolchain }} Rust | |
strategy: | |
fail-fast: false | |
matrix: | |
toolchain: [stable, nightly] | |
host: [ubuntu-22.04, macos-13] | |
runs-on: ${{ matrix.host }} | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4.1.6 | |
- name: Install ${{ matrix.toolchain }} toolchain | |
uses: actions-rs/toolchain@v1.0.7 | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.toolchain }} | |
components: rustfmt, clippy | |
override: true | |
- name: Set up cargo cache | |
uses: actions/cache@v4.0.2 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: cargo-${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }}-check | |
restore-keys: | | |
cargo-${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }}-check | |
cargo-${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }} | |
cargo-${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }}-${{ matrix.profile }} | |
cargo-${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }} | |
- name: Check formatting | |
run: cargo fmt -- --check | |
- name: Static analysis with clippy | |
run: cargo clippy --all-targets ${{ matrix.toolchain == 'nightly' && '-F nightly' || '' }} | |
- name: Run tests | |
run: cargo test | |
- name: Run benchmarks | |
run: cargo bench ${{ matrix.toolchain == 'nightly' && '-F nightly' || '' }} | |
if: matrix.toolchain == 'nightly' | |
- name: Check for security issues | |
uses: actions-rs/audit-check@v1.2.0 | |
with: | |
token: ${{ secrets.GITHUB_TOKEN }} | |
continue-on-error: true | |
build-binary: | |
name: ${{ matrix.profile == 'debug' && 'Debug build' || 'Build' }} ${{ matrix.desc }} binary (${{ matrix.target }}) | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- { desc: arm-mac, target: aarch64-apple-darwin, host: macos-13, profile: release, toolchain: stable } | |
- { desc: arm-mac-dbg, target: aarch64-apple-darwin, host: macos-13, profile: debug, toolchain: stable } | |
- { desc: intel-mac, target: x86_64-apple-darwin, host: macos-13, profile: release, toolchain: stable } | |
- { desc: intel-mac-dbg, target: x86_64-apple-darwin, host: macos-13, profile: debug, toolchain: stable } | |
- { desc: arm-linux, target: armv7-unknown-linux-gnueabihf, host: ubuntu-22.04, profile: release, toolchain: stable } | |
- { desc: arm-linux-dbg, target: armv7-unknown-linux-gnueabihf, host: ubuntu-22.04, profile: debug, toolchain: stable } | |
- { desc: arm-linux-static, target: armv7-unknown-linux-musleabihf, host: ubuntu-22.04, profile: release, toolchain: stable } | |
- { desc: arm-linux-static-dbg, target: armv7-unknown-linux-musleabihf, host: ubuntu-22.04, profile: debug, toolchain: stable } | |
- { desc: arm64-linux, target: aarch64-unknown-linux-gnu, host: ubuntu-22.04, profile: release, toolchain: stable } | |
- { desc: arm64-linux-dbg, target: aarch64-unknown-linux-gnu, host: ubuntu-22.04, profile: debug, toolchain: stable } | |
- { desc: arm64-linux-static, target: aarch64-unknown-linux-musl, host: ubuntu-22.04, profile: release, toolchain: stable } | |
- { desc: arm64-linux-static-dbg, target: aarch64-unknown-linux-musl, host: ubuntu-22.04, profile: debug, toolchain: stable } | |
- { desc: x86_64-linux, target: x86_64-unknown-linux-gnu, host: ubuntu-22.04, profile: release, toolchain: stable } | |
- { desc: x86_64-linux-dbg, target: x86_64-unknown-linux-gnu, host: ubuntu-22.04, profile: debug, toolchain: stable } | |
- { desc: x86_64-linux-static, target: x86_64-unknown-linux-musl, host: ubuntu-22.04, profile: release, toolchain: stable } | |
- { desc: x86_64-linux-static-dbg, target: x86_64-unknown-linux-musl, host: ubuntu-22.04, profile: debug, toolchain: stable } | |
runs-on: ${{ matrix.host }} | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4.1.6 | |
- name: Install ${{ matrix.toolchain }} toolchain | |
uses: actions-rs/toolchain@v1.0.7 | |
with: | |
toolchain: stable | |
profile: minimal | |
target: ${{ matrix.target }} | |
components: rustfmt, clippy | |
- name: Set up cargo cache | |
uses: actions/cache@v4.0.2 | |
continue-on-error: false | |
with: | |
path: | | |
~/.cargo/bin/ | |
~/.cargo/registry/index/ | |
~/.cargo/registry/cache/ | |
~/.cargo/git/db/ | |
target/ | |
key: cargo-${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }}-build | |
restore-keys: | | |
cargo-${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }}-build | |
cargo-${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }}-${{ matrix.profile }}-${{ hashFiles('**/Cargo.lock') }} | |
cargo-${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }}-${{ matrix.profile }} | |
cargo-${{ runner.os }}-${{ matrix.toolchain }}-${{ matrix.target }} | |
- name: Install cross | |
uses: actions-rs/cargo@v1.0.3 | |
with: | |
use-cross: true | |
command: help # We just need to make sure that cross is available | |
- name: Build ${{ matrix.profile }} archive | |
run: make dist | |
env: | |
CARGO: cross | |
DEBUG: ${{ matrix.profile == 'debug' && 1 || 0 }} | |
RELEASE: ${{ startsWith(github.ref, 'refs/tags/') && 1 || 0 }} | |
SUFFIX: ${{ matrix.desc }} | |
TARGET: ${{ matrix.target }} | |
- name: Find archive | |
run: echo archive=`ls prometheus-weathermen-*.tar.zz` >> $GITHUB_OUTPUT | |
id: list-archive | |
- name: Upload ${{ matrix.profile }} binary | |
uses: actions/upload-artifact@v4.3.3 | |
with: | |
name: ${{ steps.list-archive.outputs.archive }} | |
path: ${{ steps.list-archive.outputs.archive }} | |
if-no-files-found: error | |
build-docker: | |
needs: [build-binary] | |
name: Build Docker images | |
runs-on: ubuntu-22.04 | |
env: | |
CONTAINER_BINARY_DIR: target/container-binaries | |
if: github.event_name != 'pull_request' | |
steps: | |
- name: Checkout source | |
uses: actions/checkout@v4.1.6 | |
- name: Download binaries | |
uses: actions/download-artifact@v4.1.8 | |
id: docker_download | |
- name: Prepare binaries | |
id: docker_binaries | |
shell: bash | |
run: make container-binaries PLATFORM_FILE=$GITHUB_OUTPUT | |
env: | |
BINARY_ARCHIVE_DIR: ${{ steps.docker_download.outputs.download-path }} | |
- name: Generate metadata | |
id: docker_metadata | |
uses: docker/metadata-action@v5.5.1 | |
with: | |
images: | | |
lstrojny/prometheus-weathermen | |
ghcr.io/lstrojny/prometheus-weathermen | |
tags: | | |
type=schedule | |
type=ref,event=branch | |
type=ref,event=pr | |
type=semver,pattern={{version}} | |
type=semver,pattern={{major}}.{{minor}} | |
type=semver,pattern={{major}} | |
type=sha | |
labels: | | |
org.opencontainers.image.licenses=MIT OR Apache2 | |
- name: Set up QEMU | |
uses: docker/setup-qemu-action@v3.0.0 | |
with: | |
platforms: ${{ steps.docker_binaries.outputs.platforms }} | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3.3.0 | |
- name: Login to Docker Hub | |
uses: docker/login-action@v3.1.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GHCR | |
uses: docker/login-action@v3.1.0 | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/build-push-action@v5.3.0 | |
with: | |
context: . | |
push: true | |
tags: ${{ steps.docker_metadata.outputs.tags }} | |
labels: ${{ steps.docker_metadata.outputs.labels }} | |
platforms: ${{ steps.docker_binaries.outputs.platforms }} | |
build-args: CONTAINER_BINARY_DIR=${{ env.CONTAINER_BINARY_DIR }} | |
- name: Docker Hub Description | |
uses: peter-evans/dockerhub-description@v4.0.0 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
repository: lstrojny/prometheus-weathermen | |
short-description: A prometheus exporter endpoint for weather data | |
release: | |
needs: [check, build-binary, build-docker] | |
name: Release | |
runs-on: ubuntu-22.04 | |
if: startsWith(github.ref, 'refs/tags/') | |
steps: | |
- name: Download binaries | |
uses: actions/download-artifact@v4.1.8 | |
id: download | |
- name: Publish GitHub release | |
uses: softprops/action-gh-release@v2.0.5 | |
with: | |
fail_on_unmatched_files: true | |
# Nested because for each archive a sub-folder of the same name is create to avoid conflicts when downloading | |
files: ${{ steps.download.outputs.download-path }}/prometheus-weathermen-*.tar.zz/prometheus-weathermen-*.tar.zz | |
generate_release_notes: true |