-
Notifications
You must be signed in to change notification settings - Fork 0
163 lines (145 loc) · 4.88 KB
/
build.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
name: Lint, Test, Coverage and Deploy
on:
push:
branches:
- main
- beta
pull_request:
jobs:
lint:
name: Lint
runs-on: ubuntu-latest
strategy:
matrix:
# ruby-version: ["3.0", "3.1", "3.2"]
ruby-version: [ "3.2" ]
packages:
# - forest_admin_agent
- forest_admin_datasource_active_record
# - forest_admin_datasource_customizer
# - forest_admin_datasource_toolkit
# - forest_admin_test_toolkit
# - forest_admin_rails
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Install dependencies on main repo
run: |
gem install bundler
bundle install
- name: Install dependencies on packages
run: cd packages/${{ matrix.packages }} && bundle install && cd -
- name: Run RuboCop
run: bundle exec rubocop
test:
name: Test
runs-on: ubuntu-latest
needs: [lint]
strategy:
matrix:
# ruby-version: ["3.0", "3.1", "3.2"]
ruby-version: [ "3.2" ]
packages:
# - forest_admin_agent
- forest_admin_datasource_active_record
# - forest_admin_datasource_customizer
# - forest_admin_datasource_toolkit
# - forest_admin_rails
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Set up Ruby ${{ matrix.ruby-version }}
uses: ruby/setup-ruby@v1
with:
ruby-version: ${{ matrix.ruby-version }}
- name: Install dependencies on main repo
run: |
gem install bundler
bundle install
- name: Test
run: cd packages/${{ matrix.packages }} && BUNDLE_GEMFILE=Gemfile-test bundle install && BUNDLE_GEMFILE=Gemfile-test bundle exec rspec --color --format doc && cd -
- name: Verify coverage.json presence
run: |
if [ -f packages/forest_admin_datasource_active_record/coverage/coverage.json ]; then
echo "Coverage file exists"
else
echo "Coverage file is missing"
fi
- name: Debug Coverage Directory
run: tree -a packages/${{ matrix.packages }}/coverage/
- name: Debug file structure
run: tree -a packages/forest_admin_datasource_active_record
# - name: Upload coverage
# uses: actions/upload-artifact@v4
# with:
# name: ${{ matrix.ruby-version }}-${{ matrix.packages }}
# path: packages/${{ matrix.packages }}/coverage/*
# retention-days: 1
# coverage:
# name: Send Coverage
# runs-on: ubuntu-latest
# needs: [test]
# steps:
# - name: Checkout
# uses: actions/checkout@v4
#
# - name: Download coverage reports
# uses: actions/download-artifact@v4
# with:
# path: reports
- name: Send coverage
uses: paambaati/[email protected]
env:
CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }}
with:
coverageLocations: |
${{github.workspace}}/packages/${{ matrix.packages }}/coverage/coverage.json:simplecov
# ${{github.workspace}}/reports/3.2-forest_admin_datasource_active_record/coverage.json:simplecov
debug: true
# deploy:
# name: Release package
# runs-on: ubuntu-latest
# needs: [coverage]
# if: github.event_name == 'push' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/beta')
# steps:
# - name: Checkout
# uses: actions/checkout@v4
# with:
# persist-credentials: false # GITHUB_TOKEN must not be set for the semantic release
#
# - uses: actions/setup-node@v4
# with:
# node-version: 18.14.0
#
# - uses: actions/cache@v4
# with:
# path: "**/node_modules"
# key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
#
# - name: Install semantic release dependencies
# run: yarn
#
# - name: Setup credentials
# run: |
# mkdir -p $HOME/.gem
# touch $HOME/.gem/credentials
# chmod 0600 $HOME/.gem/credentials
# printf -- "---\n:rubygems_api_key: ${{secrets.GEM_HOST_API_KEY}}\n" > $HOME/.gem/credentials
#
# - name: Semantic Release
# uses: cycjimmy/semantic-release-action@v2
# id: semantic
# with:
# semantic_version: 17.3.0
# env:
# GEM_HOST_API_KEY: ${{ secrets.GEM_HOST_API_KEY }}
# GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
# GIT_AUTHOR_EMAIL: ${{ secrets.GIT_AUTHOR_EMAIL }}
# GIT_AUTHOR_NAME: ${{ secrets.GIT_AUTHOR_NAME }}
# GIT_COMMITTER_EMAIL: ${{ secrets.GIT_COMMITTER_EMAIL }}
# GIT_COMMITTER_NAME: ${{ secrets.GIT_COMMITTER_NAME }}
# SLACK_WEBHOOK: ${{ secrets.SLACK_WEBHOOK }}