build(deps): bump anyhow from 1.0.94 to 1.0.95 (#1752) #4105
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/[email protected] | |
- name: Install ${{ matrix.toolchain }} toolchain | |
uses: actions-rs/[email protected] | |
with: | |
profile: minimal | |
toolchain: ${{ matrix.toolchain }} | |
components: rustfmt, clippy | |
override: true | |
- name: Set up cargo cache | |
uses: actions/[email protected] | |
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/[email protected] | |
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/[email protected] | |
- name: Install ${{ matrix.toolchain }} toolchain | |
uses: actions-rs/[email protected] | |
with: | |
toolchain: stable | |
profile: minimal | |
target: ${{ matrix.target }} | |
components: rustfmt, clippy | |
- name: Set up cargo cache | |
uses: actions/[email protected] | |
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/[email protected] | |
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/[email protected] | |
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/[email protected] | |
- name: Download binaries | |
uses: actions/[email protected] | |
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/[email protected] | |
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/[email protected] | |
with: | |
platforms: ${{ steps.docker_binaries.outputs.platforms }} | |
- name: Set up Docker Buildx | |
uses: docker/[email protected] | |
- name: Login to Docker Hub | |
uses: docker/[email protected] | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_TOKEN }} | |
- name: Login to GHCR | |
uses: docker/[email protected] | |
with: | |
registry: ghcr.io | |
username: ${{ github.actor }} | |
password: ${{ secrets.GITHUB_TOKEN }} | |
- name: Build and push | |
uses: docker/[email protected] | |
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/[email protected] | |
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/[email protected] | |
id: download | |
- name: Publish GitHub release | |
uses: softprops/[email protected] | |
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 |