Skip to content

Conversation

@mschoettle
Copy link
Member

@mschoettle mschoettle commented Jan 30, 2025

Add GitHub Actions workflow for CI.

The importer produced the following workflow:

docs.yml
name: opalmedapps/docs
on:
  push:
  pull_request:
  workflow_dispatch:
concurrency:
  group: "${{ github.ref }}"
  cancel-in-progress: true
jobs:
  pre-commit:
    runs-on: ubuntu-latest
    container:
      image: squidfunk/mkdocs-material:9.5.49
      options: "--entrypoint "
    timeout-minutes: 60
    steps:
    - uses: actions/checkout@v4.1.0
      with:
        fetch-depth: 20
        lfs: true
    - run: pip install pre-commit
    - run: SKIP="markdownlint-cli2" pre-commit run --all
  markdownlint:
    runs-on: ubuntu-latest
    container:
      image: davidanson/markdownlint-cli2-rules:v0.14.0
      options: "--entrypoint "
    timeout-minutes: 60
    steps:
    - uses: actions/checkout@v4.1.0
      with:
        fetch-depth: 20
        lfs: true
    - run: markdownlint-cli2 --config .gitlab/markdownlint/.markdownlint-cli2.yaml "**/*.md"
#     # 'artifacts.codequality' was not transformed because there is no suitable equivalent in GitHub Actions
  build:
    needs:
    - pre-commit
    - markdownlint
    runs-on: ubuntu-latest
    container:
      image: squidfunk/mkdocs-material:9.5.49
      options: "--entrypoint "
    timeout-minutes: 60
    env:
      GIT_DEPTH: 0
    steps:
    - uses: actions/checkout@v4.1.0
      with:
        fetch-depth: 0
        lfs: true
    - uses: actions/download-artifact@v4.1.0
    - run: pip install -r requirements.txt
    - run: mkdocs --version
    - run: mkdocs build --strict --site-dir public
    - uses: actions/upload-artifact@v4.1.0
      if: success()
      with:
        name: "${{ github.job }}"
        retention-days: 7
        path: public
  pages:
    needs: build
    runs-on: ubuntu-latest
    container:
      image: squidfunk/mkdocs-material:9.5.49
      options: "--entrypoint "
    if: ${{ github.ref }} == $CI_DEFAULT_BRANCH
    timeout-minutes: 60
    steps:
    - uses: actions/checkout@v4.1.0
      with:
        fetch-depth: 20
        lfs: true
    - uses: actions/download-artifact@v4.1.0
    - run: mkdocs --version
    - uses: actions/upload-artifact@v4.1.0
      if: success()
      with:
        name: "${{ github.job }}"
        path: public
    - uses: JamesIves/github-pages-deploy-action@v4.5.0
      with:
        branch: gh-pages
        folder: public

I decided to split this up into two jobs: lint and build and use a workflow that I have used for a personal project with uv.

@mschoettle mschoettle self-assigned this Jan 30, 2025
needs:
- lint
steps:
- uses: actions/checkout@v4.2.2
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this step have a name, like the checkout step above?

Same question for one of the other steps below that doesn't have a name.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's not required, it will then say "Run actions/checkout@v4.2.2".

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok, I leave it up to you then.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I removed names where it is obvious (when reusing an action).

@mschoettle mschoettle merged commit 7628270 into main Feb 3, 2025
2 checks passed
@mschoettle mschoettle deleted the switch-github-actions branch February 3, 2025 20:39
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants