ci: fix call to upx #140
This file contains 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: main | |
env: | |
LANG: C.UTF-8 | |
GH_TOKEN: ${{ github.token }} | |
on: | |
push: | |
branches: main | |
pull_request: | |
branches: main | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
#linux: | |
# name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }} | |
# runs-on: ${{ matrix.os }} | |
# strategy: | |
# fail-fast: false | |
# matrix: | |
# os: [ubuntu-24.04] | |
# platform: ['x86_64-linux'] | |
# ghc-version: ['9.6.6'] | |
# cabal-version: ['3.12.1.0'] | |
# steps: | |
# - uses: actions/checkout@v4 | |
# # Following https://github.com/docker/build-push-action?tab=readme-ov-file#usage | |
# - name: Set up Docker Buildx | |
# uses: docker/setup-buildx-action@v3 | |
# - name: Login to GitHub Container Registry | |
# uses: docker/login-action@v3 | |
# with: | |
# registry: ghcr.io | |
# username: ${{ github.actor }} | |
# password: ${{ github.token }} | |
# - name: Cache | |
# uses: actions/cache@v4 | |
# id: cache | |
# with: | |
# path: | | |
# root-local-state-cabal-store | |
# root-cache-cabal | |
# dist-newstyle | |
# key: plan-${{ hashFiles('dist-newstyle/cache/plan.json') }} | |
# - name: Inject cache into docker | |
# uses: reproducible-containers/buildkit-cache-dance@v3.1.0 | |
# with: | |
# cache-map: | | |
# { | |
# "root-local-state-cabal-store": "/root/.local/state/cabal/store", | |
# "root-cache-cabal": "/root/.cache/cabal", | |
# "dist-newstyle": "dist-newstyle" | |
# } | |
# skip-extraction: ${{ steps.cache.outputs.cache-hit }} | |
# - name: Build and test | |
# uses: docker/build-push-action@v6 | |
# with: | |
# context: . | |
# pull: true | |
# # XXX: don't push feature branches either? | |
# push: ${{ github.event_name != 'pull_request' }} # Don't push on PRs. | |
# file: Dockerfile | |
# tags: | | |
# ghcr.io/spex-lang/spex-build:${{ github.ref_name }} | |
# ghcr.io/spex-lang/spex-build:latest | |
# # We pass in the version as a secret, since they don't affect the | |
# # container caching, this will be picked up and used by --version. | |
# # https://docs.docker.com/build/building/secrets/ | |
# secrets: version=${{ github.sha }} | |
# # https://docs.docker.com/build/ci/github-actions/cache/#github-cache | |
# # https://docs.docker.com/build/ci/github-actions/cache/#cache-mounts | |
# cache-from: type=registry,ref=ghcr.io/spex-lang/spex-build:buildcache | |
# cache-to: type=registry,ref=ghcr.io/spex-lang/spex-build:buildcache,mode=max | |
# - name: Create new git tag, if merge to main and .cabal version is bumped | |
# if: ${{ github.event_name == 'push' && github.ref == 'refs/heads/main' }} | |
# uses: sol/haskell-autotag@v1 | |
# id: autotag | |
# - name: Build static binaries | |
# if: steps.autotag.outputs.created | |
# uses: docker/build-push-action@v6 | |
# with: | |
# context: . | |
# pull: true | |
# push: ${{ github.event_name != 'pull_request' }} # Don't push on PRs. | |
# file: release/Dockerfile | |
# tags: | | |
# ghcr.io/spex-lang/spex:${{ github.ref_name }} | |
# ghcr.io/spex-lang/spex:latest | |
# outputs: type=local,dest=${{ github.workspace }}/bin/ | |
# # https://docs.docker.com/build/ci/github-actions/cache/#github-cache | |
# cache-from: type=registry,ref=ghcr.io/spex-lang/spex:buildcache | |
# cache-to: type=registry,ref=ghcr.io/spex-lang/spex:buildcache,mode=max | |
# - name: Release | |
# if: steps.autotag.outputs.created | |
# run: | | |
# ls -R bin/ | |
# find bin/ -maxdepth 1 -type f -executable -exec \ | |
# mv {} "{}-${{ steps.autotag.outputs.version }}-${{ matrix.platform }}" \; | |
# gh release create --draft --notes-file=CHANGELOG.md \ | |
# "v${{ steps.autotag.outputs.version }}" ${{ github.workspace }}/bin/* | |
# | |
arm64-macos-binary: | |
name: GHC ${{ matrix.ghc-version }} on ${{ matrix.os }} | |
runs-on: ${{ matrix.os }} | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [macos-15] | |
platform: ['arm64-macos'] | |
ghc-version: ['9.6.6'] | |
cabal-version: ['3.12.1.0'] | |
outputs: | |
new-version: ${{ steps.version-bump.outputs.new-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up GHC ${{ matrix.ghc-version }} | |
uses: haskell-actions/setup@v2 | |
id: setup | |
with: | |
ghc-version: ${{ matrix.ghc-version }} | |
cabal-version: ${{ matrix.cabal-version }} | |
cabal-update: true | |
- name: Build dependencies | |
run: make build-deps | |
- name: Build | |
run: make build | |
- name: Test | |
run: make test | |
- name: Check for version bump | |
id: version-bump | |
run: make bump | |
- name: Install binaries | |
# Only if there's a version bump and we are merging to main, i.e | |
# exclude PRs. | |
if: ${{ steps.version-bump.outputs.new-version && | |
github.event_name == 'push' && | |
github.ref == 'refs/heads/main' }} | |
id: install | |
env: | |
NEW_VERSION: ${{ steps.version-bump.outputs.new-version }} | |
run: make install | |
- name: Upload binary artifacts | |
if: steps.install.outcome == 'success' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: spex-${{ matrix.platform }} | |
path: bin/* | |
create-release: | |
name: Create release | |
runs-on: ubuntu-latest | |
needs: [arm64-macos-binary] | |
if: ${{ needs.arm64-macos-binary.outputs.new-version }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
sparse-checkout: | | |
spex.cabal | |
Makefile | |
CHANGELOG.md | |
sparse-checkout-cone-mode: false | |
- name: Download binary artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: bin | |
pattern: spex-* | |
merge-multiple: true | |
- name: Compress binaries and create release | |
env: | |
NEW_VERSION: ${{ needs.arm64-macos-binary.outputs.new-version }} | |
run: make release |