From 65b14a348fa0b057c3641e1fc89c8503b746507b Mon Sep 17 00:00:00 2001 From: Miquel Sabaté Solà Date: Tue, 6 Jul 2021 08:22:54 +0200 Subject: Added workflow MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Miquel Sabaté Solà --- .github/workflows/ci.yml | 69 ++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/ci.yml (limited to '.github/workflows') 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" -- cgit v1.2.3