Skip to content

Commit

Permalink
Update CI configuration for improved build and test processes
Browse files Browse the repository at this point in the history
- Don't use cross for win32
- Refactor release CI workflow to streamline environment variable setup and build commands.
- Change target features from +crt-static to -crt-static for specific builds.
- Introduce new environment variables for better profile management during builds.
- Update test configurations in IDE settings to include additional options for better control over test execution.
- Ensure consistent handling of paths and archive naming conventions in the release process.
  • Loading branch information
lilith committed Jan 21, 2025
1 parent 0e4b79b commit 6b3bc62
Showing 1 changed file with 36 additions and 31 deletions.
67 changes: 36 additions & 31 deletions .github/workflows/release_ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ jobs:
commit-suffix: win-x86
nuget-rid: win-x86
target: i686-pc-windows-msvc
cross: 'true'


- name: ARM64-windows
suffix: win-arm64
Expand All @@ -85,7 +85,7 @@ jobs:
os: ubuntu-24.04
target-cpu: x86-64
target: x86_64-unknown-linux-musl
target-feature: +crt-static
target-feature: -crt-static
features: mimalloc
cross: 'true'

Expand All @@ -96,7 +96,7 @@ jobs:
nuget-rid: linux-musl-arm64
os: ubuntu-24-arm-32gb
target-cpu: generic
target-feature: +crt-static
target-feature: -crt-static
target: aarch64-unknown-linux-musl
features: mimalloc
cross: 'true'
Expand Down Expand Up @@ -151,9 +151,10 @@ jobs:
shell: bash
run: |
echo "TARGET_DIR=target/${{ matrix.target }}/" >> $GITHUB_ENV
echo "REL_BINARIES_DIR=target/${{ matrix.target }}/release/" >> $GITHUB_ENV
echo "TAG_SHA_SUFFIX=${{ github.ref_name }}-${{ env.GITHUB_SHA_SHORT }}-${{ matrix.suffix }}" >> $GITHUB_ENV
echo "RUSTFLAGS=${{ matrix.target-cpu && format('-C target-cpu={0}',matrix.target-cpu) }} ${{ matrix.target-feature && format('-C target-feature={0}',matrix.target-feature) }}" >> $GITHUB_ENV
echo "PROFILE=release" >> $GITHUB_ENV
echo "REL_BINARIES_DIR=target/${{ matrix.target }}/release/" >> $GITHUB_ENV
- name: Set env vars IMAGEFLOW_TOOL_PATH, ESTIMATED_ARTIFACT_URL
shell: bash
Expand All @@ -162,7 +163,8 @@ jobs:
echo "IMAGEFLOW_TOOL_PATH=${{ env.REL_BINARIES_DIR }}imageflow_tool${{ contains(matrix.os, 'windows') && '.exe' || '' }}" >> $GITHUB_ENV
echo "ESTIMATED_ARTIFACT_URL=${{ env.HTTPS_IMAGEFLOW_NIGHTLIES }}/${{ env.IMAGEFLOW_TAG_SHA_SUFFIX }}.${{ env.EXTENSION }}" >> $GITHUB_ENV
echo "RELATIVE_ARTIFACT_ARCHIVE=./artifacts/github/${{ env.IMAGEFLOW_TAG_SHA_SUFFIX }}.${{ env.EXTENSION }}" >> $GITHUB_ENV
echo "CARGO_TARGET_FEATURES_ARGS=${{ matrix.target && format('--target={0}',matrix.target) }} ${{ matrix.features && format('--features={0}',matrix.features) }}" >> $GITHUB_ENV
echo "CARGO_PROFILE_TARGET_FEATURES_ARGS=--${{ env.PROFILE }} ${{ matrix.target && format('--target={0}',matrix.target) }} ${{ matrix.features && format('--features={0}',matrix.features) }}" >> $GITHUB_ENV
echo "CROSS_ARGS=--locked --${{ env.PROFILE }} ${{ matrix.features && format('--features={0}',matrix.features) }}" >> $GITHUB_ENV
echo "RUSTFLAGS=${{ matrix.target-cpu && format('-C target-cpu={0}',matrix.target-cpu) }}" >> $GITHUB_ENV
echo "FETCH_COMMIT_SUFFIX=${{ matrix.commit-suffix }}" >> $GITHUB_ENV
echo "CI_TAG=${{ github.ref_name }}" >> $GITHUB_ENV
Expand All @@ -175,60 +177,63 @@ jobs:
echo "CI_BUILD_URL=https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}" >> $GITHUB_ENV
echo "ESTIMATED_DOCS_URL=${{ env.HTTPS_IMAGEFLOW_NIGHTLIES }}/doc" >> $GITHUB_ENV
echo "DEBUG=False" >> $GITHUB_ENV
echo "PROFILE=release" >> $GITHUB_ENV
echo "TARGET_CPU=${{ matrix.target-cpu }}" >> $GITHUB_ENV
- name: Build Release
if: matrix.cross != 'true'
run: cargo build --all --release ${{ env.CARGO_TARGET_FEATURES_ARGS }}
- name: "Build ${{ env.PROFILE }}"
if: matrix.cross != 'true' && matrix.woa != 'true'
run: cargo build --all ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }}
shell: bash
#env:
# OPT_LEVEL: 0

