diff --git a/.github/workflows/auto_author_assign.yml b/.github/workflows/auto_author_assign.yml new file mode 100644 index 0000000..b5cbbc3 --- /dev/null +++ b/.github/workflows/auto_author_assign.yml @@ -0,0 +1,12 @@ +name: Auto Author Assign + +on: workflow_call + +permissions: + pull-requests: write + +jobs: + assign-author: + runs-on: ubuntu-latest + steps: + - uses: toshimaru/auto-author-assign@4d585cc37690897bd9015942ed6e766aa7cdb97f diff --git a/.github/workflows/dependent-issues.yml b/.github/workflows/dependent-issues.yml new file mode 100644 index 0000000..201c6b0 --- /dev/null +++ b/.github/workflows/dependent-issues.yml @@ -0,0 +1,15 @@ +name: Dependent Issues + +on: + workflow_call: + secrets: + GITHUB_TOKEN: + required: true + +jobs: + check_dependencies: + runs-on: ubuntu-latest + steps: + - uses: z0al/dependent-issues@950226e7ca8fc43dc209a7febf67c655af3bdb43 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/periphery.yml b/.github/workflows/periphery.yml new file mode 100644 index 0000000..550d384 --- /dev/null +++ b/.github/workflows/periphery.yml @@ -0,0 +1,24 @@ +name: Periphery + +on: + workflow_call: + inputs: + setup_step: + required: false + type: string + default: 'echo "Nothing to do"' + +jobs: + periphery: + runs-on: [ self-hosted, iOS ] + + steps: + - name: Checkout + uses: actions/checkout@v6 + - uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 + - name: Setup Step + run: ${{ inputs.setup_step }} + - name: Generate + run: tuist install && tuist generate + - name: Periphery + run: periphery scan --retain-codable-properties --format github-actions --relative-results --strict diff --git a/.github/workflows/semantic-commit.yml b/.github/workflows/semantic-commit.yml new file mode 100644 index 0000000..f91ca8c --- /dev/null +++ b/.github/workflows/semantic-commit.yml @@ -0,0 +1,21 @@ +name: Check Commit Message + +on: + workflow_call: + secrets: + GITHUB_TOKEN: + required: true + +jobs: + check-commit-message: + runs-on: ubuntu-latest + steps: + - name: Check Commit Message + uses: gsactions/commit-message-checker@16fa2d5de096ae0d35626443bcd24f1e756cafee + with: + pattern: '^(Merge .+|((feat|fix|chore|docs|style|refactor|perf|ci|test)(\(.+\))?: [A-Z0-9].+[^.\s])$)' + error: 'Commit messages and PR title should match conventional commit convention and start with an uppercase.' + excludeDescription: 'true' + excludeTitle: 'false' + checkAllCommitMessages: 'true' + accessToken: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/swiftformat.yml b/.github/workflows/swiftformat.yml new file mode 100644 index 0000000..738a9d8 --- /dev/null +++ b/.github/workflows/swiftformat.yml @@ -0,0 +1,14 @@ +name: SwiftFormat + +on: workflow_call + +jobs: + format: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v6 + - uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 + - name: SwiftFormat + run: swiftformat --lint . --reporter github-actions-log diff --git a/.github/workflows/swiftlint.yml b/.github/workflows/swiftlint.yml new file mode 100644 index 0000000..8e879b5 --- /dev/null +++ b/.github/workflows/swiftlint.yml @@ -0,0 +1,14 @@ +name: SwiftLint + +on: workflow_call + +jobs: + lint: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v6 + - uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 + - name: SwiftLint + run: swiftlint --config .swiftlint.yml --config .swiftlint-ci.yml --reporter github-actions-logging . diff --git a/.github/workflows/validate-localization.yml b/.github/workflows/validate-localization.yml new file mode 100644 index 0000000..8bba47b --- /dev/null +++ b/.github/workflows/validate-localization.yml @@ -0,0 +1,30 @@ +name: Validate localization files + +on: + workflow_call: + inputs: + localizable_path: + required: true + type: string + main_target_localizable_path: + required: true + type: string + secrets: + LOCO_KEY: + required: true + +jobs: + validate: + runs-on: ubuntu-latest + + steps: + - name: Checkout + uses: actions/checkout@v6 + - name: Setup mise + uses: jdx/mise-action@6d1e696aa24c1aa1bcc1adea0212707c71ab78a8 + - name: Create configuration file + run: | + touch ${GITHUB_WORKSPACE}/.import_loco + echo -e "[project]\nlocalizable_path = ${GITHUB_WORKSPACE}/${{ inputs.localizable_path }}\nmain_target_localizable_path = ${GITHUB_WORKSPACE}/${{ inputs.main_target_localizable_path }}\nloco_key = $LOCO_KEY" > ${GITHUB_WORKSPACE}/.import_loco + - name: Validate + run: import_loco project -c --config-file ${GITHUB_WORKSPACE}/.import_loco diff --git a/workflow-templates/auto-author-assign.yml b/workflow-templates/auto-author-assign.yml index 85901ce..d79f156 100644 --- a/workflow-templates/auto-author-assign.yml +++ b/workflow-templates/auto-author-assign.yml @@ -4,11 +4,13 @@ on: pull_request_target: types: [ opened, reopened ] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + permissions: pull-requests: write jobs: assign-author: - runs-on: ubuntu-latest - steps: - - uses: toshimaru/auto-author-assign@v2.1.0 + uses: infomaniak/.github/.github/workflows/auto_author_assign.yml@ diff --git a/workflow-templates/conventional-commit.yml b/workflow-templates/conventional-commit.yml index 29bcd36..aacc930 100644 --- a/workflow-templates/conventional-commit.yml +++ b/workflow-templates/conventional-commit.yml @@ -1,23 +1,18 @@ -name: 'PR and Commit Message Check' +name: Check Commit Message + on: - pull_request_target: + pull_request: types: - opened - edited - reopened - synchronize +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: check-commit-message: - name: Check Commit Message - runs-on: ubuntu-latest - steps: - - name: Check Commit Message - uses: gsactions/commit-message-checker@v2 - with: - pattern: '^(Merge .+|((feat|fix|chore|docs|style|refactor|perf|ci|test)(\(.+\))?: [A-Z0-9].+[^.\s])$)' - error: 'Commit messages and PR title should match conventional commit convention and start with an uppercase.' - excludeDescription: 'true' - excludeTitle: 'false' - checkAllCommitMessages: 'true' - accessToken: ${{ secrets.GITHUB_TOKEN }} + uses: infomaniak/.github/.github/workflows/semantic-commit.yml@ + secrets: inherit diff --git a/workflow-templates/dependent-issues.yml b/workflow-templates/dependent-issues.yml index 19524f7..496311e 100644 --- a/workflow-templates/dependent-issues.yml +++ b/workflow-templates/dependent-issues.yml @@ -13,16 +13,13 @@ on: - edited - closed - reopened - # Makes sure we always add status check for PRs. Useful only if - # this action is required to pass before merging. Otherwise, it - # can be removed. - synchronize +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true + jobs: - check: - runs-on: ubuntu-latest - steps: - - uses: z0al/dependent-issues@v1.5.2 - env: - # (Required) The token to use to make API calls to GitHub. - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + check_dependencies: + uses: infomaniak/.github/.github/workflows/dependent-issues.yml@ + secrets: inherit diff --git a/workflow-templates/swiftformat.yml b/workflow-templates/swiftformat.yml index d3791ae..6b55409 100644 --- a/workflow-templates/swiftformat.yml +++ b/workflow-templates/swiftformat.yml @@ -1,25 +1,11 @@ name: SwiftFormat -on: - pull_request: - branches: [ $default-branch ] +on: pull_request -jobs: - build: - name: SwiftFormat - runs-on: [ self-hosted, iOS ] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - uses: jdx/mise-action@v2 - with: - cache: false - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: SwiftFormat - run: swiftformat --lint . --reporter github-actions-log +jobs: + format: + uses: infomaniak/.github/.github/workflows/swiftformat.yml@ diff --git a/workflow-templates/swiftlint.yml b/workflow-templates/swiftlint.yml index d86642e..106c2a3 100644 --- a/workflow-templates/swiftlint.yml +++ b/workflow-templates/swiftlint.yml @@ -1,25 +1,11 @@ name: SwiftLint -on: - pull_request: - branches: [ $default-branch ] +on: pull_request -jobs: - build: - name: SwiftLint - runs-on: [ self-hosted, iOS ] +concurrency: + group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }} + cancel-in-progress: true - steps: - - name: Cancel Previous Runs - uses: styfle/cancel-workflow-action@0.12.1 - with: - access_token: ${{ github.token }} - - uses: jdx/mise-action@v2 - with: - cache: false - - name: Checkout - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - name: SwiftLint - run: swiftlint --config .swiftlint.yml --config .swiftlint-ci.yml --reporter github-actions-logging . +jobs: + lint: + uses: infomaniak/.github/.github/workflows/swiftlint.yml@