-
Notifications
You must be signed in to change notification settings - Fork 4
104 lines (86 loc) · 2.88 KB
/
checks.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
name: Checks
on: # yamllint disable-line rule:truthy
push:
branches:
- master
pull_request:
branches:
- master
schedule:
- cron: 49 3 * * *
workflow_dispatch:
inputs:
bleeding_edge:
type: boolean
default: false
description: Run with gems from git sources
permissions:
contents: read
jobs:
tests:
runs-on: ubuntu-latest
# Allow disabling scheduled runs when an issue has been found. Also stops it from running on forks.
# Configure at https://github.com/Earlopain/FoxTrove/settings/variables/actions
if: (github.event_name == 'schedule' && vars.ALLOW_SCHEDULED_RUN == 'true') || github.event_name != 'schedule'
env:
BLEEDING_EDGE: ${{ (inputs.bleeding_edge == true || github.event_name == 'schedule') && 'true' || 'false' }}
steps:
- uses: actions/checkout@v4
- if: env.BLEEDING_EDGE == 'true'
uses: ruby/setup-ruby@v1
- if: env.BLEEDING_EDGE == 'true'
name: Use git gem sources
env:
GEM_OVERRIDES: ${{ vars.GEM_OVERRIDES }}
# https://github.com/rubygems/rubygems/issues/8238
run: ruby .github/bleeding_edge.rb && bundle lock --update && cat Gemfile.lock
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Build
uses: docker/build-push-action@v5
with:
context: .
cache-from: type=gha
cache-to: type=gha,mode=max
load: true
tags: foxtrove
build-args: |
BASE_IMAGE=${{ env.BLEEDING_EDGE == 'true' && 'ghcr.io/docker-ruby-nightly/ruby:alpine3.20-nightly' || ''}}
- name: Set env file
run: |
cat <<EOT >> .env
FOXTROVE_DATA_PATH=${{ runner.temp }}/foxtrove
CI=1
${{ env.BLEEDING_EDGE == 'true' && 'BLEEDING_EDGE=true' || ''}}
EOT
- name: Create DB
run: docker compose run foxtrove bin/setup
- name: Run Tests
run: docker compose run -e CI -e BLEEDING_EDGE tests
- if: env.BLEEDING_EDGE == 'false'
name: Upload Coverage
uses: codecov/codecov-action@v4
with:
token: ${{ secrets.CODECOV_TOKEN }}
rubocop:
runs-on: ubuntu-latest
if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'
steps:
- uses: actions/checkout@v4
- uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Run Rubocop
run: bundle exec rubocop --format github
docker-checks:
runs-on: ubuntu-latest
if: github.event_name != 'schedule' && github.event_name != 'workflow_dispatch'
name: Run ${{ matrix.service }}
strategy:
fail-fast: false
matrix:
service: [yamllint, csslint, tslint]
steps:
- uses: actions/checkout@v4
- name: Run ${{ matrix.service }}
run: docker compose run ${{ matrix.service }}