Skip to content

Commit

Permalink
CONFIG: Update CI workflows (#149)
Browse files Browse the repository at this point in the history
* CONFIG: Update CI workflows

* CONFIG: Update CI workflows

* CONFIG: Update CI workflows

* Update CodeQL Xcode version
  • Loading branch information
adamayoung authored Jan 30, 2024
1 parent 0cfbd7e commit 6eb041c
Show file tree
Hide file tree
Showing 7 changed files with 147 additions and 58 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/ci-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Documentation CI

on:
pull_request:
branches:
- main
workflow_dispatch:

concurrency:
group: "ci-documentation-${{ github.head_ref || github.run_id }}"
cancel-in-progress: true

jobs:
build-documentation:
name: Build Documentation
runs-on: ubuntu-latest
env:
SWIFTCI_DOCC: 1
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build
run: swift package generate-documentation --product TMDb
19 changes: 5 additions & 14 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: CI

on:
push:
pull_request:
branches:
- main
pull_request:
push:
branches:
- main
paths:
- ".github/workflows/ci.yml"
- "**/*.swift"
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -72,15 +75,3 @@ jobs:

- name: Build for Release
run: swift build -c release -Xswiftc -warnings-as-errors

build-documentation:
name: Build Documentation
runs-on: macos-13
env:
SWIFTCI_DOCC: 1
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Build
run: swift package generate-documentation --product TMDb
28 changes: 14 additions & 14 deletions .github/workflows/codeql.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "CodeQL"
name: CodeQL

on:
push:
Expand Down Expand Up @@ -29,19 +29,19 @@ jobs:
contents: read
security-events: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Checkout
uses: actions/checkout@v4

- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: swift
config-file: ./.github/codeql/codeql-config.yml
- name: Initialize CodeQL
uses: github/codeql-action/init@v2
with:
languages: swift
config-file: ./.github/codeql/codeql-config.yml

- name: Build
run: swift build --arch arm64 --build-tests
- name: Build
run: swift build --build-tests

- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:swift"
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v2
with:
category: "/language:swift"
60 changes: 60 additions & 0 deletions .github/workflows/deploy-documentation.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Deploy Documentation

on:
push:
branches:
- main
paths:
- ".github/workflows/documentation.yml"
- "**/*.swift"
- "**/*.docc/**/*.md"
workflow_dispatch:

permissions:
contents: read
pages: write
id-token: write

concurrency:
group: "deploy-documentation"
cancel-in-progress: true

jobs:
build:
name: Build
runs-on: ubuntu-latest
container: swift:5.9.2-jammy
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Setup Pages
uses: actions/configure-pages@v4

- name: Build documentation
run: |
swift package --allow-writing-to-directory docs \
generate-documentation --target TMDb \
--disable-indexing \
--transform-for-static-hosting \
--hosting-base-path TMDb \
--output-path docs
env:
SWIFTCI_DOCC: 1

- name: Upload documentation
uses: actions/upload-pages-artifact@v3
with:
path: 'docs'

deploy:
name: Deploy
runs-on: ubuntu-latest
needs: build
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}documentation/tmdb
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
6 changes: 6 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,12 @@ on:
pull_request:
branches:
- main
push:
branches:
- main
paths:
- ".github/workflows/integration.yml"
- "**/*.swift"
schedule:
# Every Sunday at 12am
- cron: '0 0 * * 0'
Expand Down
33 changes: 33 additions & 0 deletions .github/workflows/lint-markdown.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Lint Markdown

on:
pull_request:
branches:
- main
push:
branches:
- main
paths:
- ".github/workflows/lint-markdown.yml"
- "**/*.swift"
workflow_dispatch:

concurrency:
group: "lint-markdown-${{ github.head_ref || github.run_id }}"
cancel-in-progress: true

jobs:
markdownlint:
name: Markdownlint
runs-on: ubuntu-latest
container:
image: docker://ghcr.io/igorshubovych/markdownlint-cli:latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Lint README
run: markdownlint "README.md"

- name: Lint DocC files
run: markdownlint "**/*.docc/**/*.md"
35 changes: 5 additions & 30 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
@@ -1,12 +1,15 @@
name: Lint

on:
push:
pull_request:
branches:
- main
pull_request:
push:
branches:
- main
paths:
- ".github/workflows/lint.yml"
- "**/*.swift"
workflow_dispatch:

concurrency:
Expand Down Expand Up @@ -37,31 +40,3 @@ jobs:

- name: SwiftFormat
run: swiftformat --lint .

markdownlint:
name: Markdownlint
runs-on: ubuntu-latest
container:
image: docker://ghcr.io/igorshubovych/markdownlint-cli:latest
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Lint README
run: markdownlint "README.md"

- name: Lint DocC files
run: markdownlint "**/*.docc/**/*.md"

# markdownlint:
# name: Markdownlint
# runs-on: ubuntu-latest
# steps:
# - name: Checkout
# uses: actions/checkout@v4

# - name: Lint README
# run: docker run --rm -v $PWD:/workdir ghcr.io/igorshubovych/markdownlint-cli:latest "README.md"

# - name: Lint DocC files
# run: docker run --rm -v $PWD:/workdir ghcr.io/igorshubovych/markdownlint-cli:latest "**/*.docc/**/*.md"

0 comments on commit 6eb041c

Please sign in to comment.