Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improve CI pipeline #2

Merged
merged 3 commits into from
Sep 14, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 34 additions & 4 deletions .github/workflows/ci-workflow.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,13 @@ name: CI Workflow
run-name: ${{ format('{0} triggered {1} on {2}', (github.event_name == 'workflow_dispatch' && format('User {0}', github.actor) || format('{0} event', github.event_name) ), github.workflow, github.ref) }}
on:
schedule:
- cron: '0 4 * * 1-5'
- cron: '0 4 * * 1'

pull_request:

push:
samdbmg marked this conversation as resolved.
Show resolved Hide resolved
branches:
- 'main'

workflow_dispatch:
inputs:
Expand All @@ -18,9 +22,13 @@ jobs:
CI:
name: CI
runs-on: ubuntu-22.04
outputs:
shouldUpload: ${{ steps.shouldUpload.outputs.upload }}
steps:
- name: Check out repository code
uses: actions/checkout@v3
with:
fetch-depth: 0 # check out the entire repo history for SHA verification in lastSuccessful step

- name: Lint specification
run: make lint
Expand All @@ -29,12 +37,34 @@ jobs:
- name: Render API docs
run: make render

#################################
## Upload deployable artefacts ##
#################################
- name: Identify latest successful run
id: lastSuccessful
uses: SamhammerAG/last-successful-build-action@1c368a27a90596574a71ac0ede422a897d0e8e84 # @v4
j616 marked this conversation as resolved.
Show resolved Hide resolved
with:
branch: ${{ github.ref_name }}
workflow: ${{ github.workflow }}
verify: true

- name: Determine if this workflow should upload artefacts
id: shouldUpload
shell: bash
run: |
if [ "${{ steps.lastSuccessful.outputs.sha }}" != "${{ github.sha }}" ] && [ "${{ github.ref_name }}" == "main" ]
then
echo "upload=true" >> $GITHUB_OUTPUT;
else
echo "upload=false" >> $GITHUB_OUTPUT;
fi

- name: Setup pages
if: ${{ inputs.forceDocsUpload || ( github.ref == 'refs/heads/main' ) }}
if: ${{ inputs.forceDocsUpload || ( steps.shouldUpload.outputs.upload == 'true' ) }}
uses: actions/configure-pages@v3

- name: Upload documentation artifact
if: ${{ inputs.forceDocsUpload || ( github.ref == 'refs/heads/main' ) }}
if: ${{ inputs.forceDocsUpload || ( steps.shouldUpload.outputs.upload == 'true' ) }}
uses: actions/upload-pages-artifact@v2
with:
path: './api/docs'
Expand All @@ -48,7 +78,7 @@ jobs:
id-token: write
runs-on: ubuntu-22.04
needs: CI
if: ${{ inputs.forceDocsUpload || ( github.ref == 'refs/heads/main' ) }}
if: ${{ inputs.forceDocsUpload || ( needs.CI.outputs.shouldUpload == 'true' ) }}
steps:
- name: Deploy documentation to GitHub Pages
id: deployment
Expand Down
Loading