CI #1244
This file contains hidden or 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
| # This is a basic workflow to help you get started with Actions | |
| name: CI | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| schedule: | |
| - cron: '0 0 * * *' #Makes sense, we are testing against master | |
| workflow_dispatch: | |
| jobs: | |
| build: | |
| strategy: | |
| matrix: | |
| os: [ubuntu-latest, macos-latest, windows-latest] | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| # Create postgres server | |
| # https://github.com/marketplace/actions/setup-postgresql-for-linux-macos-windows | |
| - uses: ikalnytskyi/action-setup-postgres@v7 | |
| # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it | |
| - uses: actions/checkout@v4 | |
| with: | |
| submodules: true | |
| - name: Setup Zig | |
| uses: mlugg/setup-zig@v2 | |
| with: | |
| version: master | |
| - run: zig version | |
| - run: zig env | |
| - name: Build | |
| run: zig build --verbose | |
| - name: Run Tests | |
| run: zig build test --summary all | |
| - name: Run App Tests | |
| run: | | |
| cd demo | |
| zig build -Denvironment=testing jetzig:database:create | |
| zig build -Denvironment=testing jetzig:database:migrate | |
| zig build -Denvironment=testing jetzig:test | |
| env: | |
| JETQUERY_HOSTNAME: 'localhost' | |
| JETQUERY_USERNAME: 'postgres' | |
| JETQUERY_PASSWORD: 'postgres' | |
| JETQUERY_DATABASE: 'jetzig_demo_test' | |
| # Assume a small amount of connections are allowed | |
| # into postgres | |
| JETQUERY_POOL_SIZE: 2 | |
| - name: Build artifacts | |
| if: ${{ matrix.os == 'ubuntu-latest' }} | |
| run: | | |
| declare -a targets=("x86_64-windows" "x86_64-linux" "x86_64-macos" "aarch64-macos") | |
| mkdir -p "artifacts/" | |
| root=$(pwd) | |
| cd cli | |
| for target in "${targets[@]}"; do | |
| mkdir -p $root/artifacts/$target | |
| echo "Building target ${target}..." | |
| if ! zig build -Dtarget=${target} -Doptimize=ReleaseSafe --prefix $root/artifacts/${target}/; then | |
| exit 1 | |
| fi | |
| sed -e '1,5d' < $root/README.md > $root/artifacts/${target}/README.md | |
| cp $root/LICENSE $root/artifacts/${target}/ | |
| done | |
| wait | |
| - name: Upload artifacts Target Windows | |
| if: ${{ matrix.os == 'ubuntu-latest' && !contains(fromJSON('["pull_request"]'), github.event_name) }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-windows | |
| path: artifacts/x86_64-windows | |
| - name: Upload artifacts Target Linux | |
| if: ${{ matrix.os == 'ubuntu-latest' && !contains(fromJSON('["pull_request"]'), github.event_name) }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-linux | |
| path: artifacts/x86_64-linux | |
| - name: Upload artifacts Target MacOS | |
| if: ${{ matrix.os == 'ubuntu-latest' && !contains(fromJSON('["pull_request"]'), github.event_name) }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-macos-x86 | |
| path: artifacts/x86_64-macos | |
| - name: Upload artifacts Target MacOS 2 | |
| if: ${{ matrix.os == 'ubuntu-latest' && !contains(fromJSON('["pull_request"]'), github.event_name) }} | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: build-macos-aarch64 | |
| path: artifacts/aarch64-macos |