forked from platanus/activeadmin_addons
-
Notifications
You must be signed in to change notification settings - Fork 0
146 lines (118 loc) · 4.25 KB
/
Copy pathci.yml
File metadata and controls
146 lines (118 loc) · 4.25 KB
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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
name: CI
on:
push:
branches: [master, main]
pull_request:
branches: [master, main]
jobs:
test:
runs-on: ubuntu-latest
timeout-minutes: 15
strategy:
fail-fast: false
matrix:
ruby: ['3.2', '3.3']
gemfile:
- rails_7_0_activeadmin_4_sprockets
- rails_7_1_activeadmin_4_sprockets
- rails_7_2_activeadmin_4_sprockets
- rails_7_2_activeadmin_4_importmap
- rails_7_2_activeadmin_4_esbuild
- rails_8_0_activeadmin_4_propshaft
env:
BUNDLE_GEMFILE: ${{ github.workspace }}/gemfiles/${{ matrix.gemfile }}.gemfile
RAILS_ENV: test
PLAYWRIGHT_BROWSERS_PATH: ${{ github.workspace }}/ms-playwright
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby }}
bundler-cache: true
# Cache APT packages for Playwright dependencies
- name: Cache APT packages
uses: awalsh128/cache-apt-pkgs-action@v1.5.3
with:
packages: libnss3 libnspr4 libatk1.0-0 libatk-bridge2.0-0 libcups2 libdrm2 libdbus-1-3 libatspi2.0-0 libx11-6 libxcomposite1 libxdamage1 libxext6 libxfixes3 libxrandr2 libgbm1 libxcb1 libxkbcommon0 libpango-1.0-0 libcairo2 libasound2 libvips file
version: 1.0
execute_install_scripts: true
# Get Playwright version for cache key
- name: Get Playwright version
id: playwright-version
run: |
PLAYWRIGHT_VERSION=$(npm ls @playwright/test 2>/dev/null | grep @playwright/test | sed 's/.*@//' | head -1)
if [ -z "$PLAYWRIGHT_VERSION" ]; then
PLAYWRIGHT_VERSION=$(npx playwright --version | sed 's/Version //')
fi
echo "version=$PLAYWRIGHT_VERSION" >> $GITHUB_OUTPUT
# Cache Playwright browsers
- name: Cache Playwright browsers
id: playwright-cache
uses: actions/cache@v4
with:
path: ${{ github.workspace }}/ms-playwright
key: ${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}-${{ hashFiles('**/package-lock.json', '**/yarn.lock', '**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-playwright-${{ steps.playwright-version.outputs.version }}-
${{ runner.os }}-playwright-
# Install Node.js and npm dependencies
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install npm dependencies
run: npm install
- name: Install Playwright browsers
if: steps.playwright-cache.outputs.cache-hit != 'true'
run: npx playwright install chromium
- name: Setup test database
run: |
cd spec/dummy
bundle exec rake db:create db:schema:load
- name: Prepare assets
run: |
bundle exec rake prepare_assets
cd spec/dummy && bundle exec rake webpacker:compile
- name: Run Utils Tests
run: |
bundle exec rspec ./spec/lib -f progress --no-color -p 10
- name: Run Feature Tests
run: |
bundle exec rspec ./spec/features -f progress --no-color -p 10
- name: Upload coverage reports
if: matrix.ruby == '3.3' && matrix.gemfile == 'rails_7_2_activeadmin_4'
uses: codecov/codecov-action@v4
with:
file: ./coverage/coverage.xml
fail_ci_if_error: false
token: ${{ secrets.CODECOV_TOKEN }}
lint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.3'
bundler-cache: true
- name: Run RuboCop
run: bundle exec rubocop --force-exclusion
build-npm:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build npm package
run: npm run prepublishOnly
- name: Check package
run: npm pack --dry-run
- name: Run ESLint
run: npx eslint app/javascript --ext .js