Skip to content

Merge pull request #86 from mxlint/feature/rules-validation #223

Merge pull request #86 from mxlint/feature/rules-validation

Merge pull request #86 from mxlint/feature/rules-validation #223

Workflow file for this run

name: Continuous Integration
on:
push:
branches:
- "*"
pull_request:
types: [opened, reopened, synchronize]
branches: [ main ]
jobs:
unit_tests:
name: "Unit tests"
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Go
uses: actions/setup-go@v4
with:
go-version: ^1.22
- name: Test
run: go test -cover -coverprofile=coverage.txt ./...
- name: Archive code coverage results
uses: actions/upload-artifact@v4
with:
name: code-coverage
path: coverage.txt
- name: Generate coverage HTML report
run: go tool cover -html=coverage.txt -o coverage.html
- name: Upload coverage HTML report artifact
uses: actions/upload-artifact@v4
with:
name: coverage-report
path: coverage.html
code_coverage:
name: "Code coverage report"
if: github.event_name == 'pull_request'
runs-on: ubuntu-latest
needs: unit_tests
permissions:
contents: read
actions: read
pull-requests: write
steps:
- uses: fgrosse/go-coverage-report@v1.1.1
with:
coverage-artifact-name: "code-coverage"
coverage-file-name: "coverage.txt"
build_cli:
name: "Build CLI"
permissions:
contents: read
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Set up Go
uses: actions/setup-go@v5
with:
go-version: ^1.22
- name: Build
run: go build -o bin/mxlint "./"
- name: Archive mxlint binary
uses: actions/upload-artifact@v4
with:
name: mxlint-cli
path: bin
test_export_model_v1:
name: "Test export-model mpr-v1"
permissions:
contents: read
needs: build_cli
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download mxlint binary
uses: actions/download-artifact@v4
with:
name: mxlint-cli
path: bin
- name: Test subcommand export-model mpr-v1
run: |
chmod +x ./bin/mxlint
bin/mxlint export-model --mode basic -i resources/app-mpr-v1 -o resources/modelsource-v1
git diff --exit-code resources/modelsource-v1
test_export_model_v2:
name: "Test export-model mpr-v2"
permissions:
contents: read
needs: build_cli
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download mxlint binary
uses: actions/download-artifact@v4
with:
name: mxlint-cli
path: bin
- name: Test subcommand export-model mpr-v2
run: |
chmod +x ./bin/mxlint
bin/mxlint export-model --mode basic -i resources/app-mpr-v2 -o resources/modelsource-v2
git diff --exit-code resources/modelsource-v2
test_lint:
name: "Test lint"
permissions:
contents: read
needs: build_cli
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download mxlint binary
uses: actions/download-artifact@v4
with:
name: mxlint-cli
path: bin
- name: Test subcommand lint
run: |
chmod +x ./bin/mxlint
./bin/mxlint lint --xunit-report report.xml --rules ./resources/rules -m resources/app-mpr-v1
test_rules:
name: "Test rules"
permissions:
contents: read
needs: build_cli
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Download mxlint binary
uses: actions/download-artifact@v4
with:
name: mxlint-cli
path: bin
- name: Test subcommand test-rules
run: |
chmod +x ./bin/mxlint
./bin/mxlint test-rules --rules ./resources/rules