-
Notifications
You must be signed in to change notification settings - Fork 0
132 lines (121 loc) · 4.07 KB
/
ci.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
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@v3
- 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() && !cancelled() && needs.changes.outputs.src != 'false'
strategy:
fail-fast: false
matrix:
os: ['ubuntu-latest']
nim: ['devel']
name: '${{ matrix.os }} (${{ matrix.nim }})'
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
path: project
- name: Setup Nim
uses: alaviss/[email protected]
with:
path: nim
version: ${{ matrix.nim }}
#- name: Run examples
# shell: bash
# run: |
# cd project
# nimble --accept develop
# cd examples
# env GITHUB_ACTIONS=false balls --path=".."
- name: Run tests
shell: bash
run: |
sudo apt install valgrind
cd project
echo "=========================="
nimble --accept install "https://github.com/disruptek/balls"
echo "=========================="
nimble --accept develop
echo "=========================="
nimble --accept develop
echo "=========================="
nimble list -i
echo "=========================="
nimble test
echo "=========================="
# - name: Build docs
# if: ${{ matrix.docs }} == 'true'
# shell: bash
# run: |
# cd project
# 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" \
# actors.nim
# # Ignore failures for older Nim
# cp docs/{the,}index.html || true
#
# - name: Publish docs
# if: >
# github.event_name == 'push' && github.ref == 'refs/heads/master' &&
# matrix.os == 'macos-latest' && matrix.nim == 'devel'
# uses: crazy-max/[email protected]
# with:
# build_dir: project/docs
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Set check-required on this
success:
needs: build
if: always()
runs-on: ubuntu-latest
name: 'All check passes'
steps:
- if: contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')
name: 'Fail when previous jobs fails'
run: |
echo "::error::One of the previous jobs failed"
exit 1