Skip to content

Commit

Permalink
Initial commit
Browse files Browse the repository at this point in the history
  • Loading branch information
brondani committed Jan 10, 2024
1 parent 899189f commit 7f3fde8
Show file tree
Hide file tree
Showing 43 changed files with 2,135 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
version: "2"
checks:
argument-count:
enabled: false
complex-logic:
enabled: false
identical-code:
enabled: true
file-lines:
enabled: false
method-complexity:
enabled: false
method-count:
enabled: false
method-lines:
enabled: false
nested-control-flow:
enabled: false
return-statements:
enabled: false
similar-code:
enabled: true

exclude_patterns:
- "scripts/"
- ".github/"
- "test/"
- "**/*_test.go"
13 changes: 13 additions & 0 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
version: 2
updates:
- package-ecosystem: github-actions
directory: "/"
schedule:
interval: "weekly"
open-pull-requests-limit: 10
rebase-strategy: disabled

- package-ecosystem: gomod
directory: /
schedule:
interval: daily
15 changes: 15 additions & 0 deletions .github/markdown-link-check.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
{
"ignorePatterns": [
{
"pattern": "^https://opensource.org"
}
],
"httpHeaders": [
{
"urls": ["https://github.com/", "https://guides.github.com/", "https://help.github.com/", "https://docs.github.com/"],
"headers": {
"Accept-Encoding": "zstd, br, gzip, deflate"
}
}
],
}
18 changes: 18 additions & 0 deletions .github/markdownlint.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
{
"problemMatcher": [
{
"owner": "markdownlint",
"severity": "warning",
"pattern": [
{
"regexp": "^(.*):(\\d+)(:(\\d+))? (MD\\d+\\/[^ ]+) (.*)$",
"file": 1,
"line": 2,
"column": 4,
"code": 5,
"message": 6
}
]
}
]
}
10 changes: 10 additions & 0 deletions .github/markdownlint.jsonc
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"default": true,
"MD013": {
"line_length": 120
},
"MD029": false,
"MD025": false,
"MD034": false,
"MD041": false
}
94 changes: 94 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build

on:
pull_request:
paths:
- '.github/workflows/build.yml'
- 'cmd/**'
- 'pkg/**'
- 'test/**'
- 'go.mod'
- 'go.sum'
- 'makefile'
- '!**/*.md'
push:
branches: [ main ]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

# Declare default permissions as read only.
permissions: read-all

jobs:

build:
name: Build
runs-on: ubuntu-latest
steps:
- name: Check out repository code
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Install Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: go.mod
check-latest: true

- name: Build executables
run: |
GOOS=windows GOARCH=amd64 go build -o build/win-amd64/cbuild2cmake.exe ./cmd/cbuild2cmake
GOOS=windows GOARCH=arm64 go build -o build/win-arm64/cbuild2cmake.exe ./cmd/cbuild2cmake
GOOS=darwin GOARCH=amd64 go build -o build/mac-amd64/cbuild2cmake ./cmd/cbuild2cmake
GOOS=darwin GOARCH=arm64 go build -o build/mac-arm64/cbuild2cmake ./cmd/cbuild2cmake
GOOS=linux GOARCH=amd64 go build -o build/lin-amd64/cbuild2cmake ./cmd/cbuild2cmake
GOOS=linux GOARCH=arm64 go build -o build/lin-arm64/cbuild2cmake ./cmd/cbuild2cmake
- name: Archive windows amd64 binaries
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: cbuild2cmake-windows-amd64
path: ./build/win-amd64/cbuild2cmake.exe
retention-days: 1
if-no-files-found: error

- name: Archive windows arm64 binaries
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: cbuild2cmake-windows-arm64
path: ./build/win-arm64/cbuild2cmake.exe
retention-days: 1
if-no-files-found: error

- name: Archive macos amd64 binaries
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: cbuild2cmake-mac-amd64
path: ./build/mac-amd64/cbuild2cmake
retention-days: 1
if-no-files-found: error

- name: Archive macos arm64 binaries
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: cbuild2cmake-mac-arm64
path: ./build/mac-arm64/cbuild2cmake
retention-days: 1
if-no-files-found: error

- name: Archive linux amd64 binaries
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: cbuild2cmake-lin-amd64
path: ./build/lin-amd64/cbuild2cmake
retention-days: 1
if-no-files-found: error

- name: Archive linux arm64 binaries
uses: actions/upload-artifact@a8a3f3ad30e3422c9c7b888a15615d19a852ae32 # v3.1.3
with:
name: cbuild2cmake-lin-arm64
path: ./build/lin-arm64/cbuild2cmake
retention-days: 1
if-no-files-found: error
51 changes: 51 additions & 0 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
name: "CodeQL"

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]
paths:
- '.github/workflows/codeql.yml'
- 'cmd/**'
- 'pkg/**'
- 'test/**'
- 'go.mod'
- 'go.sum'
- 'makefile'
- '!**/*.md'

