Skip to content

gateway: bump actions/checkout from 4 to 5 #146

gateway: bump actions/checkout from 4 to 5

gateway: bump actions/checkout from 4 to 5 #146

name: Test the Pelican build action
on:
push:
paths:
- 'pelican/**'
- '.github/workflows/pelican-action-test.yml'
# N.B. Cannot easily test pull_request: because the source may not have rights to create/update the test-site
workflow_dispatch:
permissions:
contents: write
jobs:
pelican-test:
env: # source and target branches
SOURCE: testsite
TARGET: testsite-${{ github.ref_name }} # each branch has own test output
runs-on: ubuntu-latest
concurrency: # target must not be updated by two jobs at once
group: testsite-${{ github.ref_name }} # must agree with TARGET
steps:
- name: Checkout the test site
uses: actions/checkout@v5
with:
ref: ${{ env.SOURCE }}
- name: Ignore the action checkout
run: |
echo "self/" >> .git/info/exclude
- name: Checkout self
uses: actions/checkout@v5
with:
path: self
- name: Reset output directory ${{ env.TARGET }}
run: |
set +e
echo $TARGET
git branch -D $TARGET
git push origin --delete $TARGET
git branch -a | grep ${{ env.TARGET }}
true
- name: Should create ${{ env.TARGET }}
uses: ./self/pelican
with:
destination: ${{ env.TARGET }}
gfm: 'true'
# fatal: 'errors' (default)
env:
UNIT_TEST_A: This is UNIT_TEST_A
- name: Check ${{ env.TARGET }} was created
run: |
git checkout ${{ env.TARGET }}
{
echo "Commit build products"
echo -n "Initialise empty site"
} >/tmp/expected
cat <<EOD
Commit build products
Initialise empty site
EOD
diff <(git log --pretty="format:%s") /tmp/expected
# Check that GFM was used
grep '<p><del>Hi</del> Hello, <del>there</del> world!</p>' output/index.html
- name: Reset workspace for next test
run: |
git checkout ${{ env.SOURCE }}
git status
- name: Should update ${{ env.TARGET }} again
uses: ./self/pelican
with:
destination: ${{ env.TARGET }}
gfm: 'true'
fatal: 'warnings'
env: # This is a different value
UNIT_TEST_A: This is UNIT_TEST_A updated
- name: Check ${{ env.TARGET }} is present and has been updated
run: |
git checkout ${{ env.TARGET }}
{
echo "Commit build products"
echo "Commit build products"
echo -n "Initialise empty site"
} >/tmp/expected
diff <(git log --pretty="format:%s") /tmp/expected
# Check that GFM was used
grep '<p><del>Hi</del> Hello, <del>there</del> world!</p>' output/index.html
- name: Reset workspace for next test
run: |
git checkout ${{ env.SOURCE }}
git status
- name: Should not update ${{ env.TARGET }} this time
uses: ./self/pelican
with:
destination: ${{ env.TARGET }}
gfm: 'true'
fatal: '' # should ignore it
env: # This is the same value
UNIT_TEST_A: This is UNIT_TEST_A updated
- name: Check ${{ env.TARGET }} is present and has not been updated
run: |
git checkout ${{ env.TARGET }}
{
echo "Commit build products"
echo "Commit build products"
echo -n "Initialise empty site"
} >/tmp/expected
diff <(git log --pretty="format:%s") /tmp/expected