generated from actions/typescript-action
-
Notifications
You must be signed in to change notification settings - Fork 4
130 lines (109 loc) · 3.63 KB
/
test-cache.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Test cache
on:
pull_request:
workflow_dispatch:
jobs:
test-cache:
strategy:
fail-fast: false
matrix:
os:
- macos-12
- macos-14
- macos-latest
- ubuntu-latest
- windows-latest
config:
- version: '2.0.2'
branch: ''
- version: '1.2.2'
branch: ''
- version: 'nightly'
branch: ''
- version: ''
branch: 'master'
msys2:
- true
- false
# Exclude combos that do not make sense (we dont have aarm64 for 1.2.2)
exclude:
- os: macos-14
config: {version: '1.2.2', branch: ''}
- os: macos-latest
config: {version: '1.2.2', branch: ''}
- os: windows-latest
config: {version: '1.2.2'}
msys2: false # We don't have the option to disable install on 1.2.2
# We don't exclude the following because this way we verify that the
# same cache is used for both msys2 true and false on non-Windows.
# - os: macos-12
# msys2: true
# - os: macos-14
# msys2: true
# - os: macos-stable
# msys2: true
# - os: ubuntu-latest
# msys2: true
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
# This might hit cache
- name: Check action itself (attempt 1)
id: attempt_1
uses: ./
with:
version: ${{matrix.config.version}}
branch: ${{matrix.config.branch}}
msys2: ${{ matrix.msys2 }}
# Next attemp should hit cache given the previous run
- name: Check action itself (attempt 2)
if: steps.attempt_1.outputs.cache_hit != 'true'
id: attempt_2
uses: ./
with:
version: ${{matrix.config.version}}
branch: ${{matrix.config.branch}}
msys2: ${{ matrix.msys2 }}
- name: Diagnose cache use
shell: bash
run: |
echo "Caching attempt 1: ${{steps.attempt_1.outputs.cache_hit}}"
echo "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')
# Check alr and default toolchains
- run: alr -n version
- run: |
alr -n init --bin alrws
cd alrws
alr exec -- gnat --version
alr exec -- gprbuild --version
# Verify proper OS
- 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
# Verify proper architecture
- run: alr -n version | grep "arch:" | grep X86_64
if: runner.arch == 'X64'
shell: bash
- run: alr -n version | grep "arch:" | grep AARCH64
if: runner.arch == 'ARM64'
shell: bash
# Verify proper msys2 behavior
- run: alr -n version | grep "distribution:" | grep MSYS2
if: matrix.os == 'windows-latest' && matrix.msys2 == true
shell: bash
- run: alr -n version | grep "distribution:" | grep UNKNOWN
if: matrix.os == 'windows-latest' && matrix.msys2 == false
shell: bash