Run tests on multiple platforms and fix windows MPIR issue #244
Workflow file for this run
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: Build C Libraries | |
on: | |
push: | |
branches: | |
- main | |
release: | |
types: [published] | |
pull_request: | |
branches: | |
- '**' | |
concurrency: | |
# SHA is added to the end if on `main` to let all main workflows run | |
group: ${{ github.ref }}-${{ github.workflow }}-${{ github.event_name }}-${{ (github.ref == 'refs/heads/main' || startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/heads/long_lived/')) && github.sha || '' }} | |
cancel-in-progress: true | |
permissions: | |
contents: write | |
id-token: write | |
jobs: | |
build-c-libraries: | |
name: C Libraries - ${{ matrix.os.name }} ${{ matrix.arch.name }} | |
runs-on: ${{ matrix.os.runs-on[matrix.arch.matrix] }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: | |
- name: macOS | |
matrix: macos | |
runs-on: | |
arm: [macOS, ARM64] | |
intel: [macos-13] | |
- name: Ubuntu | |
matrix: ubuntu | |
runs-on: | |
arm: [Linux, ARM64] | |
intel: [ubuntu-latest] | |
- name: Windows | |
matrix: windows | |
runs-on: | |
intel: [windows-latest] | |
arch: | |
- name: ARM | |
matrix: arm | |
- name: Intel | |
matrix: intel | |
exclude: | |
# Only partial entries are required here by GitHub Actions so generally I | |
# only specify the `matrix:` entry. The super linter complains so for now | |
# all entries are included to avoid that. Reported at | |
# https://github.com/github/super-linter/issues/3016 | |
- os: | |
name: Windows | |
matrix: windows | |
runs-on: | |
intel: [windows-latest] | |
arch: | |
name: ARM | |
matrix: arm | |
steps: | |
- name: Clean workspace | |
uses: Chia-Network/actions/clean-workspace@main | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set Env | |
uses: Chia-Network/actions/setjobenv@main | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Checkout mpir for windows | |
if: matrix.os.matrix == 'windows' | |
uses: actions/checkout@v4 | |
with: | |
repository: Chia-Network/mpir_gc_x64 | |
fetch-depth: 1 | |
path: mpir_gc_x64 | |
- name: Build | |
working-directory: src | |
env: | |
BUILD_VDF_CLIENT: "N" | |
run: | | |
cmake . -DBUILD_CHIAVDFC=ON -DBUILD_PYTHON=OFF | |
cmake --build . | |
- name: Upload artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: c-libraries-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }} | |
path: ./src/lib | |
- name: Assemble directory of headers and libraries for distribution | |
shell: bash | |
run: | | |
DIST_DIR="chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}" | |
echo "DIST_DIR=$DIST_DIR" >> "$GITHUB_ENV" | |
mkdir -p ${DIST_DIR}/static ${DIST_DIR}/shared | |
cp src/c_bindings/c_wrapper.h ${DIST_DIR}/ | |
find src/lib/static -type f -exec cp {} ${DIST_DIR}/static/ \; | |
find src/lib/shared -type f -exec cp {} ${DIST_DIR}/shared/ \; | |
- name: Zip (linux/mac) | |
if: runner.os != 'Windows' | |
run: | | |
zip -r chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}.zip ${{ env.DIST_DIR }} | |
- name: Zip (windows) | |
if: runner.os == 'Windows' | |
run: | | |
Compress-Archive -Path ${{ env.DIST_DIR }}/* -Destination chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}.zip | |
- name: Upload zip as artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }} | |
path: | | |
${{ github.workspace }}/chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}.zip | |
- name: Upload release artifacts | |
if: env.RELEASE == 'true' | |
shell: bash | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh release upload \ | |
$RELEASE_TAG \ | |
chiavdfc-${{ matrix.os.matrix }}-${{ matrix.arch.matrix }}.zip | |
- uses: Chia-Network/actions/github/jwt@main | |
if: env.RELEASE == 'true' | |
- name: Notify new build | |
if: env.RELEASE == 'true' | |
run: | | |
curl -s -XPOST -H "Authorization: Bearer ${{ env.JWT_TOKEN }}" --data '{"release_version":"${{ env.RELEASE_TAG }}"}' ${{ secrets.GLUE_API_URL }}/api/v1/chiavdfc/trigger |