- name: Cross Build Release
- name: "Build ${{ env.PROFILE }}"
if: matrix.woa == 'true'
run: "& Launch-VsDevShell.ps1 | cargo build --all ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }}"
shell: powershell

- name: "Build ${{ env.PROFILE }} (Cross)"
uses: houseabsolute/[email protected]
with:
command: "build"
target: ${{ matrix.target }}
toolchain: stable
args:
"--locked --release ${{ matrix.features && format('--features={0}',matrix.features) }}"
args: "${{ env.CROSS_ARGS }}"
if: matrix.cross == 'true'


- name: imageflow_tool diagnose --show-compilation-info
run: "${{ env.IMAGEFLOW_TOOL_PATH }} diagnose --show-compilation-info"
shell: bash

- name: Test
run: cargo test --all --locked --release ${{ env.CARGO_TARGET_FEATURES_ARGS }}
- name: "Test ${{ env.PROFILE }}"
run: cargo test --all --locked ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }}
shell: bash
env:
RUSTFLAGS: "${{ env.RUSTFLAGS }}"
if: matrix.cross != 'true'

- name: Cross Test
- name: "Test ${{ env.PROFILE }} (WOA)"
run: "& Launch-VsDevShell.ps1 | cargo test --all ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }}"
shell: powershell
if: matrix.woa == 'true'

- name: "Test ${{ env.PROFILE }} (Cross)"
uses: houseabsolute/[email protected]
with:
command: "test"
target: ${{ matrix.target }}
toolchain: stable
args:
"--locked --release ${{ matrix.features && format('--features={0}',matrix.features) }}"
args: "${{ env.CROSS_ARGS }}"
if: matrix.cross == 'true'

- name: Build Docs
run: cargo doc --all --release --no-deps ${{ env.CARGO_TARGET_FEATURES_ARGS }}
- name: "Build ${{ env.PROFILE }} Docs"
run: cargo doc --all --no-deps ${{ env.CARGO_PROFILE_TARGET_FEATURES_ARGS }}
if: matrix.cross != 'true'

- name: Cross Build Docs
uses: houseabsolute/[email protected]
with:
command: "doc"
target: ${{ matrix.target }}
toolchain: stable
args:
"--all --release --no-deps ${{ env.CARGO_TARGET_FEATURES_ARGS }}"
# actions-rust-cross does not support cargo doc
- name: "mkdir -p ./${{ env.TARGET_DIR }}doc"
run: |
mkdir -p ./${{ env.TARGET_DIR }}doc
touch ./${{ env.TARGET_DIR }}doc/not-available.txt
if: matrix.cross == 'true'

- name: Create .zip / .tar.gz files for upload to Github Release & S3
Expand All @@ -239,7 +244,7 @@ jobs:
cd ./${TARGET_DIR}doc
tar czf "../docs.${{ env.EXTENSION }}" ./*
)
mv ./${TARGET_DIR}docs.${{ env.EXTENSION }} ./artifacts/staging/
mv ./${{ env.TARGET_DIR }}docs.${{ env.EXTENSION }} ./artifacts/staging/
cp -R ./${REL_BINARIES_DIR}/{imageflow_,libimageflow}* ./artifacts/staging/
cp bindings/headers/*.h ./artifacts/staging/headers/
Expand All @@ -259,7 +264,7 @@ jobs:
cp "${TEMP_ARCHIVE_NAME}" "./artifacts/upload/releases/${{ github.ref_name }}/${{ env.IMAGEFLOW_TAG_SHA_SUFFIX }}.${{ env.EXTENSION }}"
cp "${TEMP_ARCHIVE_NAME}" "./artifacts/upload/commits/${{ github.sha }}/${{ matrix.commit-suffix }}.${{ env.EXTENSION }}"
env:
TEMP_ARCHIVE_NAME: "./artifacts/staging/archive${{ env.EXTENSION }}"
TEMP_ARCHIVE_NAME: "./artifacts/staging/archive.${{ env.EXTENSION }}"


- name: Upload archive to Github Release
Expand Down

0 comments on commit 6b3bc62

Please sign in to comment.