Skip to content

Commit dd78503

Browse files
committed
unify ci workflows
1 parent 4381d9b commit dd78503

File tree

2 files changed

+71
-158
lines changed

2 files changed

+71
-158
lines changed
Lines changed: 71 additions & 73 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,21 @@
1-
name: test, docker build & push
1+
name: CI
22

3-
on: [push]
3+
on:
4+
push:
5+
pull_request:
6+
workflow_dispatch:
7+
8+
concurrency:
9+
group: ci-${{ github.ref }}
10+
cancel-in-progress: true
411

512
jobs:
613
hadolint:
714
runs-on: ubuntu-latest
815
steps:
916
- uses: actions/checkout@v5
10-
- run: docker run --rm -i hadolint/hadolint < Dockerfile
17+
- name: Lint Dockerfile
18+
run: docker run --rm -i hadolint/hadolint < Dockerfile
1119

1220
ruby:
1321
runs-on: ubuntu-latest
@@ -16,106 +24,98 @@ jobs:
1624

1725
- uses: ruby/setup-ruby@v1
1826
with:
19-
ruby-version-file: '.tool-versions'
27+
ruby-version-file: ".tool-versions"
2028
bundler-cache: true
2129

22-
- run: bundle exec rubocop -F
23-
- run: bundle exec yard doc --fail-on-warning --no-output
30+
- name: Run RuboCop
31+
run: bundle exec rubocop -F
32+
33+
- name: Verify Yard documentation
34+
run: bundle exec yard doc --fail-on-warning --no-output
35+
36+
- name: Run RSpec
37+
run: bundle exec rspec
38+
39+
- name: Upload coverage report
40+
uses: actions/upload-artifact@v4
41+
if: always()
42+
with:
43+
name: coverage-report
44+
path: coverage/
45+
retention-days: 30
2446

2547
frontend:
2648
runs-on: ubuntu-latest
49+
defaults:
50+
run:
51+
working-directory: frontend
2752
steps:
2853
- uses: actions/checkout@v5
2954

3055
- name: Setup Node.js
3156
uses: actions/setup-node@v4
3257
with:
33-
node-version-file: '.tool-versions'
34-
cache: "npm"
58+
node-version-file: ".tool-versions"
59+
cache: npm
3560
cache-dependency-path: frontend/package-lock.json
3661

37-
- name: Setup Ruby
38-
uses: ruby/setup-ruby@v1
39-
with:
40-
ruby-version-file: '.tool-versions'
41-
bundler-cache: true
42-
4362
- name: Install dependencies
44-
run: |
45-
cd frontend
46-
npm ci
47-
cd ..
48-
bundle install
63+
run: npm ci
64+
65+
- name: Check formatting
66+
run: npm run format:check
67+
68+
- name: Audit dependencies
69+
run: npm audit --audit-level=moderate
4970

5071
- name: Run frontend tests
51-
run: |
52-
cd frontend
53-
npm run test:ci
72+
run: npm run test:ci
5473

5574
- name: Build frontend
56-
run: |
57-
cd frontend
58-
npm run build
75+
run: npm run build
5976

6077
- name: Verify build output
6178
run: |
62-
ls -la frontend/dist/
63-
test -f frontend/dist/index.html
64-
test -f frontend/dist/gallery/index.html
79+
grep -q "html2rss-web" dist/index.html
80+
grep -q "Feed Gallery" dist/gallery/index.html
6581
66-
rspec:
82+
docker-test:
83+
if: github.event_name == 'push'
84+
needs:
85+
- hadolint
86+
- ruby
87+
- frontend
6788
runs-on: ubuntu-latest
6889
steps:
6990
- uses: actions/checkout@v5
7091

7192
- uses: ruby/setup-ruby@v1
7293
with:
73-
ruby-version-file: '.tool-versions'
94+
ruby-version-file: ".tool-versions"
7495
bundler-cache: true
7596

76-
- run: bundle exec rspec
77-
78-
- name: Upload coverage report
79-
uses: actions/upload-artifact@v4
80-
if: always()
81-
with:
82-
name: coverage-report
83-
path: coverage/
84-
retention-days: 30
85-
86-
docker-test:
87-
needs: [hadolint, frontend]
88-
runs-on: ubuntu-latest
89-
steps:
90-
- uses: actions/checkout@v5
91-
- uses: ruby/setup-ruby@v1
92-
with:
93-
ruby-version-file: '.tool-versions'
94-
bundler-cache: true
95-
- name: Setup Node.js for Docker build
97+
- name: Setup Node.js for Docker smoke test
9698
uses: actions/setup-node@v4
9799
with:
98-
node-version-file: '.tool-versions'
99-
cache: "npm"
100+
node-version-file: ".tool-versions"
101+
cache: npm
100102
cache-dependency-path: frontend/package-lock.json
103+
101104
- name: Install frontend dependencies
102-
run: |
103-
cd frontend
104-
npm ci
105+
run: npm ci
106+
working-directory: frontend
107+
105108
- name: Build frontend
106-
run: |
107-
cd frontend
108-
npm run build
109-
- run: |
110-
bundle exec rake
109+
run: npm run build
110+
working-directory: frontend
111111

112-
docker-push:
113-
if: ${{ github.ref == 'refs/heads/master' }}
112+
- name: Run Docker smoke test
113+
run: bundle exec rake
114+
115+
docker-publish:
116+
if: github.event_name == 'push' && github.ref == 'refs/heads/master'
114117
needs:
115118
- docker-test
116-
- hadolint
117-
- ruby
118-
- frontend
119119
runs-on: ubuntu-latest
120120
permissions:
121121
contents: read
@@ -130,19 +130,17 @@ jobs:
130130
- name: Setup Node.js for Docker build
131131
uses: actions/setup-node@v4
132132
with:
133-
node-version-file: '.tool-versions'
134-
cache: "npm"
133+
node-version-file: ".tool-versions"
134+
cache: npm
135135
cache-dependency-path: frontend/package-lock.json
136136

137137
- name: Install frontend dependencies
138-
run: |
139-
cd frontend
140-
npm ci
138+
run: npm ci
139+
working-directory: frontend
141140

142141
- name: Build frontend
143-
run: |
144-
cd frontend
145-
npm run build
142+
run: npm run build
143+
working-directory: frontend
146144

147145
- name: Set up QEMU
148146
uses: docker/setup-qemu-action@v3

.github/workflows/frontend.yml

Lines changed: 0 additions & 85 deletions
This file was deleted.

0 commit comments

Comments
 (0)