|
| 1 | +name: Crystal CI |
| 2 | + |
| 3 | +on: |
| 4 | + push: |
| 5 | + pull_request: |
| 6 | + schedule: |
| 7 | + - cron: '0 0 * * *' |
| 8 | + |
| 9 | +jobs: |
| 10 | + check_format: |
| 11 | + runs-on: ubuntu-latest |
| 12 | + container: crystallang/crystal |
| 13 | + steps: |
| 14 | + - name: Check out repository code |
| 15 | + uses: actions/checkout@v2 |
| 16 | + |
| 17 | + - name: Install dependencies |
| 18 | + run: shards install --ignore-crystal-version |
| 19 | + |
| 20 | + - name: Check format |
| 21 | + run: crystal tool format --check |
| 22 | + check_ameba: |
| 23 | + runs-on: ubuntu-latest |
| 24 | + container: crystallang/crystal |
| 25 | + steps: |
| 26 | + - name: Check out repository code |
| 27 | + uses: actions/checkout@v2 |
| 28 | + |
| 29 | + - name: Install dependencies |
| 30 | + run: shards install --ignore-crystal-version |
| 31 | + |
| 32 | + - name: Check ameba |
| 33 | + run: ./bin/ameba |
| 34 | + test: |
| 35 | + runs-on: ubuntu-latest |
| 36 | + strategy: |
| 37 | + matrix: |
| 38 | + crystal: ["crystallang/crystal", "crystallang/crystal:nightly"] |
| 39 | + container: ${{ matrix.crystal }} |
| 40 | + # Service containers to run with `container-job` |
| 41 | + services: |
| 42 | + # Label used to access the service container |
| 43 | + postgres: |
| 44 | + # Docker Hub image |
| 45 | + image: postgres |
| 46 | + # Provide the password for postgres |
| 47 | + env: |
| 48 | + POSTGRES_PASSWORD: postgres |
| 49 | + # Set health checks to wait until postgres has started |
| 50 | + options: >- |
| 51 | + --health-cmd pg_isready |
| 52 | + --health-interval 10s |
| 53 | + --health-timeout 5s |
| 54 | + --health-retries 5 |
| 55 | + steps: |
| 56 | + # Downloads a copy of the code in your repository before running CI tests |
| 57 | + - name: Check out repository code |
| 58 | + uses: actions/checkout@v2 |
| 59 | + |
| 60 | + # Performs a clean installation of all dependencies in the `shard.yml` file |
| 61 | + - name: Install dependencies |
| 62 | + run: shards install --ignore-crystal-version |
| 63 | + |
| 64 | + - name: Run tests |
| 65 | + run: crystal spec |
| 66 | + env: |
| 67 | + POSTGRES_HOST: postgres |
| 68 | + POSTGRES_PORT: 5432 |
| 69 | + POSTGRES_USER: postgres |
| 70 | + POSTGRES_PASSWORD: postgres |
| 71 | + POSTGRES_DB: postgres |
0 commit comments