[ci] feat: add GitHub actions workflows for building/testing/docs (#2)
* disable windows runner for now (chocolatey jack package is broken) * install jack and pcre from homebrew for macOS workflow * install libjack-jackd2-dev libpcre3-dev for linux workflow * add additional libjack location candidate for macOS / homebrew * make library name patterns const strings Signed-off-by: Christopher Arndt <chris@chrisarndt.de>
This commit is contained in:
		
							parent
							
								
									f05bbbd294
								
							
						
					
					
						commit
						ca918769ec
					
				
							
								
								
									
										58
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										58
									
								
								.github/workflows/build.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,58 @@
 | 
				
			|||||||
 | 
					name: Run tests and build examples
 | 
				
			||||||
 | 
					on: [push, pull_request]
 | 
				
			||||||
 | 
					env:
 | 
				
			||||||
 | 
					  nim_version: "2.2.0"
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  build:
 | 
				
			||||||
 | 
					    strategy:
 | 
				
			||||||
 | 
					      fail-fast: false
 | 
				
			||||||
 | 
					      matrix:
 | 
				
			||||||
 | 
					        os: [ubuntu-latest, macos-latest]
 | 
				
			||||||
 | 
					        #os: [ubuntu-latest, macos-latest, windows-latest]
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    runs-on: ${{ matrix.os }}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      - name: Check out sources
 | 
				
			||||||
 | 
					        uses: actions/checkout@v4
 | 
				
			||||||
 | 
					      - name: Nim Runtime Cache
 | 
				
			||||||
 | 
					        id: cache-nim
 | 
				
			||||||
 | 
					        uses: actions/cache@v4
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          path: ".nim_runtime"
 | 
				
			||||||
 | 
					          key: ${{ runner.os }}-nim-${{ env.nim_version }}
 | 
				
			||||||
 | 
					      - name: Install Nim
 | 
				
			||||||
 | 
					        id: install-nim
 | 
				
			||||||
 | 
					        if: ${{ hashFiles('.nim_runtime/bin/nim*') == '' }}
 | 
				
			||||||
 | 
					        uses: jiro4989/setup-nim-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          nim-version: ${{ env.nim_version }}
 | 
				
			||||||
 | 
					          repo-token: ${{ secrets.GITHUB_TOKEN }}
 | 
				
			||||||
 | 
					      - name: Set PATH for Unix
 | 
				
			||||||
 | 
					        if: ${{ runner.os != 'Windows' && steps.install-nim.outcome == 'skipped' }}
 | 
				
			||||||
 | 
					        shell: bash
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          echo "$(pwd)/.nim_runtime/bin" >> "$GITHUB_PATH"
 | 
				
			||||||
 | 
					          echo "$HOME/.nimble/bin" >> "$GITHUB_PATH"
 | 
				
			||||||
 | 
					      - name: Set PATH for Windows
 | 
				
			||||||
 | 
					        if: ${{ runner.os == 'Windows' && steps.install-nim.outcome == 'skipped' }}
 | 
				
			||||||
 | 
					        shell: pwsh
 | 
				
			||||||
 | 
					        run: |
 | 
				
			||||||
 | 
					          echo "$(Get-Location)\.nim_runtime\bin" >> $Env:GITHUB_PATH
 | 
				
			||||||
 | 
					          mkdir -Force ~\.nimble\bin
 | 
				
			||||||
 | 
					          (Resolve-Path ~\.nimble\bin).Path >> $Env:GITHUB_PATH
 | 
				
			||||||
 | 
					      - name: Install dependency packages (jack)
 | 
				
			||||||
 | 
					        uses: ConorMacBride/install-package@v1
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          brew: jack pcre
 | 
				
			||||||
 | 
					          apt: libjack-jackd2-dev libpcre3-dev
 | 
				
			||||||
 | 
					          choco: jack
 | 
				
			||||||
 | 
					      - name: Update PATH (Windows)
 | 
				
			||||||
 | 
					        if: runner.os == 'Windows'
 | 
				
			||||||
 | 
					        run: Add-Content $env:GITHUB_PATH "C:\Program Files\jack\bin"
 | 
				
			||||||
 | 
					      - name: Run tests
 | 
				
			||||||
 | 
					        run: nimble test -y
 | 
				
			||||||
 | 
					      - name: Build examples (debug)
 | 
				
			||||||
 | 
					        run: nimble examples_debug
 | 
				
			||||||
 | 
					      - name: Build examples (release)
 | 
				
			||||||
 | 
					        run: nimble examples
 | 
				
			||||||
							
								
								
									
										26
									
								
								.github/workflows/docs.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							
							
						
						
									
										26
									
								
								.github/workflows/docs.yml
									
									
									
									
										vendored
									
									
										Normal file
									
								
							@ -0,0 +1,26 @@
 | 
				
			|||||||
 | 
					name: Build and publish API docs
 | 
				
			||||||
 | 
					on:
 | 
				
			||||||
 | 
					  push:
 | 
				
			||||||
 | 
					    branches:
 | 
				
			||||||
 | 
					      - master
 | 
				
			||||||
 | 
					env:
 | 
				
			||||||
 | 
					  nim-version: "stable"
 | 
				
			||||||
 | 
					  nim-src: src/jacket.nim
 | 
				
			||||||
 | 
					  deploy-dir: .gh-pages
 | 
				
			||||||
 | 
					jobs:
 | 
				
			||||||
 | 
					  docs:
 | 
				
			||||||
 | 
					    runs-on: ubuntu-latest
 | 
				
			||||||
 | 
					    steps:
 | 
				
			||||||
 | 
					      - uses: actions/checkout@v4
 | 
				
			||||||
 | 
					      - uses: jiro4989/setup-nim-action@v2
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          nim-version: ${{ env.nim-version }}
 | 
				
			||||||
 | 
					      - run: nimble install -y
 | 
				
			||||||
 | 
					      - run: nimble doc --index:on --project --git.url:https://github.com/${{ github.repository }} --git.commit:master --out:${{ env.deploy-dir }} ${{ env.nim-src }}
 | 
				
			||||||
 | 
					      - name: "Copy to index.html"
 | 
				
			||||||
 | 
					        run: cp ${{ env.deploy-dir }}/jacket.html ${{ env.deploy-dir }}/index.html
 | 
				
			||||||
 | 
					      - name: Deploy documents
 | 
				
			||||||
 | 
					        uses: peaceiris/actions-gh-pages@v4
 | 
				
			||||||
 | 
					        with:
 | 
				
			||||||
 | 
					          github_token: ${{ secrets.GITHUB_TOKEN }}
 | 
				
			||||||
 | 
					          publish_dir: ${{ env.deploy-dir }}
 | 
				
			||||||
@ -2,18 +2,17 @@
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
# Possible names/install locations of libjack, according to:
 | 
					# Possible names/install locations of libjack, according to:
 | 
				
			||||||
# https://github.com/x42/weakjack/blob/master/weak_libjack.c#L108
 | 
					# https://github.com/x42/weakjack/blob/master/weak_libjack.c#L108
 | 
				
			||||||
proc getJackLibName: string =
 | 
					when defined(windows):
 | 
				
			||||||
    when system.hostOS == "windows":
 | 
					 | 
				
			||||||
    when sizeof(int) == 4:
 | 
					    when sizeof(int) == 4:
 | 
				
			||||||
            result = "libjack.dll"
 | 
					        const soname = "(|lib)jack.dll"
 | 
				
			||||||
    else:
 | 
					    else:
 | 
				
			||||||
            result = "libjack64.dll"
 | 
					        const soname = "(|lib)jack64.dll"
 | 
				
			||||||
    elif system.hostOS == "macosx":
 | 
					elif defined(macosx):
 | 
				
			||||||
        result = "(|/usr/local/lib/|/opt/homebrew/lib/|/opt/local/lib/)libjack.dylib"
 | 
					    const soname = "(|/usr/local/lib/|/opt/homebrew/lib/|/opt/homebrew/opt/jack/lib/|/opt/local/lib/)libjack.dylib"
 | 
				
			||||||
else:
 | 
					else:
 | 
				
			||||||
        result = "libjack.so.0"
 | 
					    const soname = "libjack.so.0"
 | 
				
			||||||
 | 
					
 | 
				
			||||||
{.push dynlib: getJackLibName().}
 | 
					{.push dynlib: soname.}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# ------------------------------ Constants --------------------------------
 | 
					# ------------------------------ Constants --------------------------------
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
				
			|||||||
		Loading…
	
	
			
			x
			
			
		
	
		Reference in New Issue
	
	Block a user