From 4692a05b307116d8a960934ee05fdfcd7d3c9311 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Wed, 26 Feb 2025 14:45:59 +0100 Subject: [PATCH 1/2] Revert "ci: enhance image builder with parallel stack builds (#257)" This reverts commit aa3652d9e61effdfb86a62eb55f155d48b39cbbb. --- .github/workflows/build.yaml | 106 ++++++++++++++++------------------- 1 file changed, 49 insertions(+), 57 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 231623b..579e106 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -25,49 +25,50 @@ on: - static jobs: + prepare: runs-on: ubuntu-latest outputs: - matrix: ${{ steps.set-matrix.outputs.matrix }} - + base_system: ${{ steps.set-stack.outputs.stack }} + pandoc_version: ${{ steps.set-version.outputs.version }} + steps: - uses: actions/checkout@v4 - - - id: set-matrix + - id: set-stack run: | if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - echo "matrix={\"include\":[{\"stack\":\"${{ inputs.base_system }}\",\"version\":\"${{ inputs.pandoc_version }}\"}]}" >> $GITHUB_OUTPUT + echo "stack=${{ inputs.base_system }}" >> $GITHUB_OUTPUT else + # Extract stack from the changed files paths + CHANGED_FILES=${{ git diff --name-only ${{ github.event.before }} ${{ github.event.after }}} + if echo "$CHANGED_FILES" | grep -q "^alpine/"; then + echo "stack=alpine" >> $GITHUB_OUTPUT + elif echo "$CHANGED_FILES" | grep -q "^ubuntu/"; then + echo "stack=ubuntu" >> $GITHUB_OUTPUT + elif echo "$CHANGED_FILES" | grep -q "^static/"; then + echo "stack=static" >> $GITHUB_OUTPUT + fi + fi + + - id: set-version + run: | + if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then + echo "version=${{ inputs.pandoc_version }}" >> $GITHUB_OUTPUT + else + # Extract version directly from the changed freeze file name CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }}) - MATRIX="{\"include\":[" - FIRST=true - - for STACK in alpine ubuntu static; do - if echo "$CHANGED_FILES" | grep -q "^$STACK/"; then - FREEZE_FILE=$(echo "$CHANGED_FILES" | grep "^$STACK/.*\.project\.freeze$" | head -1) - if [ -n "$FREEZE_FILE" ]; then - VERSION=$(basename "$FREEZE_FILE" | sed -E 's/pandoc-(.*)\.project\.freeze/\1/') - if [ "$FIRST" = true ]; then - FIRST=false - else - MATRIX="${MATRIX}," - fi - MATRIX="${MATRIX}{\"stack\":\"{$STACK:-alpine}\",\"version\":\"${VERSION:-main}\"}" - fi - fi - done + FREEZE_FILE=$(echo "$CHANGED_FILES" | grep '\.project\.freeze$' | head -1) + VERSION=$(basename "$FREEZE_FILE" | sed -E 's/pandoc-(.*)\.project\.freeze/\1/') - MATRIX="${MATRIX}]}" - echo "matrix=$MATRIX" >> $GITHUB_OUTPUT + # If no version found from freeze file, default to main + echo "version=${VERSION:-main}" >> $GITHUB_OUTPUT fi + # Build images and store them as tar archive core: - name: minimal and core (${{ matrix.stack }}) + name: minimal and core needs: prepare runs-on: ubuntu-latest - strategy: - matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }} - fail-fast: false steps: - uses: actions/checkout@v4 @@ -97,58 +98,49 @@ jobs: uses: ./.github/actions/build with: image_type: minimal - base_system: ${{ matrix.stack }} - pandoc_version: ${{ matrix.version }} - dockerfile: ${{ matrix.stack }}/Dockerfile - target: ${{ matrix.stack }}-minimal + base_system: ${{ needs.prepare.outputs.base_system }} + pandoc_version: ${{ needs.prepare.outputs.pandoc_version }} + dockerfile: ${{ needs.prepare.outputs.base_system }}/Dockerfile + target: ${{ needs.prepare.outputs.base_system }}-minimal - name: core uses: ./.github/actions/build - if: ${{ matrix.stack != 'static' }} + if: ${{ needs.prepare.outputs.base_system != 'static' }} with: image_type: core - base_system: ${{ matrix.stack }} - pandoc_version: ${{ matrix.version }} - dockerfile: ${{ matrix.stack }}/Dockerfile - target: ${{ matrix.stack }}-core + base_system: ${{ needs.prepare.outputs.base_system }} + pandoc_version: ${{ needs.prepare.outputs.pandoc_version }} + dockerfile: ${{ needs.prepare.outputs.base_system }}/Dockerfile + target: ${{ needs.prepare.outputs.base_system }}-core typst: - name: Typst (${{ matrix.stack }}) - if: ${{ matrix.stack != 'static' }} + name: Typst + if: ${{ needs.prepare.outputs.base_system != 'static' }} needs: [prepare, core] - strategy: - matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }} - fail-fast: false uses: ./.github/workflows/addon.yaml secrets: inherit with: addon: typst - base_system: ${{ matrix.stack }} - pandoc_version: ${{ matrix.version }} + base_system: ${{ needs.prepare.outputs.base_system }} + pandoc_version: ${{ needs.prepare.outputs.pandoc_version }} latex: - name: LaTeX (${{ matrix.stack }}) - if: ${{ matrix.stack != 'static' }} + name: LaTeX + if: ${{ needs.prepare.outputs.base_system != 'static' }} needs: [prepare, core] - strategy: - matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }} - fail-fast: false uses: ./.github/workflows/addon.yaml secrets: inherit with: addon: latex - base_system: ${{ matrix.stack }} - pandoc_version: ${{ matrix.version }} + base_system: ${{ needs.prepare.outputs.base_system }} + pandoc_version: ${{ needs.prepare.outputs.pandoc_version }} extra: - name: Extra (${{ matrix.stack }}) + name: Extra needs: [prepare, latex] - strategy: - matrix: ${{ fromJSON(needs.prepare.outputs.matrix) }} - fail-fast: false uses: ./.github/workflows/addon.yaml secrets: inherit with: addon: extra - base_system: ${{ matrix.stack }} - pandoc_version: ${{ matrix.version }} + base_system: ${{ needs.prepare.outputs.base_system }} + pandoc_version: ${{ needs.prepare.outputs.pandoc_version }} From 9037c1a83b112d2555a76ee369840914e5a6cca8 Mon Sep 17 00:00:00 2001 From: Albert Krewinkel Date: Wed, 26 Feb 2025 14:49:06 +0100 Subject: [PATCH 2/2] Revert "ci: automate image builds based on freeze file changes (#257)" This reverts commit 682dd1aeb2b4ae8e521e01673019941791bd7d6b. --- .github/workflows/build.yaml | 89 +++++++++--------------------------- 1 file changed, 21 insertions(+), 68 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index 579e106..988c0f2 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -1,13 +1,6 @@ name: Image Builder on: - push: - branches: - - main - paths: - - alpine/freeze/** - - static/freeze/** - - ubuntu/freeze/** workflow_dispatch: inputs: pandoc_version: @@ -25,51 +18,11 @@ on: - static jobs: - - prepare: - runs-on: ubuntu-latest - outputs: - base_system: ${{ steps.set-stack.outputs.stack }} - pandoc_version: ${{ steps.set-version.outputs.version }} - - steps: - - uses: actions/checkout@v4 - - id: set-stack - run: | - if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - echo "stack=${{ inputs.base_system }}" >> $GITHUB_OUTPUT - else - # Extract stack from the changed files paths - CHANGED_FILES=${{ git diff --name-only ${{ github.event.before }} ${{ github.event.after }}} - if echo "$CHANGED_FILES" | grep -q "^alpine/"; then - echo "stack=alpine" >> $GITHUB_OUTPUT - elif echo "$CHANGED_FILES" | grep -q "^ubuntu/"; then - echo "stack=ubuntu" >> $GITHUB_OUTPUT - elif echo "$CHANGED_FILES" | grep -q "^static/"; then - echo "stack=static" >> $GITHUB_OUTPUT - fi - fi - - - id: set-version - run: | - if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then - echo "version=${{ inputs.pandoc_version }}" >> $GITHUB_OUTPUT - else - # Extract version directly from the changed freeze file name - CHANGED_FILES=$(git diff --name-only ${{ github.event.before }} ${{ github.event.after }}) - FREEZE_FILE=$(echo "$CHANGED_FILES" | grep '\.project\.freeze$' | head -1) - VERSION=$(basename "$FREEZE_FILE" | sed -E 's/pandoc-(.*)\.project\.freeze/\1/') - - # If no version found from freeze file, default to main - echo "version=${VERSION:-main}" >> $GITHUB_OUTPUT - fi - # Build images and store them as tar archive core: name: minimal and core - needs: prepare runs-on: ubuntu-latest - + steps: - uses: actions/checkout@v4 @@ -98,49 +51,49 @@ jobs: uses: ./.github/actions/build with: image_type: minimal - base_system: ${{ needs.prepare.outputs.base_system }} - pandoc_version: ${{ needs.prepare.outputs.pandoc_version }} - dockerfile: ${{ needs.prepare.outputs.base_system }}/Dockerfile - target: ${{ needs.prepare.outputs.base_system }}-minimal + base_system: ${{ inputs.base_system }} + pandoc_version: ${{ inputs.pandoc_version }} + dockerfile: ${{ inputs.base_system }}/Dockerfile + target: ${{ inputs.base_system }}-minimal - name: core uses: ./.github/actions/build - if: ${{ needs.prepare.outputs.base_system != 'static' }} + if: ${{ inputs.base_system != 'static' }} with: image_type: core - base_system: ${{ needs.prepare.outputs.base_system }} - pandoc_version: ${{ needs.prepare.outputs.pandoc_version }} - dockerfile: ${{ needs.prepare.outputs.base_system }}/Dockerfile - target: ${{ needs.prepare.outputs.base_system }}-core + base_system: ${{ inputs.base_system }} + pandoc_version: ${{ inputs.pandoc_version }} + dockerfile: ${{ inputs.base_system }}/Dockerfile + target: ${{ inputs.base_system }}-core typst: name: Typst - if: ${{ needs.prepare.outputs.base_system != 'static' }} - needs: [prepare, core] + if: ${{ inputs.base_system != 'static' }} + needs: core uses: ./.github/workflows/addon.yaml secrets: inherit with: addon: typst - base_system: ${{ needs.prepare.outputs.base_system }} - pandoc_version: ${{ needs.prepare.outputs.pandoc_version }} + base_system: ${{ inputs.base_system }} + pandoc_version: ${{ inputs.pandoc_version }} latex: name: LaTeX - if: ${{ needs.prepare.outputs.base_system != 'static' }} - needs: [prepare, core] + if: ${{ inputs.base_system != 'static' }} + needs: core uses: ./.github/workflows/addon.yaml secrets: inherit with: addon: latex - base_system: ${{ needs.prepare.outputs.base_system }} - pandoc_version: ${{ needs.prepare.outputs.pandoc_version }} + base_system: ${{ inputs.base_system }} + pandoc_version: ${{ inputs.pandoc_version }} extra: name: Extra - needs: [prepare, latex] + needs: latex uses: ./.github/workflows/addon.yaml secrets: inherit with: addon: extra - base_system: ${{ needs.prepare.outputs.base_system }} - pandoc_version: ${{ needs.prepare.outputs.pandoc_version }} + base_system: ${{ inputs.base_system }} + pandoc_version: ${{ inputs.pandoc_version }}