Skip to content

fix(mpm): Fix e2e test issues #15

fix(mpm): Fix e2e test issues

fix(mpm): Fix e2e test issues #15

Workflow file for this run

name: Publish mpm binary
on:
push:
tags:
- 'mpm-v*'
paths:
- 'utils/mpm/**'
- 'utils/mows-common-rust/**'
- '.github/workflows/publish-mpm.yml'
pull_request:
paths:
- 'utils/mpm/**'
- 'utils/mows-common-rust/**'
- '.github/workflows/publish-mpm.yml'
workflow_dispatch:
inputs:
dry_run:
description: 'Dry run (do not publish release)'
required: false
default: 'false'
type: boolean
jobs:
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Cache cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/registry
~/.cargo/git
utils/mpm/target
key: ${{ runner.os }}-cargo-test-${{ hashFiles('utils/mpm/Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-test-
- name: Run unit tests
run: |
cd utils/mpm
cargo test --release
- name: Build release binary for e2e tests
run: |
cd utils/mpm
cargo build --release
- name: Run e2e tests
run: |
cd utils/mpm/tests
./run-all.sh
env:
MPM_BIN: ${{ github.workspace }}/utils/mpm/target/release/mpm
build:
needs: test
if: github.event_name != 'pull_request'
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
arch: [amd64, arm64]
include:
- arch: amd64
target: x86_64-unknown-linux-musl
os_name: linux
- arch: arm64
target: aarch64-unknown-linux-musl
os_name: linux
steps:
- uses: actions/checkout@v4
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Cache Docker layers
uses: actions/cache@v4
with:
path: /tmp/.buildx-cache
key: ${{ runner.os }}-buildx-${{ matrix.arch }}-${{ hashFiles('utils/mpm/Cargo.lock', 'utils/mpm/Dockerfile') }}
restore-keys: |
${{ runner.os }}-buildx-${{ matrix.arch }}-
- name: Build static binary
run: |
cd utils/mpm
TARGETARCH=${{ matrix.arch }} BUILDX_CACHE_DIR=/tmp/.buildx-cache ./build.sh
- name: Move cache
run: |
rm -rf /tmp/.buildx-cache
if [ -d /tmp/.buildx-cache-new ]; then
mv /tmp/.buildx-cache-new /tmp/.buildx-cache
fi
- name: Get version from tag
id: get_version
run: |
if [[ "${{ github.ref_type }}" == "tag" ]]; then
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#mpm-v}"
else
VERSION="dev"
fi
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Rename binary with version and platform
run: |
cd utils/mpm/dist
mv mpm mpm-${{ steps.get_version.outputs.version }}-${{ matrix.os_name }}-${{ matrix.arch }}
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: mpm-${{ matrix.os_name }}-${{ matrix.arch }}
path: utils/mpm/dist/mpm-*
release:
needs: build
runs-on: ubuntu-latest
if: github.ref_type == 'tag' && github.event.inputs.dry_run != 'true'
permissions:
contents: write
steps:
- name: Download all artifacts
uses: actions/download-artifact@v4
with:
path: artifacts
merge-multiple: true
- name: Get version from tag
id: get_version
run: |
VERSION="${{ github.ref_name }}"
VERSION="${VERSION#mpm-v}"
echo "version=${VERSION}" >> $GITHUB_OUTPUT
- name: Create checksums
run: |
cd artifacts
for f in mpm-*; do
sha256sum "$f" > "${f}-checksum-sha256.txt"
done
- name: Create GitHub Release
uses: softprops/action-gh-release@v2
with:
name: mpm v${{ steps.get_version.outputs.version }}
draft: false
prerelease: false
files: |
artifacts/mpm-*
generate_release_notes: true