[chore] modify build script #15
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 project | |
on: | |
push: | |
branches: [ ng ] | |
tags: | |
- 'v*' | |
pull_request: | |
branches: [ ng ] | |
jobs: | |
build: | |
strategy: | |
matrix: | |
os: | |
- ubuntu-24.04 | |
version: | |
- 2024.07 | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
submodules: true | |
- name: Cache bsc | |
id: cache-bsc | |
uses: actions/cache@v4 | |
with: | |
path: bsc | |
key: ${{ matrix.os }}-bsc-${{ matrix.version }}-${{ hashFiles('.github/workflows/build.yml') }} | |
- name: Download bsc | |
if: steps.cache-bsc.outputs.cache-hit != 'true' | |
run: | | |
wget -qO- https://github.com/B-Lang-org/bsc/releases/download/${{ matrix.version }}/bsc-${{ matrix.version }}-${{ matrix.os }}.tar.gz | tar xzf - | |
mv bsc-${{ matrix.version }}-${{ matrix.os }} bsc | |
- name: Install bsc-contrib | |
if: steps.cache-bsc.outputs.cache-hit != 'true' | |
run: | | |
export PATH=$PATH:${{ github.workspace }}/bsc/bin | |
git clone https://github.com/B-Lang-org/bsc-contrib.git | |
cd bsc-contrib | |
make -j$(nproc) PREFIX="$PWD/../bsc" | |
cd .. | |
- name: Cache Build Artifacts | |
uses: actions/cache@v4 | |
with: | |
path: build | |
key: build-bsc-${{ matrix.version }}-${{ matrix.os }}-${{ github.run_id }} | |
restore-keys: | | |
build-bsc-${{ matrix.version }}-${{ matrix.os }} | |
- name: Build Project | |
run: | | |
rm -rf build/generated | |
export PATH=$PATH:${{ github.workspace }}/bsc/bin | |
make build | |
mv src/wrapper/* build/generated | |
cat build/generated/* > top.v | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: top | |
path: top.v | |
- name: Upload Artifact | |
uses: actions/upload-artifact@v4 | |
with: | |
name: generated | |
path: build/generated | |
relase: | |
needs: build | |
runs-on: ubuntu-latest | |
if: startsWith(github.ref, 'refs/tags/v') | |
permissions: | |
contents: write | |
id-token: write | |
attestations: write | |
steps: | |
- name: Download Artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
name: top | |
merge-multiple: true | |
- name: Publish release | |
id: publish | |
uses: softprops/action-gh-release@v1 | |
with: | |
fail_on_unmatched_files: true | |
files: | | |
*.v | |
- name: Attest Release Files | |
id: attest | |
uses: actions/attest-build-provenance@v1 | |
with: | |
subject-path: | | |
*.v |