Skip to content

Commit 2615bf8

Browse files
committed
Update tests
1 parent 81a0bf7 commit 2615bf8

File tree

3 files changed

+72
-21
lines changed

3 files changed

+72
-21
lines changed

.github/workflows/ci.yml

Lines changed: 16 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
---
22
#
3-
# Copyright (C) 2024-2025 James Cherti | https://www.jamescherti.com/contact/
4-
# URL: https://github.com/jamescherti/flymake-ansible-lint.el
5-
#
63
# This file is free software; you can redistribute it and/or modify
74
# it under the terms of the GNU General Public License as published by
85
# the Free Software Foundation; either version 2, or (at your option)
@@ -18,7 +15,7 @@
1815
#
1916

2017
name: CI
21-
on: [push, pull_request]
18+
on: [push, pull_request] # yamllint disable-line rule:truthy
2219

2320
jobs:
2421
test:
@@ -31,17 +28,16 @@ jobs:
3128
- 28.1
3229
- 29.1
3330
- 29.4
31+
- 30.1
3432
python-version:
3533
- 3.11
3634
steps:
35+
# Cask
3736
- uses: actions/checkout@v2
38-
- name: Set up Python ${{ matrix.python-version }}
39-
uses: actions/setup-python@v1
40-
with:
41-
python-version: ${{ matrix.python-version }}
4237
- uses: purcell/setup-emacs@master
4338
with:
4439
version: ${{ matrix.emacs-version }}
40+
4541
- uses: actions/cache@v4
4642
id: cache-cask-packages
4743
with:
@@ -58,15 +54,18 @@ jobs:
5854
version: snapshot
5955
- run: echo "$HOME/.cask/bin" >> $GITHUB_PATH
6056

61-
- name: Install
62-
run: |
63-
python -m pip install --upgrade pip
64-
git clone https://github.com/riscy/melpazoid.git ~/melpazoid
65-
python -m pip install ~/melpazoid
57+
# Tests
58+
- name: Compile
59+
run: make compile
60+
env:
61+
CASK_PATH: $HOME/.cask/bin
62+
63+
- name: Package-lint
64+
run: make package-lint
65+
env:
66+
CASK_PATH: $HOME/.cask/bin
6667

67-
- name: Run melpazoid
68+
- name: Unit-tests
69+
run: make test
6870
env:
69-
RECIPE: (flymake-ansible-lint :repo "jamescherti/flymake-ansible-lint.el" :branch "${{ github.ref_name }}" :fetcher github :files ("flymake-ansible-lint.el"))
70-
EXIST_OK: false
7171
CASK_PATH: $HOME/.cask/bin
72-
run: 'echo -e "Ref: $GITHUB_REF\n$(emacs --version)" && make -C ~/melpazoid'

.github/workflows/melpazoid.yml

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,33 @@
1+
---
2+
3+
# melpazoid <https://github.com/riscy/melpazoid> build checks.
4+
5+
# If your package is on GitHub, enable melpazoid's checks by copying this file
6+
# to .github/workflows/melpazoid.yml and modifying RECIPE and EXIST_OK below.
7+
8+
name: melpazoid
9+
on: [push, pull_request]
10+
11+
jobs:
12+
build:
13+
runs-on: ubuntu-latest
14+
steps:
15+
- uses: actions/checkout@v3
16+
- name: Set up Python 3.11
17+
uses: actions/setup-python@v4
18+
with:
19+
python-version: '3.11'
20+
- name: Install
21+
run: |
22+
python -m pip install --upgrade pip
23+
sudo apt-get install emacs && emacs --version
24+
git clone https://github.com/riscy/melpazoid.git ~/melpazoid
25+
pip install ~/melpazoid
26+
cat ~/melpazoid/melpazoid/melpazoid.el
27+
- name: Run
28+
env:
29+
LOCAL_REPO: "${{ github.workspace }}"
30+
RECIPE: (flymake-ansible-lint :fetcher github :repo "jamescherti/flymake-ansible-lint.el" :branch "${{ github.ref_name }}" :files ("flymake-ansible-lint.el"))
31+
# Set EXIST_OK to false (or remove it) if the package isn't on MELPA
32+
EXIST_OK: true
33+
run: echo $GITHUB_REF && make -C ~/melpazoid

Makefile

Lines changed: 23 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,4 @@
11
#
2-
# Copyright (C) 2024-2025 James Cherti | https://www.jamescherti.com/contact/
3-
# URL: https://github.com/jamescherti/flymake-ansible-lint.el
4-
#
52
# This file is free software; you can redistribute it and/or modify
63
# it under the terms of the GNU General Public License as published by
74
# the Free Software Foundation; either version 2, or (at your option)
@@ -19,6 +16,20 @@
1916
export EMACS ?= $(shell command -v emacs 2>/dev/null)
2017
CASK_DIR := $(shell cask package-directory)
2118

19+
INIT_PACKAGES="(progn \
20+
(require 'package) \
21+
(push '(\"melpa-stable\" . \"https://stable.melpa.org/packages/\") package-archives) \
22+
(customize-set-variable 'package-archive-priorities \
23+
'((\"gnu\" . 99) (\"nongnu\" . 80) \
24+
(\"melpa-stable\" . 70) (\"melpa\" . 0))) \
25+
(package-initialize) \
26+
(package-refresh-contents) \
27+
(dolist (pkg '(package-lint)) \
28+
(unless (assoc pkg package-archive-contents) \
29+
(package-refresh-contents)) \
30+
(unless (package-installed-p pkg) \
31+
(package-install pkg))))"
32+
2233
$(CASK_DIR): Cask
2334
cask install
2435
@touch $(CASK_DIR)
@@ -28,7 +39,15 @@ cask: $(CASK_DIR)
2839

2940
.PHONY: compile
3041
compile: cask
31-
cask emacs -batch -L . -L test \
42+
cask emacs -batch -L . \
3243
--eval "(setq byte-compile-error-on-warn t)" \
3344
-f batch-byte-compile $$(cask files); \
3445
(ret=$$? ; cask clean-elc && exit $$ret)
46+
47+
.PHONY: package-lint
48+
package-lint:
49+
cask emacs -Q --eval ${INIT_PACKAGES} -batch -f package-lint-batch-and-exit flymake-ansible-lint.el
50+
51+
.PHONY: test
52+
test:
53+
if test -d tests; then cask emacs --batch -L . -L tests -l tests/test-flymake-ansible-lint.el -f ert-run-tests-batch-and-exit; else true; fi

0 commit comments

Comments
 (0)