-
Notifications
You must be signed in to change notification settings - Fork 2
102 lines (96 loc) · 3.09 KB
/
tests.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
name: "CI/CD"
on: [ push ]
env:
CI: "true"
SIMPLECOV: "true"
RUBY_VERSION: 2.7.1
RAILS_ENV: test
NODE_VERSION: 16.9.1
RUBYOPT: '-W:no-deprecated'
RSPEC_FORMATTER: 'documentation'
jobs:
lint:
name: Lint code
runs-on: ubuntu-latest
if: "!startsWith(github.head_ref, 'chore/l10n')"
timeout-minutes: 60
steps:
- uses: rokroskar/[email protected]
if: "github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: OpenSourcePolitics/lint-action@master
tests:
name: Tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11
ports: [ "5432:5432" ]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_PASSWORD: postgres
env:
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: localhost
RAILS_ENV: test
# Set locales available for i18n tasks
ENFORCED_LOCALES: "en"
steps:
- uses: rokroskar/[email protected]
if: "github.ref != 'refs/heads/master' || github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: OpenSourcePolitics/rspec-action@master
with:
command: 'bundle exec rspec --exclude-pattern "spec/system/**/*_spec.rb"'
prepare_command: "bundle exec rails db:create db:migrate"
system_tests:
name: System tests
runs-on: ubuntu-latest
services:
postgres:
image: postgres:11
ports: [ "5432:5432" ]
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
env:
POSTGRES_PASSWORD: postgres
env:
DATABASE_USERNAME: postgres
DATABASE_PASSWORD: postgres
DATABASE_HOST: localhost
RAILS_ENV: test
# Set locales available for i18n tasks
ENFORCED_LOCALES: "en"
TRANSLATION_MODE: "smartling"
steps:
- uses: rokroskar/[email protected]
if: "github.ref != 'refs/heads/master' || github.ref != 'refs/heads/develop'"
env:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- uses: OpenSourcePolitics/rspec-action@master
with:
command: 'bundle exec rspec "spec/system"'
prepare_command: "bundle exec rails db:create db:migrate"
push_to_code_commit:
needs: [ tests, lint, system_tests ]
name: Push to CodeCommit
runs-on: ubuntu-latest
if: "github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop'"
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Push to CodeCommit
run: |
git push "https://${{ secrets.NYC_AWS_ACCESS_KEY_ID }}:${{ secrets.NYC_AWS_SECRET_ACCESS_KEY }}@git-codecommit.${{ vars.NYC_CODE_COMMIT_AWS_REGION }}.amazonaws.com/v1/repos/${{ vars.NYC_CODE_COMMIT_REPO_NAME }}" ${{ github.ref }}