Skip to content

feat: always generate html at the end of the workflow #377

feat: always generate html at the end of the workflow

feat: always generate html at the end of the workflow #377

name: Building and Rebuilding
on:
push:
# branches:
# - main
pull_request:
workflow_dispatch:
env:
RATTLER_BUILD_ENABLE_GITHUB_INTEGRATION: true
# Name of the production database
REPRO_DB_NAME: repro.db
# Set the directory where the docs are stored
# because we try to be local first this needs to
# be explicitly set in CI
REPRO_DOCS_DIR: docs
# For windows builds
PYTHONUTF8: 1
jobs:
run-tests:
continue-on-error: false
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.8.1
with:
pixi-version: "latest"
- name: Build rattler-build
run: |
pixi run test
setup-rattler-build:
needs: run-tests
continue-on-error: false
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.5.1
with:
pixi-version: "latest"
- name: Run YAML to Github Output Action
id: read-yaml
uses: nichmor/minimal-read-yaml@v0.0.2
with:
config: ${{ github.workspace }}/config.yaml
- name: Restore rattler-build cache
id: cache-rattler-build-restore
uses: actions/cache/restore@v4
with:
path: |
.rb-clone/target/release/rattler-build
.rb-clone/target/release/rattler-build.exe
key: v4-${{ runner.os }}-rattler-build-${{ steps.read-yaml.outputs['rattler-build.rev'] }}
- name: Build rattler-build
if: steps.cache-rattler-build-restore.outputs.cache-hit != 'true'
run: |
pixi run repror setup-rattler-build
- name: Save unix rattler-build
uses: actions/cache/save@v4
if: steps.cache-rattler-build-restore.outputs.cache-hit != 'true'
with:
path: |
.rb-clone/target/release/rattler-build
.rb-clone/target/release/rattler-build.exe
key: v4-${{ runner.os }}-rattler-build-${{ steps.read-yaml.outputs['rattler-build.rev'] }}
generate-recipes:
runs-on: ubuntu-latest
needs: setup-rattler-build
outputs:
recipe: ${{ steps.generate-matrix.outputs.recipes }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.5.1
with:
pixi-version: "latest"
- name: Generate matrix
id: generate-matrix
run: |
message="$(pixi r generate-recipes)"
echo "$message"
echo "recipes=$message" >> "$GITHUB_OUTPUT"
env:
LOG_LEVEL: WARNING # Set log level to WARNING
build-and-rebuild-recipes:
needs: generate-recipes
name: ${{ matrix.recipe_name }}-${{ matrix.os }}
continue-on-error: true
strategy:
matrix:
recipe_name: ${{ fromJson(needs.generate-recipes.outputs.recipe) }}
# os: [ubuntu-latest]
os: [ubuntu-latest, windows-latest, macos-latest]
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.5.1
with:
pixi-version: "latest"
- name: Run YAML to Github Output Action
id: read-yaml
uses: nichmor/minimal-read-yaml@v0.0.2
with:
config: ${{ github.workspace }}/config.yaml
- name: Restore rattler-build cache
id: cache-rattler-build-restore
uses: actions/cache/restore@v4
with:
path: |
.rb-clone/target/release/rattler-build
.rb-clone/target/release/rattler-build.exe
key: v4-${{ runner.os }}-rattler-build-${{ steps.read-yaml.outputs['rattler-build.rev'] }}
fail-on-cache-miss: true
- name: Set timezone to UTC
if: matrix.os == 'ubuntu-latest'
run: sudo timedatectl set-timezone UTC
- name: Set timezone to GMT
if: matrix.os == 'macos-latest'
run: sudo systemsetup -settimezone GMT
- name: Set LANG
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: echo "LANG=en_US.UTF-8" >> "$GITHUB_ENV"
- name: Build recipes and track if hash is equal
if: matrix.os != 'windows-latest'
run: |
pixi run repror build-recipe ${{ matrix.recipe_name }} --rattler-build-exe .rb-clone/target/release/rattler-build --patch --actions-url https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Build recipes and track if hash is equal
if: matrix.os == 'windows-latest'
run: |
# shellcheck disable=SC1012
pixi run repror build-recipe ${{ matrix.recipe_name }} --rattler-build-exe .rb-clone\target\release\rattler-build.exe --patch --actions-url https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Set timezone to Los Angeles
if: matrix.os == 'ubuntu-latest'
run: sudo timedatectl set-timezone America/Los_Angeles
- name: Set timezone to Los Angeles
if: matrix.os == 'macos-latest'
run: sudo systemsetup -settimezone America/Los_Angeles
- name: Set LANG
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
run: echo "LANG=et_EE.UTF-8" >> "$GITHUB_ENV"
- name: Rebuild recipes and track if hash is equal
if: matrix.os != 'windows-latest'
run: |
pixi run rebuild-recipe ${{ matrix.recipe_name }} --rattler-build-exe .rb-clone/target/release/rattler-build --patch --actions-url https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Rebuild recipes and track if hash is equal
if: matrix.os == 'windows-latest'
run: |
# shellcheck disable=SC1012
pixi run rebuild-recipe ${{ matrix.recipe_name }} --rattler-build-exe .rb-clone\target\release\rattler-build.exe --patch --actions-url https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}
- name: Upload results
uses: actions/upload-artifact@v3
if: always()
with:
name: build-info
path: |
build_info/
ci_artifacts/
recipe_info/
patch-db:
runs-on: ubuntu-latest
needs: build-and-rebuild-recipes
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.5.1
with:
pixi-version: "latest"
# Cache might be empty
- uses: actions/download-artifact@v3
continue-on-error: true
with:
name: build-info
path: .
- name: list files
continue-on-error: true
run: |
ls -la build_info/
- name: Merge patches and update database, push to remote
if: github.ref == 'refs/heads/main'
run: |
REPROR_UPDATE_TOKEN=${{ secrets.GITHUB_TOKEN }} pixi run repror merge-patches --update-remote
- name: Merge patches and update database
if: github.ref != 'refs/heads/main'
run: |
pixi run repror merge-patches
generate-html:
runs-on: ubuntu-latest
needs: patch-db
if: always()
steps:
- name: Checkout code
uses: actions/checkout@v4
- uses: prefix-dev/setup-pixi@v0.5.1
with:
pixi-version: "latest"
- name: Generate html and upload to remote
if: github.ref == 'refs/heads/main'
run: |
REPROR_UPDATE_TOKEN=${{ secrets.GITHUB_TOKEN }} pixi run repror generate-html --update-remote
- name: Generate html
if: github.ref != 'refs/heads/main'
run: |
pixi run repror generate-html