diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 000000000..744766b31 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,65 @@ +on: + push: + branches: [main] + tags: + - 'v*' + +name: build +jobs: + build: + name: Build Koka + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [ubuntu-latest] #, macOS-latest] + steps: + - uses: actions/checkout@v4 + + - uses: haskell-actions/setup@v2 + with: + enable-stack: true + stack-version: 'latest' + - run: | + stack config set system-ghc --global true + stack config set install-ghc --global false + + - name: List dependencies + run: stack ls dependencies json | jq > stack-deps.json + + - name: Restore cached dependency of Pantry (Stackage package index) + uses: actions/cache/restore@v4 + id: pantry + env: + key: ghc-${{ steps.setup.outputs.ghc-version }}-stack-${{ steps.setup.outputs.stack-version }} + with: + path: ${{ steps.setup.outputs.stack-root }}/pantry + key: all-plan-${{ hashFiles('stack-deps.json') }} + restore-keys: all + + - name: Recompute Stackage package index (~/.stack/pantry) + if: steps.pantry.outputs.cache-hit != 'true' + run: stack update + + - name: Stack lock check + run: stack build --dry-run --lock-file=error-on-write + + - name: Build + run: stack build + + - name: Run Koka Packaging + run: | + stack exec koka -- -e -O2 util/bundle + + - name: Release + uses: softprops/action-gh-release@v1 + with: + files: | + bundle/*.tar.gz + + - name: Save cached dependencies of Pantry + uses: actions/cache/save@v4 + if: steps.pantry.outputs.cache-hit != 'true' + with: + path: ${{ steps.setup.outputs.stack-root }}/pantry + key: ${{ steps.pantry.outputs.cache-primary-key }} + make_latest: true