permissions:
contents: read

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
permissions:
actions: read
contents: read
security-events: write
strategy:
fail-fast: false

steps:
- name: Checkout repository
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Initialize CodeQL
uses: github/codeql-action/init@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8
with:
languages: go
queries: security-and-quality

- name: Build executables
run: |
go build ./cmd/cbuild2cmake
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@407ffafae6a767df3e0230c3df91b6443ae8df75 # v2.22.8
26 changes: 26 additions & 0 deletions .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# Dependency Review Action
#
# This Action will scan dependency manifest files that change as part of a Pull Request,
# surfacing known-vulnerable versions of the packages declared or updated in the PR.
# Once installed, if the workflow run is marked as required,
# PRs introducing known-vulnerable packages will be blocked from merging.
#
# Source repository: https://github.com/actions/dependency-review-action
name: 'Dependency Review'
on: [pull_request]

permissions:
contents: read

jobs:
dependency-review:
runs-on: ubuntu-latest
permissions:
pull-requests: write
steps:
- name: 'Checkout Repository'
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1
- name: 'Dependency Review'
uses: actions/dependency-review-action@7bbfa034e752445ea40215fff1c3bf9597993d3f # v3.1.3
with:
comment-summary-in-pr: true
28 changes: 28 additions & 0 deletions .github/workflows/global.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
name: global
on:
pull_request:
paths:
- '.github/workflows/global.yml'
- '.pre-commit-config.yaml'
- 'scripts/check_copyright_notice.py'
- '**/*.go'
- '!**/docs/**/*'
- '!**/*.md'

# Declare default permissions as read only.
permissions: read-all

jobs:
copyright:
runs-on: ubuntu-latest
steps:
- name: Checkout devtools
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Check copyright notice
run: |
pip install \
pre-commit \
python-magic==0.4.18 \
comment-parser>=1.2.3
pre-commit run --all-files
44 changes: 44 additions & 0 deletions .github/workflows/markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
name: markdown
on:
pull_request:
paths:
- '.github/workflows/markdown.yml'
- '.github/markdownlint.json'
- '.github/markdownlint.jsonc'
- '**/*.md'

# Declare default permissions as read only.
permissions: read-all

jobs:
markdown-lint:
name: Lint markdown files
runs-on: ubuntu-22.04
steps:
- name: Checkout devtools
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Register markdownlint warning matcher
run: |
echo "::add-matcher::.github/markdownlint.json"
- name: Lint markdown files
uses: avto-dev/markdown-lint@04d43ee9191307b50935a753da3b775ab695eceb # v1.5.0
with:
args: '**/*.md'
config: '.github/markdownlint.jsonc'
ignore: 'third_party_licenses.md'

- name: Remove markdownlint warning matcher
if: always()
run: |
echo "::remove-matcher owner=markdownlint::"
- uses: gaurav-nelson/github-action-markdown-link-check@0f074c8562c5a8fed38282b7c741d1970bb1512d # master
if: always()
with:
use-quiet-mode: 'yes'
use-verbose-mode: 'yes'
check-modified-files-only: 'yes'
base-branch: ${{ github.base_ref }}
config-file: '.github/markdown-link-check.jsonc'
56 changes: 56 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Release

on:
push:
tags:
- "v*"

jobs:
test:
uses: Open-CMSIS-Pack/cbuild2cmake/.github/workflows/test.yml@main

goreleaser:
needs: test
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- name: Download coverage report
uses: actions/download-artifact@9bc31d5ccc31df68ecc42ccf4149144866c47d8a # v3.0.2
with:
name: test-results
path: testreport/

- name: Zip test reports
run: |
zip -r testreport.zip testreport
- name: Attach coverage report to release assets
uses: svenstaro/upload-release-action@1beeb572c19a9242f4361f4cee78f8e0d9aec5df # v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: testreport.zip
tag: ${{ github.ref }}
overwrite: true

- name: Checkout
uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1

- name: Install Go
uses: actions/setup-go@93397bea11091df50f3d7e59dc26a7711a8bcfbe # v4.1.0
with:
go-version-file: go.mod
check-latest: true

- name: Generate release notes
run: |
git fetch --unshallow
./scripts/release_notes > /tmp/RELEASE_NOTES
- name: Run GoReleaser
uses: goreleaser/goreleaser-action@7ec5c2b0c6cdda6e8bbb49444bc797dd33d74dd8 # v5.0.0
with:
version: latest
args: release --rm-dist --release-notes=/tmp/RELEASE_NOTES
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
Loading

0 comments on commit 7f3fde8

Please sign in to comment.