Skip to content

Commit 1663f9b

Browse files
authored
Merge pull request #9 from agoodway/copilot/fix-8
Set up GitHub Actions CI workflow with Elixir testing best practices
2 parents 0fb7e58 + cd3ff09 commit 1663f9b

File tree

4 files changed

+235
-0
lines changed

4 files changed

+235
-0
lines changed

.github/workflows/ci.yml

Lines changed: 144 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,144 @@
1+
name: CI
2+
3+
on:
4+
push:
5+
branches: [ main, master ]
6+
pull_request:
7+
branches: [ main, master ]
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
MIX_ENV: test
14+
15+
jobs:
16+
test:
17+
name: Test
18+
runs-on: ubuntu-latest
19+
strategy:
20+
matrix:
21+
include:
22+
# Elixir 1.15 with compatible OTP versions
23+
- elixir: '1.15.0'
24+
otp: '25.0'
25+
- elixir: '1.15.0'
26+
otp: '26.0'
27+
# Elixir 1.16 with compatible OTP versions
28+
- elixir: '1.16.0'
29+
otp: '25.0'
30+
- elixir: '1.16.0'
31+
otp: '26.0'
32+
# Elixir 1.17 with compatible OTP versions
33+
- elixir: '1.17.0'
34+
otp: '25.0'
35+
- elixir: '1.17.0'
36+
otp: '26.0'
37+
- elixir: '1.17.0'
38+
otp: '27.0'
39+
40+
steps:
41+
- name: Checkout code
42+
uses: actions/checkout@v4
43+
44+
- name: Set up Elixir
45+
uses: erlef/setup-beam@v1
46+
with:
47+
elixir-version: ${{ matrix.elixir }}
48+
otp-version: ${{ matrix.otp }}
49+
50+
- name: Cache dependencies
51+
uses: actions/cache@v4
52+
with:
53+
path: |
54+
deps
55+
_build
56+
key: ${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-${{ hashFiles('**/mix.lock') }}
57+
restore-keys: |
58+
${{ runner.os }}-mix-${{ matrix.elixir }}-${{ matrix.otp }}-
59+
${{ runner.os }}-mix-
60+
61+
- name: Install dependencies
62+
run: mix deps.get
63+
64+
- name: Check formatting
65+
run: mix format --check-formatted
66+
67+
- name: Compile
68+
run: mix compile --warnings-as-errors
69+
70+
- name: Run security checks
71+
run: mix sobelow --config
72+
73+
- name: Run linting
74+
run: mix credo --only warning
75+
76+
- name: Run tests
77+
run: mix test
78+
79+
coverage:
80+
name: Coverage
81+
runs-on: ubuntu-latest
82+
steps:
83+
- name: Checkout code
84+
uses: actions/checkout@v4
85+
86+
- name: Set up Elixir
87+
uses: erlef/setup-beam@v1
88+
with:
89+
elixir-version: '1.17.0'
90+
otp-version: '27.0'
91+
92+
- name: Cache dependencies
93+
uses: actions/cache@v4
94+
with:
95+
path: |
96+
deps
97+
_build
98+
key: ${{ runner.os }}-mix-coverage-${{ hashFiles('**/mix.lock') }}
99+
restore-keys: |
100+
${{ runner.os }}-mix-coverage-
101+
${{ runner.os }}-mix-
102+
103+
- name: Install dependencies
104+
run: mix deps.get
105+
106+
- name: Run tests with coverage
107+
run: mix coveralls.html
108+
109+
- name: Upload coverage reports
110+
uses: actions/upload-artifact@v4
111+
with:
112+
name: coverage-report
113+
path: cover/
114+
retention-days: 30
115+
116+
quality:
117+
name: Quality Checks
118+
runs-on: ubuntu-latest
119+
steps:
120+
- name: Checkout code
121+
uses: actions/checkout@v4
122+
123+
- name: Set up Elixir
124+
uses: erlef/setup-beam@v1
125+
with:
126+
elixir-version: '1.17.0'
127+
otp-version: '27.0'
128+
129+
- name: Cache dependencies
130+
uses: actions/cache@v4
131+
with:
132+
path: |
133+
deps
134+
_build
135+
key: ${{ runner.os }}-mix-quality-${{ hashFiles('**/mix.lock') }}
136+
restore-keys: |
137+
${{ runner.os }}-mix-quality-
138+
${{ runner.os }}-mix-
139+
140+
- name: Install dependencies
141+
run: mix deps.get
142+
143+
- name: Run quality checks
144+
run: mix quality

.github/workflows/quick-test.yml

Lines changed: 47 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
name: Quick Tests
2+
3+
on:
4+
workflow_dispatch:
5+
schedule:
6+
# Run weekly on Sundays at 6 AM UTC
7+
- cron: '0 6 * * 0'
8+
9+
permissions:
10+
contents: read
11+
12+
env:
13+
MIX_ENV: test
14+
15+
jobs:
16+
quick-test:
17+
name: Quick Test on Latest Versions
18+
runs-on: ubuntu-latest
19+
steps:
20+
- name: Checkout code
21+
uses: actions/checkout@v4
22+
23+
- name: Set up Elixir
24+
uses: erlef/setup-beam@v1
25+
with:
26+
elixir-version: '1.17.0'
27+
otp-version: '27.0'
28+
29+
- name: Cache dependencies
30+
uses: actions/cache@v4
31+
with:
32+
path: |
33+
deps
34+
_build
35+
key: ${{ runner.os }}-mix-quick-${{ hashFiles('**/mix.lock') }}
36+
restore-keys: |
37+
${{ runner.os }}-mix-quick-
38+
${{ runner.os }}-mix-
39+
40+
- name: Install dependencies
41+
run: mix deps.get
42+
43+
- name: Compile
44+
run: mix compile
45+
46+
- name: Run tests
47+
run: mix test --trace

.sobelow-conf

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
[
2+
verbose: true,
3+
private: false,
4+
skip: false,
5+
router: "",
6+
exit: "low",
7+
format: "txt",
8+
out: "",
9+
threshold: "low",
10+
ignore: [],
11+
ignore_files: []
12+
]

README.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
[![Hex.pm](https://img.shields.io/hexpm/v/html2markdown.svg)](https://hex.pm/packages/html2markdown)
44
[![Hex Docs](https://img.shields.io/badge/hex-docs-purple.svg)](https://hexdocs.pm/html2markdown)
55
[![License](https://img.shields.io/hexpm/l/html2markdown.svg)](https://github.com/cpursley/html2markdown/blob/main/LICENSE)
6+
[![CI](https://github.com/agoodway/html2markdown/workflows/CI/badge.svg)](https://github.com/agoodway/html2markdown/actions/workflows/ci.yml)
67

78
Convert HTML to clean, readable Markdown. Designed for content extraction, this library handles common HTML patterns while filtering out non-content elements like navigation and and scripts.
89

@@ -105,6 +106,37 @@ email_html
105106

106107
Full documentation is available at [https://hexdocs.pm/html2markdown](https://hexdocs.pm/html2markdown).
107108

109+
## Development
110+
111+
This project includes comprehensive testing and quality assurance tools:
112+
113+
### Running Tests
114+
```bash
115+
# Run all tests
116+
mix test
117+
118+
# Run tests with coverage
119+
mix coveralls.html
120+
```
121+
122+
### Code Quality
123+
```bash
124+
# Run all quality checks (formatting, security, linting)
125+
mix quality
126+
127+
# Individual checks
128+
mix format --check-formatted # Code formatting
129+
mix credo --only warning # Code linting
130+
mix sobelow --config # Security analysis
131+
```
132+
133+
### CI/CD
134+
This project uses GitHub Actions for continuous integration with:
135+
- Multi-version testing (Elixir 1.15-1.17, OTP 25-27)
136+
- Code quality enforcement
137+
- Security scanning
138+
- Test coverage reporting
139+
108140
## License
109141

110142
MIT License - see [LICENSE](LICENSE) file for details.

0 commit comments

Comments
 (0)