Skip to content

CI

CI #816

Workflow file for this run

name: CI
on:
schedule:
- cron: '30 5 * * *'
push:
branches:
- master
pull_request:
branches:
- '*'
jobs:
changes:
# Disable the filter on scheduled runs because we don't want to skip those
if: github.event_name != 'schedule'
continue-on-error: true # Makes sure errors won't stop us
runs-on: ubuntu-latest
outputs:
src: ${{ steps.filter.outputs.src }}
steps:
# For PRs the path filter check with Github API, so no need to checkout
# for them.
- if: github.event_name != 'pull_request'
name: Checkout (if not PR)
uses: actions/checkout@v2
- uses: dorny/paths-filter@v2
id: filter
with:
filters: |
src:
- '**.cfg'
- '**.nims'
- '**.nim'
- '**.nimble'
- 'tests/**'
- '.github/workflows/ci.yml'
build:
# Build if the files we care about are changed.
needs: changes
# Make sure to always run regardless of whether the filter success or not.
# When the filter fails there won't be an output, so checking for `false`
# state is better than checking for `true`.
#
# The always() function here is required for the job to always run despite
# what Github docs said, see: https://github.com/actions/runner/issues/491
if: always() && needs.changes.outputs.src != 'false'
strategy:
fail-fast: false
matrix:
os: ['macos-latest', 'ubuntu-latest']
nim: ['devel']
name: '${{ matrix.os }} (${{ matrix.nim }})'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
path: ci
- name: Setup Nim
uses: alaviss/[email protected]
with:
path: nim
version: ${{ matrix.nim }}
- name: Dependencies
shell: bash
run: |
cd ci
nimble --accept install "https://github.com/nim-works/cps"
nimble --accept install "https://github.com/disruptek/balls"
nimble --accept develop
- name: Tests
shell: bash
run: |
cd ci
balls --path="." --gc:arc --backend:c --define:danger --define:release
- name: Build docs
if: ${{ matrix.docs }} == 'true'
shell: bash
run: |
cd ci
branch=${{ github.ref }}
branch=${branch##*/}
nimble doc --project --outdir:docs --path="." \
'--git.url:https://github.com/${{ github.repository }}' \
'--git.commit:${{ github.sha }}' \
"--git.devel:$branch" \
loony.nim
# Ignore failures for older Nim
nim doc --outdir:docs --path="." \
'--git.url:https://github.com/${{ github.repository }}' \
'--git.commit:${{ github.sha }}' \
"--git.devel:$branch" \
loony/ward.nim
cp docs/{the,}index.html || true
- name: Publish docs
if: >
github.event_name == 'push' && github.ref == 'refs/heads/master' &&
matrix.os == 'ubuntu-latest' && matrix.nim == 'devel'
uses: crazy-max/[email protected]
with:
build_dir: ci/docs
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Set check-required on this
success:
needs: build
runs-on: ubuntu-latest
name: 'All check passes'
steps:
- run: |
echo "This is a workaround for Github's broken software"