Repository navigation
update ci actions #267
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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 | |
| mkdir -p .ci | |
| cat > .ci/export-v1.yaml << 'EOF' | |
| projectDirectory: resources/app-mpr-v1 | |
| modelsource: resources/modelsource-v1 | |
| export: | |
| mode: basic | |
| filter: ".*" | |
| raw: false | |
| appstore: false | |
| EOF | |
| ./bin/mxlint --config .ci/export-v1.yaml export-model | |
| 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 | |
| mkdir -p .ci | |
| cat > .ci/export-v2.yaml << 'EOF' | |
| projectDirectory: resources/app-mpr-v2 | |
| modelsource: resources/modelsource-v2 | |
| export: | |
| mode: basic | |
| filter: ".*" | |
| raw: false | |
| appstore: false | |
| EOF | |
| ./bin/mxlint --config .ci/export-v2.yaml export-model | |
| 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 | |
| mkdir -p .ci | |
| cat > .ci/lint.yaml << 'EOF' | |
| rules: | |
| path: ./resources/rules | |
| modelsource: resources/modelsource-v1 | |
| lint: | |
| xunitReport: report.xml | |
| EOF | |
| ./bin/mxlint --config .ci/lint.yaml lint | |
| 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 | |
| mkdir -p .ci | |
| cat > .ci/test-rules.yaml << 'EOF' | |
| rules: | |
| path: ./resources/rules | |
| EOF | |
| ./bin/mxlint --config .ci/test-rules.yaml test-rules |