-
Notifications
You must be signed in to change notification settings - Fork 0
110 lines (98 loc) · 2.95 KB
/
main.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
name: CI
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the main branch
push:
branches: [ main ]
pull_request:
branches: [ main ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
check-package:
runs-on: ubuntu-latest
strategy:
matrix:
image:
# - docker.io/gnuoctave/octave
- ghcr.io/gnu-octave/octave
version:
- latest
steps:
-
name: Checkout repository
uses: actions/checkout@v3
with:
fetch-depth: 2
-
name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.0'
bundler-cache: true # runs 'bundle install' and caches installed gems automatically
-
name: Create local package repository
run: |
bundle exec jekyll build -d test
-
name: Check for changed packages
run: |
for f in $(git --no-pager diff --name-only HEAD~1 HEAD)
do
if [ "$(dirname $f)" == "packages" ] && [ "${f##*.}" == "yaml" ]
then
name="$(basename $f)"
CHANGED_PACKAGES+=" ${name%.*} "
fi
done
if [ -n "$CHANGED_PACKAGES" ]
then
echo "Changed packages: $CHANGED_PACKAGES"
echo "CHANGED_PACKAGES=\"$CHANGED_PACKAGES\"" >> $GITHUB_ENV
else
echo "No packages changed."
fi
env:
CHANGED_PACKAGES:
-
name: Pull Octave image
if: ${{ env.CHANGED_PACKAGES != '' }}
run: docker pull ${{ matrix.image }}:${{ matrix.version }}
-
name: Octave package test
if: ${{ env.CHANGED_PACKAGES != '' }}
run: |
pkgs=${{ env.CHANGED_PACKAGES }}
for p in $pkgs
do
echo -e "\n\n## Test package '$p'\n\n"
docker run \
--volume="$(pwd):/workdir:rw" \
${{ matrix.image }}:${{ matrix.version }} \
octave-cli --eval "cd /workdir/assets/ci; \
octave_ci('$p', '/workdir/test/packages/index.html')"
done
check-yaml:
runs-on: ubuntu-latest
steps:
-
name: Checkout repository
uses: actions/checkout@v3
-
name: Set up Python 3
uses: actions/setup-python@v4
with:
# Semantic version range syntax or exact version of a Python version
python-version: '3.x'
-
name: Install dependencies
run: |
python -m pip install --upgrade \
pip setuptools wheel yamllint
# FIXME: Remove first line, once the affected file and line number is
# visible by default.
-
name: Run yamllint
run: |
yamllint --format standard -c ./assets/ci/yamllint.yaml packages
yamllint -c ./assets/ci/yamllint.yaml packages