@@ -25,96 +25,38 @@ Before setting up CI/CD, you'll need:
2525
2626### Linters and tests
2727
28- The following yaml file shows an example CI pipeline with Semaphore. In this example, it runs linters and tests.
29- In case, all jobs pass, the specified promotion pipeline is triggered. See [ Auto-promote after tests ] ( #auto-promote-after-tests )
30- for details on how to setup the promotion pipeline .
28+ The following workflow shows an example CI pipeline with GitHub Actions. It runs linting and tests in parallel.
29+ If all jobs pass, the deployment job is triggered. See [ Continuous Deployment ] ( #continuous-deployment ) for details
30+ on how to setup the deployment step .
3131
3232``` yaml
33- version : v1.0
34- name : <project_name>
35-
36- agent :
37- machine :
38- type : e2-standard-2
39- os_image : ubuntu2204
40-
41- auto_cancel :
42- running :
43- when : ' true'
44-
45- fail_fast :
46- cancel :
47- when : branch != 'main'
48-
49- global_job_config :
50- secrets :
51- - name : <project_name>
52-
53- prologue :
54- commands :
55- - checkout --use-cache
56- - source .semaphore/bin/cache_restore rails
57- - bundle config set deployment 'true'
58- - bundle config set path 'vendor/bundle'
59- - bundle install -j 4
60- - nvm install
61- - yarn install --cache-folder ~/.cache/yarn
62- - bundle exec rails assets:precompile
63-
64- blocks :
65- - name : cache
66- dependencies : []
67- execution_time_limit :
68- minutes : 10
69- task :
70- jobs :
71- - name : cache
72- commands :
73- - source .semaphore/bin/cache_store rails
33+ name : CI
7434
75- - name : linting
76- dependencies : [cache]
77- execution_time_limit :
78- minutes : 5
79- task :
80- jobs :
81- - name : linting
82- commands :
83- - bin/fastcheck
35+ on :
36+ push :
37+ branches : [main, develop]
38+ pull_request :
8439
85- - name : tests
86- dependencies : [cache]
87- execution_time_limit :
88- minutes : 10
89- task :
90- env_vars :
91- - name : DATABASE_URL
92- value : postgresql://postgres@localhost/test?encoding=utf8
93- - name : RAILS_ENV
94- value : test
95- prologue :
96- commands :
97- - sem-service start postgres
98- - bundle exec rails db:create db:schema:load
99- jobs :
100- - name : tests
101- commands :
102- - bin/check
103- epilogue :
104- on_fail :
105- commands :
106- - mkdir -p log coverage tmp/screenshots tmp/capybara
107- - artifact push job log
108- - artifact push job tmp/screenshots
109- - artifact push job tmp/capybara
110- - zip -r coverage-$SEMAPHORE_GIT_SHA coverage/
111- - artifact push job coverage-$SEMAPHORE_GIT_SHA.zip
40+ jobs :
41+ lint :
42+ runs-on : ubuntu-latest
43+ timeout-minutes : 5
44+ steps :
45+ - uses : actions/checkout@v4
46+ - name : Install dependencies
47+ run : npm ci
48+ - name : Run linters
49+ run : npm run lint
11250
113- promotions :
114- - name : develop
115- pipeline_file : develop-deploy.yml
116- auto_promote :
117- when : result = 'passed' and branch = 'develop'
51+ test :
52+ runs-on : ubuntu-latest
53+ timeout-minutes : 10
54+ steps :
55+ - uses : actions/checkout@v4
56+ - name : Install dependencies
57+ run : npm ci
58+ - name : Run tests
59+ run : npm test
11860` ` `
11961
12062### Review Apps
0 commit comments