mirror of
https://github.com/YosysHQ/yosys
synced 2026-05-25 03:16:22 +00:00
137 lines
4.4 KiB
YAML
137 lines
4.4 KiB
YAML
name: Test extra build flows
|
|
|
|
on:
|
|
pull_request:
|
|
merge_group:
|
|
#push:
|
|
# branches: [ main ]
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
pre_job:
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
should_skip: ${{ steps.set_output.outputs.should_skip }}
|
|
steps:
|
|
- id: skip_check
|
|
if: ${{ github.event_name != 'merge_group' }}
|
|
uses: fkirc/skip-duplicate-actions@v5
|
|
with:
|
|
# don't run on documentation changes
|
|
paths_ignore: '["**/README.md", "docs/**", "guidelines/**"]'
|
|
# cancel previous builds if a new commit is pushed
|
|
# but never cancel main
|
|
cancel_others: ${{ github.ref != 'refs/heads/main' }}
|
|
|
|
- id: set_output
|
|
run: |
|
|
if [ "${{ github.event_name }}" = "merge_group" ]; then
|
|
echo "should_skip=false" >> $GITHUB_OUTPUT
|
|
else
|
|
echo "should_skip=${{ steps.skip_check.outputs.should_skip }}" >> $GITHUB_OUTPUT
|
|
fi
|
|
|
|
vs-build:
|
|
name: Visual Studio build
|
|
runs-on: windows-latest
|
|
needs: [pre_job]
|
|
if: (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') && needs.pre_job.outputs.should_skip != 'true'
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
submodules: true
|
|
persist-credentials: false
|
|
|
|
- name: Setup MSVC
|
|
uses: ilammy/msvc-dev-cmd@v1
|
|
|
|
- name: Install flex/bison
|
|
shell: pwsh
|
|
run: |
|
|
choco install winflexbison3 --no-progress
|
|
|
|
# Make tools visible to CMake
|
|
echo "C:\Program Files (x86)\GnuWin32\bin" | Out-File -Append -FilePath $env:GITHUB_PATH
|
|
echo "C:\ProgramData\chocolatey\lib\winflexbison3\tools" | Out-File -Append -FilePath $env:GITHUB_PATH
|
|
|
|
- name: Configure CMake
|
|
run: >
|
|
cmake -S . -B build
|
|
-A x64
|
|
-DCMAKE_BUILD_TYPE=Release
|
|
-DYOSYS_WITHOUT_ABC=ON
|
|
|
|
- name: Build
|
|
run: >
|
|
cmake --build build
|
|
--config Release
|
|
--parallel
|
|
|
|
wasi-build:
|
|
name: WASI build
|
|
needs: pre_job
|
|
if: (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') && needs.pre_job.outputs.should_skip != 'true'
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
submodules: true
|
|
persist-credentials: false
|
|
- name: Build
|
|
run: |
|
|
WASI_VER=33
|
|
WASI_SDK=wasi-sdk-${WASI_VER}.0-x86_64-linux
|
|
WASI_SDK_URL=https://github.com/WebAssembly/wasi-sdk/releases/download/wasi-sdk-${WASI_VER}/${WASI_SDK}.tar.gz
|
|
if ! [ -d ${WASI_SDK} ]; then curl -L ${WASI_SDK_URL} | tar xzf -; fi
|
|
WASI_SDK_PATH=$(pwd)/${WASI_SDK}
|
|
FLEX_VER=2.6.4
|
|
FLEX=flex-${FLEX_VER}
|
|
FLEX_URL=https://github.com/westes/flex/releases/download/v${FLEX_VER}/${FLEX}.tar.gz
|
|
if ! [ -d ${FLEX} ]; then curl -L ${FLEX_URL} | tar xzf -; fi
|
|
|
|
mkdir -p flex-build
|
|
(cd flex-build &&
|
|
../${FLEX}/configure --prefix=$(pwd)/../flex-prefix &&
|
|
make &&
|
|
make install)
|
|
|
|
export PATH=${WASI_SDK_PATH}/bin:$(pwd)/flex-prefix/bin:${PATH}
|
|
cmake -B build -DCMAKE_TOOLCHAIN_FILE=${WASI_SDK_PATH}/share/cmake/wasi-sdk-p1.cmake -DCMAKE_BUILD_TYPE=Release .
|
|
cmake --build build -j$(nproc)
|
|
|
|
nix-build:
|
|
name: "Build nix flake"
|
|
needs: pre_job
|
|
if: (github.event_name == 'merge_group' || github.event_name == 'workflow_dispatch') && needs.pre_job.outputs.should_skip != 'true'
|
|
runs-on: ${{ matrix.os }}
|
|
strategy:
|
|
matrix:
|
|
os: [ubuntu-latest, macos-latest]
|
|
fail-fast: false
|
|
steps:
|
|
- uses: actions/checkout@v5
|
|
with:
|
|
submodules: true
|
|
persist-credentials: false
|
|
- uses: cachix/install-nix-action@v31
|
|
with:
|
|
install_url: https://releases.nixos.org/nix/nix-2.30.0/install
|
|
- run: nix build .?submodules=1 -L
|
|
|
|
extra-builds-result:
|
|
runs-on: ubuntu-latest
|
|
needs:
|
|
- vs-build
|
|
- wasi-build
|
|
- nix-build
|
|
if: always()
|
|
steps:
|
|
- name: Check results
|
|
run: |
|
|
echo "Needs results: ${{ join(needs.*.result, ',') }}"
|
|
if [[ "${{ join(needs.*.result, ',') }}" == *failure* ]] || \
|
|
[[ "${{ join(needs.*.result, ',') }}" == *cancelled* ]]; then
|
|
echo "Some jobs failed or were cancelled"
|
|
exit 1
|
|
fi
|
|
- run: echo "All good"
|