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

Allow override of GFM version #71

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
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
95 changes: 95 additions & 0 deletions .github/workflows/pelican-version-test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,95 @@
name: Test GFM version option
on:
push:
paths:
- 'pelican/action.yml'
- 'pelican/build-cmark.sh'
- '.github/workflows/pelican-version-test.yml'
workflow_dispatch:
permissions:
contents: read
jobs:
version-test:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- gfm: 'true'
testbranch: testsite
buildshouldfail: false
- gfm: 'true'
testbranch: testsite
gfm_version: '0.28.3.gfm.12' # This is the earliest that will build
buildshouldfail: false
- gfm: 'true'
testbranch: testsite
gfm_version: '0.29.0.gfm.13' # latest
buildshouldfail: false
- gfm: 'false'
testbranch: testsitenogfm
buildshouldfail: false
- gfm: 'false'
testbranch: testsitenogfm
gfm_version: 'not-a-version'
buildshouldfail: false
- gfm: 'true'
testbranch: testsite
gfm_version: 'not-a-version'
buildshouldfail: true # Try to build a non-existent version
- gfm: 'true'
testbranch: testsite
gfm_version: '0.28.0.gfm.11'
buildshouldfail: true # Try to build an obsolete version
steps:
- name: Checkout the test site
uses: actions/checkout@v4
with:
ref: ${{ matrix.testbranch }}
- name: Ignore the action checkout
run: |
echo "self/" >> .git/info/exclude
- name: Checkout self
uses: actions/checkout@v4
with:
path: self

- name: Build (no publish)
id: build
continue-on-error: ${{ matrix.buildshouldfail }}
uses: ./self/pelican
with:
destination: output
publish: 'false'
tempdir: output
gfm: ${{ matrix.gfm }}
gfm_version: ${{ matrix.gfm_version }}
env:
UNIT_TEST_A: This is UNIT_TEST_A

- name: Check build failed when expected
if: ${{ matrix.buildshouldfail }}
run: |
echo "${{ toJSON(steps.build) }}"
test '${{ steps.build.outcome }}' != 'success'

- name: 'Upload Artifact'
uses: actions/upload-artifact@v4
with:
name: build-output-${{ matrix.gfm }}-${{ matrix.gfm_version }}
path: output
retention-days: 1

- name: Check output
if: ${{ steps.build.outcome == 'success' }}
run: |
test -f output/index.html # check output was created
if [ '${{ matrix.gfm }}' == 'true' ]
then
# Check that GFM was used
grep '<p><del>Hi</del> Hello, <del>there</del> world!</p>' output/index.html
else
# Check that GFM was NOT used
! grep '<p><del>Hi</del> Hello, <del>there</del> world!</p>' output/index.html
fi

6 changes: 5 additions & 1 deletion pelican/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,10 @@ inputs:
description: "Pelican Version (default 4.5.4)"
required: false
default: '4.5.4'
gfm_version:
description: "GFM Version (default 0.28.3.gfm.12)"
required: false
default: '0.28.3.gfm.12'
requirements:
description: "Python requirements file name to install (default: None)"
required: false
Expand Down Expand Up @@ -61,7 +65,7 @@ runs:
shell: bash
env:
WORKDIR: /opt/pelican-asf # where to build GFM
GFM_VERSION: '0.28.3.gfm.12' # ensure we agree with build-cmark.sh script
GFM_VERSION: ${{ inputs.gfm_version }}
run: |
# Does the GFM build already exist?
if [[ -n $LIBCMARKDIR && -d $LIBCMARKDIR ]]
Expand Down
Loading