Skip to content

wip

wip #16

Workflow file for this run

name: Rust
on:
push:
branches: ["feature/ci-add-musl-support", "release/*"]
# pull_request:
# branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
# TODO add musl to CI see DEVELOPMENT.md
jobs:
test:
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Run tests
run: cargo test
prepare-release:
needs: test
runs-on: ubuntu-latest
outputs:
pkg_ver: ${{ steps.capture_version_from_cargo.pkg_ver }}
steps:
- name: Checkout Repo
uses: actions/checkout@v4
# TODO create a cargo crate to query data from Cargo.toml
- id: capture_version_from_cargo
name: Capture Version from Cargo.toml
run: |
ver=$(cat Cargo.toml | grep -e '^version = ".*"$' | sed 's/version = "\(.*\)"/\1/')
echo "pkg_ver=$ver" >> "$GITHUB_OUTPUT"
- name: Create Github Release
env:
PKG_VER: ${{ steps.capture_version_from_cargo.outputs.pkg_ver }}
run: |
gh release create \
--title v$PKG_VER --notes-file RELEASE.md $PKG_VER
publish:
needs: prepare-release
name: publish
runs-on: ${{ matrix.os }}
strategy:
matrix:
build:
- linux x86_64
# - linux musl x64
include:
#- build: linux musl x64
# os: ubuntu-latest
# rust: stable
# rust_target: x86_64-unknown-linux-musl
- build: linux gnu x64
os: ubuntu-latest
rust: stable
rust_target: x86_64-unknown-linux-gnu
steps:
- name: Checkout Repo
uses: actions/checkout@v4
- name: Install Dependencies - musl
if: matrix.rust_target == 'x86_64-unknown-linux-musl'
run: sudo apt-get install -y --no-install-recommends musl-tools
- name: Extra Cargo
run: cargo install cargo-caw-publish
- name: Build
run: cargo build -r --target ${{ matrix.rust_target }}
- name: Publish to crates.io
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo caw-publish
- name: Publish to Github Releases
env:
GH_TOKEN: ${{ secrets.GH_TOKEN }}
PKG_VER: ${{ needs.prepare-release.outputs.pkg_ver }}
run: |
cp target/release/http_status_code_check target/release/http_status_code_check-${{ matrix.rust_target }}
gh release upload $PKG_VER target/release/http_status_code_check-${{ matrix.rust_target }}