Skip to content

Merge pull request #21 from ngng628/gh-actions-update #226

Merge pull request #21 from ngng628/gh-actions-update

Merge pull request #21 from ngng628/gh-actions-update #226

Workflow file for this run

name: Run test and verifier
on:
push:
branches: [ master ]
pull_request:
branches: [ master ]
jobs:
test:
strategy:
matrix:
version:
- '0.33.0'
- '1.9.1'
runs-on: ubuntu-latest
container:
image: crystallang/crystal:${{ matrix.version }}
# https://github.com/SimonKagstrom/kcov/issues/151#issuecomment-249284631
options: --security-opt seccomp=unconfined
steps:
- name: Install latest git
run: |
apt-get update
apt-get install software-properties-common -y
apt-add-repository ppa:git-core/ppa -y
apt-get install git -y
- uses: actions/checkout@v3
- name: Install dependencies
run: |
apt-get install python3 libpython3.8 python3-dev python3-pip bash libxml2-dev libxslt-dev build-essential binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev cmake curl wget -y
- name: Install kcov
run: |
cd /tmp
git clone --depth 1 -b v38 https://github.com/SimonKagstrom/kcov.git
mkdir -p kcov/build
cd kcov/build
cmake ..
make -j8
make install
- name: Run tests
run: crystal spec --verbose
- name: Run Benchmarks
run: crystal run --release benchmarks/*
- name: Run coverage
if: ${{ matrix.version == '1.9.1' }}
run: |
shards build test --ignore-crystal-version
kcov --clean --include-path=src coverage ./bin/test
bash <(curl -s https://codecov.io/bash) -s coverage
env:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}
shell: bash
lint:
runs-on: ubuntu-latest
container:
image: crystallang/crystal:1.9.1
steps:
- uses: actions/checkout@v3
- name: Install Crystal dependencies
run: |
shards install --ignore-crystal-version
- name: Run linter
run: bin/ameba
verify:
strategy:
matrix:
version:
- '0.33.0'
- '1.9.1'
runs-on: ubuntu-latest
container:
image: crystallang/crystal:${{ matrix.version }}
steps:
- name: Install latest git
run: |
apt-get update
apt-get install software-properties-common -y
apt-add-repository ppa:git-core/ppa -y
apt-get install git -y
git config --global --add safe.directory /__w/ac-library.cr/ac-library.cr
- uses: actions/checkout@v3
- name: Cache .verify-helper
uses: actions/cache@v2
with:
path: |
.verify-helper/cache
.verify-helper/timestamps.local.json
key: ${{ runner.os }}-crystal-${{ matrix.version }}-verify-helper
- name: Install dependencies
run: |
apt-get install python3 libpython3.8 python3-dev python3-pip bash libxml2-dev libxslt-dev build-essential binutils-dev libcurl4-openssl-dev zlib1g-dev libdw-dev libiberty-dev libyaml-dev libgdbm-dev libreadline-dev libncurses5-dev cmake curl wget time rbenv -y
- name: Install Ruby-2.6.10
run: |
git clone https://github.com/rbenv/ruby-build.git
./ruby-build/install.sh
rbenv install 2.6.10
rbenv global 2.6.10
- name: Install pip dependencies
run: |
python3 -m pip install --upgrade pip
python3 -m pip install -r requirements.txt
- name: Run verifier
run: oj-verify run --jobs 4
- name: Generate bundled docs
if: ${{ github.event_name == 'push' && matrix.version == '1.9.1' }}
run: oj-verify docs --jobs 4
- name: Generate API docs
if: ${{ github.event_name == 'push' && matrix.version == '1.9.1' }}
run: crystal docs --progress --stats --time -o dist/api
- name: Build bundled docs
if: ${{ github.event_name == 'push' && matrix.version == '1.9.1' }}
run: |
gem install bundler
bundle install --gemfile=.verify-helper/markdown/Gemfile --path .vendor/bundle
bundle exec --gemfile=.verify-helper/markdown/Gemfile jekyll build --source .verify-helper/markdown --destination dist/docs --baseurl ac-library.cr/docs
- name: Deploy docs to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
if: ${{ github.event_name == 'push' && matrix.version == '1.9.1' }}
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./dist