Skip to content

New branch v3 that defaults to alr 2.0 #38

New branch v3 that defaults to alr 2.0

New branch v3 that defaults to alr 2.0 #38

Workflow file for this run

# Changes to the v2 branch must be proposed via PRs in the branch
# v3-next. This way we can check the action just as GHA is going to
# use it.
name: Test cache
on:
pull_request:
jobs:
sanity-check:
strategy:
matrix:
os: [ubuntu-latest, macos-latest, windows-latest]
version: ['2.0.0', '1.2.2', 'nightly', 'source']
branch: ['', 'master']
exclude: # These combos are redundant
- version: '2.0.0'
branch: master
- version: '1.2.2'
branch: master
- version: nightly
branch: master
- version: source
branch: ''
runs-on: ${{ matrix.os }}
steps:
- name: Check PR comes from proper branch
if: (github.head_ref || github.ref) != 'v3-next'
uses: actions/github-script@v3
with:
script: |
core.setFailed(`PRs for ${{github.base_ref}} must come from v3-next, but branch is ${{github.head_ref || github.ref}}`)
# This might hit cache
- name: Check action itself
id: attempt_1
uses: alire-project/setup-alire@v3-next
with:
version: ${{matrix.version}}
branch: ${{matrix.branch}}
# Next attemp should hit cache given the previous run
- name: Check action itself
if: steps.attempt_1.outputs.cache_hit != 'true'
id: attempt_2
uses: alire-project/setup-alire@v3-next
with:
version: ${{matrix.version}}
branch: ${{matrix.branch}}
- shell: bash
run: |
echo Caching attempt 1: ${{steps.attempt_1.outputs.cache_hit}} :: Caching attempt 2: ${{steps.attempt_2.outputs.cache_hit}}
# Fail if no cache was hit
- if: (steps.attempt_1.outputs.cache_hit != 'true') && (steps.attempt_2.outputs.cache_hit != 'true')
uses: actions/github-script@v3
with:
script: |
core.setFailed('FAIL: No cache hit observed')
- run: alr -n version
# Verify proper builds
- run: alr -n version | grep "os:" | grep LINUX
if: matrix.os == 'ubuntu-latest'
shell: bash
- run: alr -n version | grep "os:" | grep MACOS
if: matrix.os == 'macos-latest'
shell: bash
- run: alr -n version | grep "os:" | grep WINDOWS
if: matrix.os == 'windows-latest'
shell: bash