|
| 1 | +name: Build |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + branches: [ "main" ] |
| 6 | + paths-ignore: ["README.md", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md"] |
| 7 | + pull_request: |
| 8 | + branches: [ "main" ] |
| 9 | + paths-ignore: ["README.md", "CODE_OF_CONDUCT.md", "CONTRIBUTING.md"] |
| 10 | + |
| 11 | +env: |
| 12 | + CARGO_TERM_COLOR: always |
| 13 | + RUSTFLAGS: -D warnings |
| 14 | + RUST_BACKTRACE: 1 |
| 15 | + CARGO_INCREMENTAL: 0 |
| 16 | + |
| 17 | +jobs: |
| 18 | + build_on_linux: |
| 19 | + name: Build Catalyst Core on Linux |
| 20 | + runs-on: ubuntu-latest |
| 21 | + env: |
| 22 | + CARGO_FLAGS: --verbose --locked |
| 23 | + steps: |
| 24 | + - name: Checkout code |
| 25 | + uses: actions/checkout@v3 |
| 26 | + with: |
| 27 | + ref: ${{ github.event.pull_request.head.sha }} |
| 28 | + |
| 29 | + - uses: Swatinem/rust-cache@v2 |
| 30 | + |
| 31 | + - name: Install Nextest |
| 32 | + run: curl -LsSf https://get.nexte.st/latest/linux | tar zxf - -C ${CARGO_HOME:-~/.cargo}/bin |
| 33 | + |
| 34 | + - name: Install deps |
| 35 | + run: |
| 36 | + sudo apt install -y protobuf-compiler libssl-dev libpq-dev libsqlite3-dev pkg-config |
| 37 | + |
| 38 | + - name: Build on Linux |
| 39 | + uses: actions-rs/toolchain@v1 |
| 40 | + with: |
| 41 | + toolchain: "1.65" |
| 42 | + - run: cargo build |
| 43 | + |
| 44 | + build_on_windows: |
| 45 | + name: Build Catalyst Core on Windows |
| 46 | + runs-on: windows-latest |
| 47 | + env: |
| 48 | + CARGO_FLAGS: --verbose --locked |
| 49 | + steps: |
| 50 | + - name: Checkout code |
| 51 | + run: | |
| 52 | + echo ${{ github.event.repository.url }} |
| 53 | + echo ${{ github.event.pull_request.head.sha }} |
| 54 | + mkdir C:\\${{ github.event.repository.name }} |
| 55 | + git clone -n -v --progress https://github.com/input-output-hk/${{ github.event.repository.name }}.git C:\\${{ github.event.repository.name }} |
| 56 | + cd C:\\${{ github.event.repository.name }} |
| 57 | + git checkout ${{ github.event.pull_request.head.sha }} |
| 58 | +
|
| 59 | + - name: Allow long paths on Windows |
| 60 | + working-directory: "C:\\${{ github.event.repository.name }}" |
| 61 | + shell: powershell |
| 62 | + run: | |
| 63 | + reg add HKLM\SYSTEM\CurrentControlSet\Control\FileSystem /v LongPathsEnabled /t REG_DWORD /d 1 /f |
| 64 | + git config --system core.longpaths true |
| 65 | +
|
| 66 | + - uses: Swatinem/rust-cache@v2 |
| 67 | + |
| 68 | + - name: Set default linker |
| 69 | + working-directory: "C:\\${{ github.event.repository.name }}" |
| 70 | + run: rustup default stable-x86_64-pc-windows-gnu |
| 71 | + |
| 72 | + - name: Free disk space |
| 73 | + working-directory: "C:\\${{ github.event.repository.name }}" |
| 74 | + shell: powershell |
| 75 | + run: | |
| 76 | + Get-PSDrive |
| 77 | +
|
| 78 | + - name: Install dependencies |
| 79 | + working-directory: "C:\\${{ github.event.repository.name }}" |
| 80 | + run: |
| 81 | + choco install -y protoc openssl sqlite postgresql14 |
| 82 | + |
| 83 | + - name: Set PostgreSQL env variables |
| 84 | + working-directory: "C:\\${{ github.event.repository.name }}" |
| 85 | + shell: powershell |
| 86 | + run: | |
| 87 | + "PQ_LIB_DIR=${env:PROGRAMFILES}\PostgreSQL\14\lib" >> $env:GITHUB_ENV |
| 88 | + - run: | |
| 89 | + $env:PQ_LIB_DIR |
| 90 | +
|
| 91 | + - uses: actions-rs/toolchain@v1 |
| 92 | + with: |
| 93 | + toolchain: "1.65" |
| 94 | + |
| 95 | + - name: Build on Windows |
| 96 | + working-directory: "C:\\${{ github.event.repository.name }}" |
| 97 | + run: cargo build |
0 commit comments