Skip to content

Commit

Permalink
ci: debug if condition on windows runner again
Browse files Browse the repository at this point in the history
  • Loading branch information
stevana committed Nov 4, 2024
1 parent c27f663 commit d350ffd
Show file tree
Hide file tree
Showing 2 changed files with 105 additions and 98 deletions.
202 changes: 104 additions & 98 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,8 @@ jobs:
strategy:
fail-fast: false
matrix:
os: [ubuntu-24.04, macos-15, windows-2022]
#os: [ubuntu-24.04, macos-15, windows-2022]
os: [windows-2022]
ghc-version: ['9.6.6']
cabal-version: ['3.12.1.0']
env:
Expand All @@ -138,111 +139,116 @@ jobs:
cabal-version: ${{ matrix.cabal-version }}
cabal-update: false

- name: Install make (Windows only)
if: ${{ env.platform == 'x86_64-windows' }}
run: |
choco install make
# Use Alpine container to get static binaries on Linux.
- name: Login to GitHub Container Registry (Linux only)
if: ${{ env.platform == 'x86_64-linux' }}
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ github.token }}

- name: Pull image (Linux only)
if: ${{ env.platform == 'x86_64-linux' }}
run: make pull-image

- name: Build image (Linux only)
if: ${{ env.platform == 'x86_64-linux' }}
run: make build-image

- name: Push image (Linux only)
if: ${{ env.platform == 'x86_64-linux' }}
run: make push-image

- name: Restore cached dependencies
uses: actions/cache/restore@v4
id: cache
env:
key: ${{ runner.os }}-ghc-${{ matrix.ghc-version }}-cabal-${{ matrix.cabal-version }}
with:
path: |
${HOME}/.cache/cabal
${HOME}/.cabal/store
dist-newstyle
key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
restore-keys: ${{ env.key }}-plan-

- name: Build dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: make build-deps

# Cache dependencies already here, so that we do not have to rebuild them
# should the subsequent steps fail.
- name: Save cached dependencies
uses: actions/cache/save@v4
if: steps.cache.outputs.cache-hit != 'true'
with:
path: |
${HOME}/.cache/cabal
${HOME}/.cabal/store
dist-newstyle
key: ${{ steps.cache.outputs.cache-primary-key }}

- name: Build
env:
SPEX_GIT_COMMIT: ${{ github.sha }}
run: make build

- name: Test
run: make test
#- name: Install make (Windows only)
# if: ${{ env.platform == 'x86_64-windows' }}
# run: |
# choco install make

## Use Alpine container to get static binaries on Linux.
#- name: Login to GitHub Container Registry (Linux only)
# if: ${{ env.platform == 'x86_64-linux' }}
# uses: docker/login-action@v3
# with:
# registry: ghcr.io
# username: ${{ github.actor }}
# password: ${{ github.token }}

#- name: Pull image (Linux only)
# if: ${{ env.platform == 'x86_64-linux' }}
# run: make pull-image

#- name: Build image (Linux only)
# if: ${{ env.platform == 'x86_64-linux' }}
# run: make build-image

#- name: Push image (Linux only)
# if: ${{ env.platform == 'x86_64-linux' }}
# run: make push-image

#- name: Restore cached dependencies
# uses: actions/cache/restore@v4
# id: cache
# env:
# key: ${{ runner.os }}-ghc-${{ matrix.ghc-version }}-cabal-${{ matrix.cabal-version }}
# with:
# path: |
# ${HOME}/.cache/cabal
# ${HOME}/.cabal/store
# dist-newstyle
# key: ${{ env.key }}-plan-${{ hashFiles('**/plan.json') }}
# restore-keys: ${{ env.key }}-plan-

#- name: Build dependencies
# if: steps.cache.outputs.cache-hit != 'true'
# run: make build-deps

## Cache dependencies already here, so that we do not have to rebuild them
## should the subsequent steps fail.
#- name: Save cached dependencies
# uses: actions/cache/save@v4
# if: steps.cache.outputs.cache-hit != 'true'
# with:
# path: |
# ${HOME}/.cache/cabal
# ${HOME}/.cabal/store
# dist-newstyle
# key: ${{ steps.cache.outputs.cache-primary-key }}

#- name: Build
# env:
# SPEX_GIT_COMMIT: ${{ github.sha }}
# run: make build

#- name: Test
# run: make test

- name: Check for version bump
id: version-bump
run: make bump
run: | # make bump
echo "new-version=0.0.0 >> $env:GITHUB_OUTPUT
- 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' }}
#if: ${{ steps.version-bump.outputs.new-version != '' &&
# github.event_name == 'push' &&
# github.ref == 'refs/heads/main' }}
id: install
env:
SPEX_GIT_COMMIT: ${{ github.sha }}
run: make install

- name: Upload binary artifacts
if: steps.install.outcome == 'success'
uses: actions/upload-artifact@v4
with:
name: ${{ env.platform }}
path: bin/*

release:
name: Create release
runs-on: ubuntu-latest
needs: [build]
if: ${{ needs.build.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
run: |
echo ${{ steps.version-bump.outputs.new-version }}
echo ${{ steps.version-bump.outputs.new-version != '' }}
# make install
#- name: Upload binary artifacts
# if: steps.install.outcome == 'success'
# uses: actions/upload-artifact@v4
# with:
# name: ${{ env.platform }}
# path: bin/*

#release:
# name: Create release
# runs-on: ubuntu-latest
# needs: [build]
# if: ${{ needs.build.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

- name: Compress binaries and create release
env:
NEW_VERSION: ${{ needs.build.outputs.new-version }}
run: make release
# - name: Compress binaries and create release
# env:
# NEW_VERSION: ${{ needs.build.outputs.new-version }}
# run: make release
1 change: 1 addition & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ endif

all: build-deps build test bump install release

# XXX: doesn't configure petstore...
dist-newstyle/cache/plan.json: cabal.project cabal.project.freeze spex.cabal
ifeq ($(OS),linux)
mkdir -p $(HOME)/.cache/cabal/packages
Expand Down

0 comments on commit d350ffd

Please sign in to comment.