aboutsummaryrefslogtreecommitdiff
path: root/.github/workflows
diff options
context:
space:
mode:
authorMiquel Sabaté Solà <msabate@suse.com>2021-07-06 08:22:54 +0200
committerMiquel Sabaté Solà <msabate@suse.com>2021-07-06 08:22:54 +0200
commit65b14a348fa0b057c3641e1fc89c8503b746507b (patch)
treea38ba5fadf3e412f3a03f3413753ac51d35dd57f /.github/workflows
parent4e69d9c1ad7df3653c94bf2da0e8634563261e53 (diff)
downloadjo.mssola.com-65b14a348fa0b057c3641e1fc89c8503b746507b.tar.gz
jo.mssola.com-65b14a348fa0b057c3641e1fc89c8503b746507b.zip
Added workflow
Signed-off-by: Miquel Sabaté Solà <msabate@suse.com>
Diffstat (limited to '.github/workflows')
-rw-r--r--.github/workflows/ci.yml69
1 files changed, 69 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..277577c
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,69 @@
+name: CI
+
+on:
+ push:
+ branches: [main]
+ pull_request:
+ branches: [main]
+
+jobs:
+ build:
+ runs-on: ubuntu-latest
+ steps:
+ - uses: actions/checkout@v2
+
+ - name: Set up Ruby
+ uses: ruby/setup-ruby@v1
+
+ - name: Get yarn cache directory path
+ id: yarn-cache-dir-path
+ run: echo "::set-output name=dir::$(yarn cache dir)"
+
+ - name: "Cache JS modules"
+ uses: actions/cache@v2
+ id: yarn-cache
+ with:
+ path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
+ key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-yarn-
+
+ - name: "Cache gems"
+ uses: actions/cache@v2
+ id: gem-cache
+ with:
+ path: vendor/bundle
+ key: ${{ runner.os }}-gems-${{ hashFiles('**/Gemfile.lock') }}
+ restore-keys: |
+ ${{ runner.os }}-gems-
+
+ - name: "Install Ruby and Javascript dependencies"
+ env:
+ RAILS_ENV: "test"
+ NODE_ENV: "test"
+ run: |
+ bundle config set path 'vendor/bundle'
+ bundle install --jobs 4 --retry 3
+ yarn
+
+ - name: "Build site"
+ run: bundle exec jekyll build
+
+ - name: "Run rubocop"
+ run: bundle exec rubocop
+
+ - name: "Run tests"
+ run: bundle exec rake
+
+ - name: "Produce tarball"
+ run: tar czvf site.tar.gz _site
+
+ - name: "Upload tarball"
+ uses: appleboy/scp-action@master
+ with:
+ host: ${{ secrets.HOST }}
+ username: ${{ secrets.USERNAME }}
+ port: ${{ secrets.PORT }}
+ key: ${{ secrets.KEY }}
+ source: "site.tar.gz"
+ target: "test"