Fix screen record script #18
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
name: Rust | |
on: | |
pull_request: | |
push: | |
branches: | |
- main | |
concurrency: | |
group: ci-${{ github.head_ref }} | |
cancel-in-progress: true | |
env: | |
RUST_VERSION: stable | |
jobs: | |
fmt: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: hecrj/setup-rust-action@v2 | |
with: | |
rust-version: ${{env.RUST_VERSION}} | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions/checkout@v4 | |
- name: cargo fmt | |
run: cargo fmt -- --check | |
clippy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: hecrj/setup-rust-action@v2 | |
with: | |
rust-version: ${{env.RUST_VERSION}} | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions/checkout@v4 | |
- name: cargo clippy | |
run: cargo clippy -- -D warnings | |
unit_tests: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ubuntu-latest, macOS-latest] | |
steps: | |
- uses: hecrj/setup-rust-action@v2 | |
with: | |
rust-version: ${{env.RUST_VERSION}} | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions/checkout@v4 | |
- name: Run tests | |
run: cargo test | |
# build_windows_release: | |
# runs-on: windows-latest | |
# name: "Release build for Windows" | |
# steps: | |
# - uses: hecrj/setup-rust-action@v2 | |
# with: | |
# rust-version: ${{env.RUST_VERSION}} | |
# - uses: Swatinem/rust-cache@v2 | |
# - uses: actions/checkout@v4 | |
# - name: Build release binary | |
# run: cargo build --release | |
# env: | |
# RUSTFLAGS: "-C target-feature=+crt-static" | |
# - uses: actions/upload-artifact@v3 | |
# with: | |
# name: pactup-windows | |
# path: target/release/pactup.exe | |
build_macos_release: | |
runs-on: macos-latest | |
name: "Release build for macOS" | |
steps: | |
- uses: hecrj/setup-rust-action@v2 | |
with: | |
rust-version: ${{env.RUST_VERSION}} | |
- uses: Swatinem/rust-cache@v2 | |
- uses: actions/checkout@v4 | |
- name: Build release binary | |
run: cargo build --release | |
env: | |
LZMA_API_STATIC: "true" | |
- name: Strip binary from debug symbols | |
run: strip target/release/pactup | |
- name: List dynamically linked libraries | |
run: otool -L target/release/pactup | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pactup-macos | |
path: target/release/pactup | |
build_static_linux_binary: | |
name: "Build static Linux binary" | |
runs-on: ubuntu-latest | |
steps: | |
- uses: hecrj/setup-rust-action@v2 | |
with: | |
rust-version: ${{env.RUST_VERSION}} | |
targets: x86_64-unknown-linux-gnu | |
- uses: Swatinem/rust-cache@v2 | |
with: | |
key: static-linux-binary | |
- uses: actions/checkout@v4 | |
- name: Build release binary | |
run: cargo build --release --target x86_64-unknown-linux-gnu | |
env: | |
RUSTFLAGS: "-C target-feature=+crt-static" | |
- name: Strip binary from debug symbols | |
run: strip target/x86_64-unknown-linux-gnu/release/pactup | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: pactup-linux | |
path: target/x86_64-unknown-linux-gnu/release/pactup | |
# Unfortunatly, No pact binary is available for linux arm | |
# build_static_arm_binary: | |
# name: "Build ARM binary" | |
# strategy: | |
# matrix: | |
# include: | |
# - arch: arm64 | |
# rust_target: aarch64-unknown-linux-gnu | |
# docker_image: arm64v8/ubuntu | |
# docker_platform: aarch64 | |
# - arch: arm32 | |
# rust_target: armv7-unknown-linux-gnueabihf | |
# docker_image: arm32v7/ubuntu | |
# docker_platform: armv7 | |
# runs-on: ubuntu-latest | |
# env: | |
# RUST_TARGET: ${{ matrix.rust_target }} | |
# steps: | |
# - name: Set up QEMU | |
# id: qemu | |
# uses: docker/setup-qemu-action@v3 | |
# - uses: hecrj/setup-rust-action@v2 | |
# with: | |
# rust-version: ${{env.RUST_VERSION}} | |
# - uses: Swatinem/rust-cache@v2 | |
# with: | |
# key: arm-binary-${{ matrix.arch }} | |
# - name: "Download `cross` crate" | |
# run: cargo install cross | |
# - uses: actions/checkout@v4 | |
# - name: "Build release" | |
# run: cross build --target $RUST_TARGET --release | |
# - uses: uraimo/[email protected] | |
# name: Sanity test | |
# with: | |
# arch: ${{matrix.docker_platform}} | |
# distro: ubuntu18.04 | |
# # Not required, but speeds up builds by storing container images in | |
# # a GitHub package registry. | |
# githubToken: ${{ github.token }} | |
# env: | | |
# RUST_LOG: pactup=debug | |
# dockerRunArgs: | | |
# --volume "${PWD}/target/${{matrix.rust_target}}/release:/artifacts" | |
# # Set an output parameter `uname` for use in subsequent steps | |
# run: | | |
# echo "Hello from $(uname -a)" | |
# /artifacts/pactup --version | |
# echo "pactup install 4.11" | |
# /artifacts/pactup install 4.11 | |
# echo "pactup exec --using=4.11 -- pact --version" | |
# /artifacts/pactup exec --using=4.11 -- pact --version | |
# - uses: actions/upload-artifact@v3 | |
# with: | |
# name: pactup-${{ matrix.arch }} | |
# path: target/${{ env.RUST_TARGET }}/release/pactup | |
ensure_commands_markdown_is_up_to_date: | |
runs-on: ubuntu-latest | |
name: Ensure command docs are up-to-date | |
needs: [build_static_linux_binary] | |
steps: | |
- name: install necessary shells | |
run: sudo apt-get update && sudo apt-get install -y fish zsh bash | |
- uses: actions/checkout@v4 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: pactup-linux | |
path: target/release | |
- name: mark binary as executable | |
run: chmod +x target/release/pactup | |
- name: install pactup as binary | |
run: | | |
sudo install target/release/pactup /bin | |
pactup --version | |
- uses: pnpm/action-setup@v4 | |
with: | |
run_install: false | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 22.x | |
cache: "pnpm" | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- run: pnpm install | |
- name: Generate command markdown | |
run: | | |
pnpm run generate-command-docs --check --binary-path=$(which pactup) |