Pin commit hashes #41
This file contains hidden or 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: Tests | |
| on: | |
| push: | |
| pull_request: | |
| workflow_dispatch: | |
| # used when called manually. | |
| workflow_call: | |
| # used when called by _another_ workflow (not when called on this repo!) | |
| jobs: | |
| test: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 # not pinning to commit since this is a GitHub action, which we trust | |
| - name: Download crc_fast library release | |
| run: | | |
| ARCH="x86_64" | |
| PLATFORM="linux" | |
| # Fetch the latest release version | |
| echo "Fetching latest crc_fast library release..." | |
| LATEST_RELEASE=$(curl -sL https://api.github.com/repos/awesomized/crc-fast-rust/releases/latest | jq -r .tag_name) | |
| if [ -z "$LATEST_RELEASE" ]; then | |
| echo "Error: Failed to fetch latest release version" | |
| exit 1 | |
| fi | |
| echo "Latest release: ${LATEST_RELEASE}" | |
| ARTIFACT_NAME="crc-fast-${LATEST_RELEASE}-${PLATFORM}-${ARCH}.tar.gz" | |
| DOWNLOAD_URL="https://github.com/awesomized/crc-fast-rust/releases/download/${LATEST_RELEASE}/${ARTIFACT_NAME}" | |
| echo "Downloading crc_fast library ${LATEST_RELEASE} for ${PLATFORM}-${ARCH}" | |
| curl -sL -o crc-fast.tar.gz "${DOWNLOAD_URL}" || { | |
| echo "Error: Failed to download crc_fast library release ${LATEST_RELEASE} from ${DOWNLOAD_URL}" | |
| exit 1 | |
| } | |
| # Save version for next step | |
| echo "CRC_FAST_VERSION=${LATEST_RELEASE}" >> $GITHUB_ENV | |
| - name: Extract crc_fast library | |
| run: | | |
| tar -xzf crc-fast.tar.gz | |
| EXTRACT_DIR="crc-fast-${CRC_FAST_VERSION}-linux-x86_64" | |
| # Verify required files exist | |
| if [ ! -f "${EXTRACT_DIR}/include/libcrc_fast.h" ]; then | |
| echo "Error: Required header file not found: ${EXTRACT_DIR}/include/libcrc_fast.h" | |
| exit 1 | |
| fi | |
| if [ ! -f "${EXTRACT_DIR}/lib/libcrc_fast.so" ]; then | |
| echo "Error: Required library file not found: ${EXTRACT_DIR}/lib/libcrc_fast.so" | |
| exit 1 | |
| fi | |
| # Copy files to expected locations | |
| mkdir -p lib include | |
| cp "${EXTRACT_DIR}/lib/libcrc_fast.so" lib/ | |
| cp "${EXTRACT_DIR}/include/libcrc_fast.h" include/ | |
| echo "Successfully extracted crc_fast library ${CRC_FAST_VERSION}" | |
| - name: Phpize | |
| run: phpize | |
| - name: Configure | |
| run: ./configure --with-crc-fast=. | |
| - name: Make | |
| run: make | |
| - name: Test | |
| run: make test |