mirror of
https://github.com/YosysHQ/yosys
synced 2026-07-16 12:15:52 +00:00
Merge pull request #198 from Silimate/ci_tweaks
ci: cache build instead of using artifacts
This commit is contained in:
commit
d578dafc82
4 changed files with 105 additions and 86 deletions
123
.github/workflows/release.yml
vendored
123
.github/workflows/release.yml
vendored
|
|
@ -22,6 +22,13 @@ jobs:
|
|||
persist-credentials: false
|
||||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
|
||||
- name: Cache Dist Directory
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: dist-x86_64-musllinux
|
||||
key: ${{ github.run_id }}-x86_64-musllinux-wheel
|
||||
enableCrossOsArchive: true
|
||||
|
||||
- name: Build wheel in Alpine container
|
||||
run: |
|
||||
docker run --rm \
|
||||
|
|
@ -51,15 +58,10 @@ jobs:
|
|||
|
||||
# Build the wheel via setup.py
|
||||
pip install --break-system-packages pybind11 cxxheaderparser
|
||||
mkdir -p /src/dist
|
||||
python3 -m pip wheel . --wheel-dir /src/dist
|
||||
mkdir -p /src/dist-x86_64-musllinux
|
||||
python3 -m pip wheel . --wheel-dir /src/dist-x86_64-musllinux
|
||||
'
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-musl-wheel
|
||||
path: dist/*.whl
|
||||
|
||||
build-manylinux-wheel:
|
||||
runs-on: ubuntu-latest
|
||||
name: Build Linux amd64 wheel (manylinux2014, glibc 2.17+)
|
||||
|
|
@ -71,6 +73,13 @@ jobs:
|
|||
submodules: recursive
|
||||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
|
||||
- name: Cache Dist Directory
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: dist-x86_64-manylinux
|
||||
key: ${{ github.run_id }}-x86_64-manylinux-wheel
|
||||
enableCrossOsArchive: true
|
||||
|
||||
- name: Build wheel in manylinux2014 container
|
||||
run: |
|
||||
docker run --rm \
|
||||
|
|
@ -110,22 +119,18 @@ jobs:
|
|||
make
|
||||
cd /src
|
||||
|
||||
WHEEL_DIR=/src/dist-x86_64-manylinux
|
||||
pip3 install --upgrade pip setuptools wheel pybind11 cxxheaderparser
|
||||
mkdir -p dist-manylinux
|
||||
python3 -m pip wheel . --wheel-dir /src/dist-manylinux
|
||||
python3 -m pip wheel . --wheel-dir $WHEEL_DIR
|
||||
|
||||
# Tag wheel as manylinux2014
|
||||
pip3 install auditwheel || true
|
||||
for whl in /src/dist-manylinux/*.whl; do
|
||||
auditwheel repair "$whl" --plat manylinux2014_x86_64 -w /src/dist-manylinux/ 2>/dev/null || true
|
||||
for whl in $WHEEL_DIR/*.whl; do
|
||||
auditwheel repair "$whl" --plat manylinux2014_x86_64 -w $WHEEL_DIR/ 2>/dev/null || true
|
||||
done
|
||||
'
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: linux-manylinux-wheel
|
||||
path: dist-manylinux/*.whl
|
||||
|
||||
build-macos-wheel:
|
||||
runs-on: macos-15
|
||||
name: Build macOS arm64 wheel
|
||||
|
|
@ -155,49 +160,76 @@ jobs:
|
|||
cd verific/tclmain
|
||||
make
|
||||
|
||||
- name: Cache Dist Directory
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: dist-aarch64-macos
|
||||
key: ${{ github.run_id }}-aarch64-macos-wheel
|
||||
enableCrossOsArchive: true
|
||||
|
||||
- name: Build wheel
|
||||
run: |
|
||||
export PATH="$(brew --prefix bison)/bin:$(brew --prefix flex)/bin:$PATH"
|
||||
export MACOSX_DEPLOYMENT_TARGET=11.0
|
||||
mkdir -p dist
|
||||
python3 -m pip wheel . --wheel-dir dist
|
||||
|
||||
- uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: macos-wheel
|
||||
path: dist/*.whl
|
||||
python3 -m pip wheel . --wheel-dir dist-aarch64-macos
|
||||
|
||||
release:
|
||||
# allow testing outside main branch
|
||||
if: github.ref_name == 'main'
|
||||
# if: github.ref_name == 'main'
|
||||
runs-on: ubuntu-latest
|
||||
needs: [build-linux-wheel, build-manylinux-wheel, build-macos-wheel]
|
||||
name: Create GitHub releases
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Download artifacts
|
||||
uses: actions/download-artifact@v4
|
||||
with:
|
||||
path: all-wheels
|
||||
merge-multiple: true
|
||||
|
||||
- name: Generate release notes
|
||||
id: meta
|
||||
- id: meta
|
||||
name: Get repo metadata and clean up
|
||||
run: |
|
||||
SHORT_SHA=$(git rev-parse --short HEAD)
|
||||
FULL_SHA=$(git rev-parse HEAD)
|
||||
DATE=$(date -u +%Y-%m-%d)
|
||||
echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"
|
||||
echo "date=$DATE" >> "$GITHUB_OUTPUT"
|
||||
REPO_URL="${{ github.server_url }}/${{ github.repository }}"
|
||||
echo "short_sha=$SHORT_SHA" >> "$GITHUB_OUTPUT"
|
||||
echo "full_sha=$FULL_SHA" >> "$GITHUB_OUTPUT"
|
||||
echo "date=$DATE" >> "$GITHUB_OUTPUT"
|
||||
echo "repo_url=$REPO_URL" >> "$GITHUB_OUTPUT"
|
||||
rm -rf ./* ./.*
|
||||
- uses: actions/checkout@v6
|
||||
with:
|
||||
repository: silimate/yosys-wheels
|
||||
ssh-key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
fetch-depth: 0
|
||||
- name: Restore dist from cache (x86_64-musllinux)
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: dist-x86_64-musllinux
|
||||
key: ${{ github.run_id }}-x86_64-musllinux-wheel
|
||||
enableCrossOsArchive: true
|
||||
fail-on-cache-miss: true
|
||||
- name: Restore dist from cache (x86_64-manylinux)
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: dist-x86_64-manylinux
|
||||
key: ${{ github.run_id }}-x86_64-manylinux-wheel
|
||||
enableCrossOsArchive: true
|
||||
fail-on-cache-miss: true
|
||||
- name: Restore dist from cache (aarch64-macos)
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: dist-aarch64-macos
|
||||
key: ${{ github.run_id }}-aarch64-macos-wheel
|
||||
enableCrossOsArchive: true
|
||||
fail-on-cache-miss: true
|
||||
- name: Update release notes
|
||||
run: |
|
||||
printf '%s\n' \
|
||||
"Automated build from \`main\` @ [\`${SHORT_SHA}\`](${REPO_URL}/commit/${FULL_SHA})" \
|
||||
"Automated build from \`main\` @ [\`${{ steps.meta.outputs.short_sha }}\`](${{ steps.meta.outputs.repo_url }}/commit/${{ steps.meta.outputs.full_sha }})" \
|
||||
"" \
|
||||
"**Built:** ${DATE}" \
|
||||
"**Built:** ${{ steps.meta.outputs.date }}" \
|
||||
"" \
|
||||
"### Assets" \
|
||||
"| File | Platform |" \
|
||||
|
|
@ -211,17 +243,22 @@ jobs:
|
|||
"pip install pyosys-*.whl" \
|
||||
"\`\`\`" \
|
||||
> release_notes.md
|
||||
|
||||
- name: Commit and push
|
||||
run: |
|
||||
git config user.name "github-actions[bot]"
|
||||
git config user.email "github-actions[bot]@users.noreply.github.com"
|
||||
git commit --all --message="Build for ${{ steps.meta.outputs.date }}-${{ steps.meta.outputs.short_sha }}"
|
||||
git push
|
||||
- name: Create permanent release
|
||||
run: |
|
||||
TAG="build-${{ steps.meta.outputs.date }}-${{ steps.meta.outputs.short_sha }}"
|
||||
gh release create "$TAG" \
|
||||
all-wheels/*.whl \
|
||||
--target "${{ github.sha }}" \
|
||||
dist-*/*.whl \
|
||||
--target "$(git rev-parse HEAD)" \
|
||||
--title "Build ${{ steps.meta.outputs.date }} (${{ steps.meta.outputs.short_sha }})" \
|
||||
--notes-file release_notes.md
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_TOKEN: ${{ secrets.YOSYS_WHEELS_TOKEN }}
|
||||
|
||||
- name: Update latest release
|
||||
run: |
|
||||
|
|
@ -229,10 +266,10 @@ jobs:
|
|||
git push -f origin latest
|
||||
gh release delete latest --yes 2>/dev/null || true
|
||||
gh release create latest \
|
||||
all-wheels/*.whl \
|
||||
--target "${{ github.sha }}" \
|
||||
dist-*/*.whl \
|
||||
--target "$(git rev-parse HEAD)" \
|
||||
--title "Latest Build (${{ steps.meta.outputs.date }})" \
|
||||
--notes-file release_notes.md \
|
||||
--prerelease
|
||||
env:
|
||||
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
GH_TOKEN: ${{ secrets.YOSYS_WHEELS_TOKEN }}
|
||||
|
|
|
|||
63
.github/workflows/test-build.yml
vendored
63
.github/workflows/test-build.yml
vendored
|
|
@ -90,7 +90,13 @@ jobs:
|
|||
key: test-build-${{ matrix.os }}
|
||||
save: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }}
|
||||
restore-keys: |
|
||||
test-build-${{ matrix.os }}-
|
||||
test-build-${{ matrix.os }}
|
||||
|
||||
- name: Cache Build Directory
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
path: build
|
||||
key: ${{ runner.os }}-build-${{ github.run_id }}
|
||||
|
||||
- name: Build
|
||||
shell: bash
|
||||
|
|
@ -104,19 +110,6 @@ jobs:
|
|||
run: |
|
||||
./build/yosys-config || true
|
||||
|
||||
- name: Compress build
|
||||
shell: bash
|
||||
run: |
|
||||
cd build
|
||||
tar -cvf ../build.tar share/ yosys yosys-*
|
||||
|
||||
- name: Store build artifact
|
||||
uses: actions/upload-artifact@v7
|
||||
with:
|
||||
name: build-${{ matrix.os }}
|
||||
path: build.tar
|
||||
retention-days: 1
|
||||
|
||||
test-yosys:
|
||||
name: Run tests
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
|
@ -142,16 +135,12 @@ jobs:
|
|||
get-build-deps: true
|
||||
get-iverilog: true
|
||||
|
||||
- name: Download build artifact
|
||||
uses: actions/download-artifact@v8
|
||||
- name: Restore Build Directory from Cache
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
name: build-${{ matrix.os }}
|
||||
|
||||
- name: Uncompress build
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p build
|
||||
tar -xvf build.tar -C build
|
||||
path: build
|
||||
key: ${{ runner.os }}-build-${{ github.run_id }}
|
||||
fail-on-cache-miss: true
|
||||
|
||||
- name: Log yosys-config output
|
||||
run: |
|
||||
|
|
@ -192,19 +181,17 @@ jobs:
|
|||
with:
|
||||
runs-on: ${{ matrix.os }}
|
||||
|
||||
- name: Download build artifact
|
||||
uses: actions/download-artifact@v8
|
||||
- name: Restore Build Directory from Cache
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
name: build-${{ matrix.os }}
|
||||
|
||||
- name: Uncompress build
|
||||
shell: bash
|
||||
run:
|
||||
tar -xvf build.tar
|
||||
path: build
|
||||
key: ${{ runner.os }}-build-${{ github.run_id }}
|
||||
fail-on-cache-miss: true
|
||||
|
||||
- name: test_cell
|
||||
shell: bash
|
||||
run: |
|
||||
cd build
|
||||
./yosys -p 'test_cell -n 20 -s 1 all'
|
||||
./yosys -p 'test_cell -n 20 -s 1 -nosat -aigmap $pow $pmux'
|
||||
./yosys -p 'test_cell -n 20 -s 1 -nosat -aigmap $eqx $nex $bweqx'
|
||||
|
|
@ -233,16 +220,12 @@ jobs:
|
|||
get-build-deps: true
|
||||
get-docs-deps: true
|
||||
|
||||
- name: Download build artifact
|
||||
uses: actions/download-artifact@v8
|
||||
- name: Restore Build Directory from Cache
|
||||
uses: actions/cache@v6
|
||||
with:
|
||||
name: build-${{ matrix.os }}
|
||||
|
||||
- name: Uncompress build
|
||||
shell: bash
|
||||
run: |
|
||||
mkdir -p build
|
||||
tar -xvf build.tar -C build
|
||||
path: build
|
||||
key: ${{ runner.os }}-build-${{ github.run_id }}
|
||||
fail-on-cache-miss: true
|
||||
|
||||
- name: Log yosys-config output
|
||||
run: |
|
||||
|
|
|
|||
|
|
@ -29,7 +29,6 @@ pkgs.mkShell {
|
|||
iverilog # tests
|
||||
gtkwave # vcd2fst
|
||||
(python3.withPackages(ps: with ps; [pip wheel pybind11 cxxheaderparser]))
|
||||
gnu-ar
|
||||
gtest
|
||||
] ++ lib.optionals stdenv.isLinux [
|
||||
elfutils # provides libdw.so (not to be confused with libdwarf.so)
|
||||
|
|
|
|||
|
|
@ -7,10 +7,10 @@ proc read_stats { file } {
|
|||
set ports 0
|
||||
set nets 0
|
||||
foreach line [split $result "\n"] {
|
||||
if [regexp {Number of wires:[ \t]+([0-9]+)} $line tmp n] {
|
||||
if [regexp {\s([0-9]+) wires} $line tmp n] {
|
||||
set nets [expr $nets + $n]
|
||||
}
|
||||
if [regexp {Number of ports:[ \t]+([0-9]+)} $line tmp n] {
|
||||
if [regexp {(\s[0-9]+) ports} $line tmp n] {
|
||||
set ports [expr $ports + $n]
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue