diff --git a/.github/actionlint-matcher.json b/.github/actionlint-matcher.json new file mode 100644 index 0000000..7bb2864 --- /dev/null +++ b/.github/actionlint-matcher.json @@ -0,0 +1,17 @@ +{ + "problemMatcher": [ + { + "owner": "actionlint", + "pattern": [ + { + "regexp": "^(?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)?:(?:\\x1b\\[\\d+m)?(\\d+)(?:\\x1b\\[\\d+m)?:(?:\\x1b\\[\\d+m)?(\\d+)(?:\\x1b\\[\\d+m)?: (?:\\x1b\\[\\d+m)?(.+?)(?:\\x1b\\[\\d+m)? \\[(.+?)\\]$", + "file": 1, + "line": 2, + "column": 3, + "message": 4, + "code": 5 + } + ] + } + ] +} diff --git a/.github/workflows/lint-swift.yml b/.github/workflows/lint-swift.yml new file mode 100644 index 0000000..aa1a7be --- /dev/null +++ b/.github/workflows/lint-swift.yml @@ -0,0 +1,26 @@ +name: Lint Swift + +on: + pull_request: + branches: + - '*' + paths: + - '**/*.swift' + - 'Package.swift' + - 'Package.resolved' + - '.swiftlint.yml' + - '.github/workflows/lint-swift.yml' + +jobs: + swiftlint: + name: SwiftLint + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Install SwiftLint + run: brew install swiftlint + + - name: Run SwiftLint + run: swiftlint lint --strict diff --git a/.github/workflows/lint-workflows.yml b/.github/workflows/lint-workflows.yml new file mode 100644 index 0000000..7adb7fa --- /dev/null +++ b/.github/workflows/lint-workflows.yml @@ -0,0 +1,30 @@ +name: Lint Workflows + +on: + pull_request: + branches: + - '*' + paths: + - '.github/workflows/*.yml' + - '.github/actionlint-matcher.json' + +jobs: + actionlint: + name: actionlint + runs-on: ubuntu-latest + timeout-minutes: 30 + + steps: + - uses: actions/checkout@v4 + + - name: Download actionlint + id: get_actionlint + run: bash <(curl https://raw.githubusercontent.com/rhysd/actionlint/main/scripts/download-actionlint.bash) + shell: bash + + - name: Register problem matcher + run: echo "::add-matcher::.github/actionlint-matcher.json" + + - name: Run actionlint + run: ${{ steps.get_actionlint.outputs.executable }} -color + shell: bash diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..22acaa8 --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,36 @@ +name: Test + +on: + push: + branches: + - main + paths: + - '**/*.swift' + - 'Package.swift' + - 'Package.resolved' + - '.github/workflows/test.yml' + pull_request: + branches: + - '*' + paths: + - '**/*.swift' + - 'Package.swift' + - 'Package.resolved' + - '.github/workflows/test.yml' + +jobs: + macos: + name: macOS + runs-on: macos-latest + + steps: + - uses: actions/checkout@v4 + + - name: Swift version + run: swift --version + + - name: Build + run: swift build -v + + - name: Run tests + run: swift test -v