ci #302
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
| name: ci | |
| on: | |
| push: | |
| branches: | |
| - main | |
| - release | |
| pull_request: | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| env: | |
| CABAL_VERS: "3.12" | |
| GHC_VERS: "9.12.2" | |
| CABAL_PROJ: "cabal.ghc9122.project" | |
| CHARON_VERS: "0.1" | |
| jobs: | |
| cabal: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| ghc: | |
| - vers: "9.6.6" | |
| proj_file: "" | |
| - vers: "9.8.4" | |
| proj_file: "" | |
| - vers: "9.10.2" | |
| proj_file: "" | |
| - vers: "9.12.2" | |
| proj_file: "--project-file cabal.ghc9122.project" | |
| platform: | |
| - os: "macos-latest" | |
| unit-trials: 10000 | |
| int-trials: 1000 | |
| - os: "ubuntu-latest" | |
| unit-trials: 10000 | |
| int-trials: 1000 | |
| - os: "windows-latest" | |
| unit-trials: 1000 | |
| int-trials: 1000 | |
| runs-on: ${{ matrix.platform.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: haskell-actions/setup@v2 | |
| with: | |
| ghc-version: ${{ matrix.ghc.vers }} | |
| - name: Configure | |
| run: cabal configure ${{ matrix.ghc.proj_file }} --enable-tests --enable-benchmarks --ghc-options -Werror | |
| - name: Compile | |
| run: cabal build ${{ matrix.ghc.proj_file }} charon:exe:charon | |
| - name: Unit Tests | |
| id: unit | |
| run: | | |
| cabal test ${{ matrix.ghc.proj_file }} unit --test-options '--hedgehog-tests ${{ matrix.platform.unit-trials }}' | |
| - uses: actions/upload-artifact@v4 | |
| name: Unit Tests Upload | |
| if: ${{ failure() && steps.unit.conclusion == 'failure' }} | |
| with: | |
| name: unit-artifacts_${{ matrix.platform.os }}_${{ matrix.ghc.vers }} | |
| path: test/unit/Unit/Data/Index/*actual | |
| retention-days: 1 | |
| - name: Integration Tests | |
| shell: bash | |
| run: | | |
| export INT_LOGS=1 | |
| cabal test integration ${{ matrix.ghc.proj_file }} --test-options '--hedgehog-tests ${{ matrix.platform.int-trials }} --hedgehog-discards 10000' | |
| - name: Functional Tests | |
| id: functional | |
| run: cabal test functional ${{ matrix.ghc.proj_file }} --test-options '--size-cutoff 100000' | |
| - uses: actions/upload-artifact@v4 | |
| name: Functional Tests Upload | |
| if: ${{ failure() && steps.functional.conclusion == 'failure' }} | |
| with: | |
| name: functional-artifacts_${{ matrix.platform.os }}_${{ matrix.ghc.vers }} | |
| path: test/functional/goldens/*actual | |
| retention-days: 1 | |
| - name: Benchmarks | |
| if: ${{ matrix.platform.os == 'ubuntu-latest' }} | |
| id: bench | |
| run: | | |
| cabal bench ${{ matrix.ghc.proj_file }} --benchmark-options ' | |
| --csv benchmarks/${{ matrix.platform.os }}_${{ matrix.ghc.vers }}_ci.csv | |
| --svg benchmarks/${{ matrix.platform.os }}_${{ matrix.ghc.vers }}_ci.svg | |
| --baseline benchmarks/baseline_${{ matrix.platform.os }}_${{ matrix.ghc.vers }}_ci.csv | |
| --fail-if-slower 50 | |
| --fail-if-faster 50' | |
| - uses: actions/upload-artifact@v4 | |
| name: Benchmarks Upload | |
| if: ${{ failure() && steps.bench.conclusion == 'failure' }} | |
| with: | |
| name: build-artifacts_${{ matrix.platform.os }}_${{ matrix.ghc.vers }} | |
| path: | | |
| benchmarks/${{ matrix.platform.os }}_${{ matrix.ghc.vers }}_ci.csv | |
| benchmarks/${{ matrix.platform.os }}_${{ matrix.ghc.vers }}_ci.svg | |
| retention-days: 1 | |
| nix: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| os: | |
| - "macos-latest" | |
| - "ubuntu-latest" | |
| runs-on: ${{ matrix.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup nix | |
| uses: cachix/install-nix-action@v30 | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| - name: Compile & Test | |
| run: nix build -Lv | |
| lint: | |
| runs-on: "ubuntu-latest" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup nix | |
| uses: cachix/install-nix-action@v30 | |
| with: | |
| github_access_token: ${{ secrets.GITHUB_TOKEN }} | |
| nix_path: nixpkgs=channel:nixos-unstable | |
| - name: Formatting | |
| run: | | |
| nix run .#format | |
| git diff --exit-code --color=always | |
| - name: Lint | |
| run: | | |
| nix run .#lint | |
| release: | |
| needs: [cabal, nix, lint] | |
| if: github.ref == 'refs/heads/release' | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| platform: | |
| - name: "macos-13" | |
| os: "macos-13" | |
| script: ".github/scripts/release_osx.sh" | |
| script_args: "" | |
| - name: "macos-14" | |
| os: "macos-14" | |
| script: ".github/scripts/release_osx.sh" | |
| script_args: "" | |
| - name: "macos-15" | |
| os: "macos-15" | |
| script: ".github/scripts/release_osx.sh" | |
| script_args: "" | |
| - name: "alpine_amd64" | |
| os: "ubuntu-24.04" | |
| script: ".github/scripts/release_linux.sh" | |
| script_args: "alpine_amd64" | |
| - name: "alpine_arm64v8" | |
| os: "ubuntu-24.04-arm" | |
| script: ".github/scripts/release_linux.sh" | |
| script_args: "alpine_arm64v8" | |
| - name: "windows-2025" | |
| os: "windows-2025" | |
| script: ".github/scripts/release_windows.sh" | |
| script_args: "2025" | |
| - name: "windows-2022" | |
| os: "windows-2022" | |
| script: ".github/scripts/release_windows.sh" | |
| script_args: "2022" | |
| runs-on: ${{ matrix.platform.os }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Verify env vars | |
| run: .github/scripts/verify_env.sh | |
| - uses: docker/setup-docker-action@v4 | |
| if: ${{ matrix.platform.name == 'alpine_amd64' || matrix.platform.name == 'alpine_arm64v8' }} | |
| # So we have sha256sum | |
| - name: Install coreutils | |
| if: ${{ matrix.platform.os == 'macos-13' || matrix.platform.os == 'macos-14' }} | |
| run: brew install coreutils | |
| - uses: haskell-actions/setup@v2 | |
| if: ${{ matrix.platform.name != 'alpine_amd64' && matrix.platform.name != 'alpine_arm64v8' }} | |
| with: | |
| ghc-version: ${{ env.GHC_VERS }} | |
| cabal-version: ${{ env.CABAL_VERS }} | |
| - name: Install binary | |
| shell: bash | |
| run: | | |
| ${{ matrix.platform.script }} ${{ matrix.platform.script_args }} | |
| - name: Upload binary | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: release-artifacts-${{ matrix.platform.name }} | |
| path: charon*.zip | |
| retention-days: 1 | |
| merge-releases: | |
| runs-on: "ubuntu-latest" | |
| needs: release | |
| steps: | |
| - name: Merge Artifacts | |
| uses: actions/upload-artifact/merge@v4 | |
| with: | |
| name: release-artifacts | |
| pattern: release-artifacts-* | |
| delete-merged: true | |
| retention-days: 1 |