|
8 | 8 | name: ${{ matrix.lesson-name }} (${{ matrix.os-name }}) |
9 | 9 | if: github.repository == 'carpentries/styles' |
10 | 10 | runs-on: ${{ matrix.os }} |
| 11 | + continue-on-error: ${{ matrix.experimental }} |
11 | 12 | strategy: |
12 | 13 | fail-fast: false |
13 | 14 | matrix: |
14 | 15 | lesson: [swcarpentry/shell-novice, datacarpentry/r-intro-geospatial, librarycarpentry/lc-git] |
15 | 16 | os: [ubuntu-20.04, macos-latest, windows-latest] |
| 17 | + experimental: [false] |
16 | 18 | include: |
17 | 19 | - os: ubuntu-20.04 |
18 | | - os-name: Ubuntu |
| 20 | + os-name: Linux |
19 | 21 | - os: macos-latest |
20 | 22 | os-name: macOS |
21 | 23 | - os: windows-latest |
|
26 | 28 | lesson-name: (DC) R Intro Geospatial |
27 | 29 | - lesson: librarycarpentry/lc-git |
28 | 30 | lesson-name: (LC) Intro to Git |
| 31 | + - lesson: datacarpentry/astronomy-python |
| 32 | + lesson-name: (DC) Foundations of Astronomical Data Science |
| 33 | + experimental: true |
| 34 | + os: ubuntu-20.04 |
| 35 | + os-name: Linux |
| 36 | + - lesson: carpentries/lesson-example |
| 37 | + lesson-name: (CP) Lesson Example |
| 38 | + experimental: false |
| 39 | + os: ubuntu-20.04 |
| 40 | + os-name: Linux |
29 | 41 | defaults: |
30 | 42 | run: |
31 | 43 | shell: bash # forces 'Git for Windows' on Windows |
@@ -62,25 +74,54 @@ jobs: |
62 | 74 | path: lesson |
63 | 75 | fetch-depth: 0 |
64 | 76 |
|
65 | | - - name: Determine the proper reference to use |
66 | | - id: styles-ref |
| 77 | + - name: Sync lesson with carpentries/styles |
| 78 | + working-directory: lesson |
67 | 79 | run: | |
68 | | - if [[ -n "${{ github.event.pull_request.number }}" ]]; then |
69 | | - echo "::set-output name=ref::refs/pull/${{ github.event.pull_request.number }}/head" |
| 80 | + echo "::group::Fetch Styles" |
| 81 | + if [[ -n "${{ github.event.pull_request.number }}" ]] |
| 82 | + then |
| 83 | + ref="refs/pull/${{ github.event.pull_request.number }}/head" |
70 | 84 | else |
71 | | - echo "::set-output name=ref::gh-pages" |
| 85 | + ref="gh-pages" |
72 | 86 | fi |
73 | 87 |
|
74 | | - - name: Sync lesson with carpentries/styles |
75 | | - working-directory: lesson |
76 | | - run: | |
77 | 88 | git config --global user.email "[email protected]" |
78 | 89 | git config --global user.name "The Carpentries Bot" |
| 90 | +
|
79 | 91 | git remote add styles https://github.com/carpentries/styles.git |
80 | | - git config --local remote.styles.tagOpt --no-tags |
81 | | - git fetch styles ${{ steps.styles-ref.outputs.ref }}:styles-ref |
82 | | - git merge -s recursive -Xtheirs --no-commit styles-ref |
83 | | - git commit -m "Sync lesson with carpentries/styles" |
| 92 | + git fetch styles $ref:styles-ref |
| 93 | + echo "::endgroup::" |
| 94 | + echo "::group::Synchronize Styles" |
| 95 | + # Sync up only if necessary |
| 96 | + if [[ $(git rev-list --count HEAD..styles-ref) != 0 ]] |
| 97 | + then |
| 98 | +
|
| 99 | + # The merge command below might fail for lessons that use remote theme |
| 100 | + # https://github.com/carpentries/carpentries-theme |
| 101 | + echo "Testing merge using recursive strategy, accepting upstream changes without committing" |
| 102 | + if ! git merge -s recursive -Xtheirs --no-commit styles-ref |
| 103 | + then |
| 104 | +
|
| 105 | + # Remove "deleted by us, unmerged" files from the staging area. |
| 106 | + # these are the files that were removed from the lesson |
| 107 | + # but are still present in the carpentries/styles repo |
| 108 | + echo "Removing previously deleted files" |
| 109 | + git rm $(git diff --name-only --diff-filter=DU) |
| 110 | +
|
| 111 | + # If there are still "unmerged" files, |
| 112 | + # let's raise an error and look into this more closely |
| 113 | + if [[ -n $(git diff --name-only --diff-filter=U) ]] |
| 114 | + then |
| 115 | + echo "There were unmerged files in ${{ matrix.lesson-name }}:" |
| 116 | + echo "$(git diff --compact-summary --diff-filter=U)" |
| 117 | + exit 1 |
| 118 | + fi |
| 119 | + fi |
| 120 | +
|
| 121 | + echo "Committing changes" |
| 122 | + git commit -m "Sync lesson with carpentries/styles" |
| 123 | + fi |
| 124 | + echo "::endgroup::" |
84 | 125 |
|
85 | 126 | - name: Look for R-markdown files |
86 | 127 | id: check-rmd |
@@ -136,3 +177,6 @@ jobs: |
136 | 177 |
|
137 | 178 | - run: make site |
138 | 179 | working-directory: lesson |
| 180 | + |
| 181 | + - run: make lesson-check-all |
| 182 | + working-directory: lesson |
0 commit comments