|
| 1 | +name: Nightly Builds |
| 2 | + |
| 3 | +on: |
| 4 | + schedule: |
| 5 | + - cron: '0 0 * * *' |
| 6 | + workflow_dispatch: |
| 7 | + inputs: |
| 8 | + linux: |
| 9 | + description: 'Run Linux build' |
| 10 | + type: boolean |
| 11 | + default: true |
| 12 | + mac: |
| 13 | + description: 'Run macOS build' |
| 14 | + type: boolean |
| 15 | + default: true |
| 16 | + force: |
| 17 | + description: 'Force build even if no changes since last nightly' |
| 18 | + type: boolean |
| 19 | + default: false |
| 20 | + |
| 21 | +permissions: |
| 22 | + contents: write |
| 23 | + |
| 24 | +jobs: |
| 25 | + linux: |
| 26 | + name: Nightly Build (Linux) |
| 27 | + if: github.event_name == 'schedule' || inputs.linux == true |
| 28 | + runs-on: ubuntu-latest |
| 29 | + concurrency: nightly-linux-${{ github.workflow }} |
| 30 | + |
| 31 | + steps: |
| 32 | + - name: Checkout code |
| 33 | + uses: actions/checkout@v4 |
| 34 | + with: |
| 35 | + fetch-depth: 0 |
| 36 | + |
| 37 | + - name: Fetch tags |
| 38 | + run: git fetch --tags --force |
| 39 | + |
| 40 | + - name: Check changes since last nightly |
| 41 | + id: diff |
| 42 | + if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.force != true) |
| 43 | + run: | |
| 44 | + TAG=nightly-latest |
| 45 | + if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then |
| 46 | + if git diff --quiet "$TAG"...HEAD -- .; then |
| 47 | + echo "skip=true" >> "$GITHUB_OUTPUT" |
| 48 | + fi |
| 49 | + fi |
| 50 | +
|
| 51 | + - name: No changes — skip build |
| 52 | + if: steps.diff.outputs.skip == 'true' |
| 53 | + run: echo "No changes since last nightly. Skipping." |
| 54 | + |
| 55 | + - name: Set up Docker Buildx |
| 56 | + if: steps.diff.outputs.skip != 'true' |
| 57 | + uses: docker/setup-buildx-action@v3 |
| 58 | + |
| 59 | + - name: Build AppImage |
| 60 | + if: steps.diff.outputs.skip != 'true' |
| 61 | + run: make AppImage |
| 62 | + |
| 63 | + - name: Get current date |
| 64 | + if: steps.diff.outputs.skip != 'true' |
| 65 | + id: date |
| 66 | + run: echo "date=$(date +'%Y%m%d-%H%M')" >> "$GITHUB_OUTPUT" |
| 67 | + |
| 68 | + - name: Move/update nightly tag to current commit |
| 69 | + if: steps.diff.outputs.skip != 'true' |
| 70 | + run: | |
| 71 | + git config user.name "github-actions[bot]" |
| 72 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 73 | + git tag -f nightly-latest |
| 74 | + git push -f origin nightly-latest |
| 75 | +
|
| 76 | + - name: Create/Update nightly pre-release |
| 77 | + if: steps.diff.outputs.skip != 'true' |
| 78 | + uses: softprops/action-gh-release@v2 |
| 79 | + with: |
| 80 | + tag_name: nightly-latest |
| 81 | + name: Nightly Build (Linux) - ${{ steps.date.outputs.date }} |
| 82 | + prerelease: true |
| 83 | + generate_release_notes: false |
| 84 | + files: | |
| 85 | + artifacts/Lem-x86_64.AppImage |
| 86 | +
|
| 87 | + macos: |
| 88 | + name: Nightly Build (macOS) |
| 89 | + if: github.event_name == 'schedule' || inputs.mac == true |
| 90 | + runs-on: macos-latest |
| 91 | + concurrency: nightly-macos-${{ github.workflow }} |
| 92 | + |
| 93 | + steps: |
| 94 | + - name: Checkout code |
| 95 | + uses: actions/checkout@v4 |
| 96 | + with: |
| 97 | + fetch-depth: 0 |
| 98 | + |
| 99 | + - name: Fetch tags |
| 100 | + run: git fetch --tags --force |
| 101 | + |
| 102 | + - name: Check changes since last nightly |
| 103 | + id: diff |
| 104 | + if: github.event_name == 'schedule' || (github.event_name == 'workflow_dispatch' && inputs.force != true) |
| 105 | + run: | |
| 106 | + TAG=nightly-macos-latest |
| 107 | + if git rev-parse -q --verify "refs/tags/$TAG" >/dev/null; then |
| 108 | + if git diff --quiet "$TAG"...HEAD -- .; then |
| 109 | + echo "skip=true" >> "$GITHUB_OUTPUT" |
| 110 | + fi |
| 111 | + fi |
| 112 | +
|
| 113 | + - name: No changes — skip build |
| 114 | + if: steps.diff.outputs.skip == 'true' |
| 115 | + run: echo "No changes since last nightly. Skipping." |
| 116 | + |
| 117 | + - name: Set up Common Lisp environment |
| 118 | + if: steps.diff.outputs.skip != 'true' |
| 119 | + run: | |
| 120 | + brew install sbcl openssl |
| 121 | + curl -O https://beta.quicklisp.org/quicklisp.lisp |
| 122 | + sbcl --non-interactive --load quicklisp.lisp --eval "(quicklisp-quickstart:install)" |
| 123 | + curl -L https://qlot.tech/installer | sh |
| 124 | + echo "$HOME/.qlot/bin" >> $GITHUB_PATH |
| 125 | +
|
| 126 | + - name: Build Lem executable |
| 127 | + if: steps.diff.outputs.skip != 'true' |
| 128 | + run: scripts/macos-deploy.bash |
| 129 | + |
| 130 | + - name: Get current date |
| 131 | + if: steps.diff.outputs.skip != 'true' |
| 132 | + id: date |
| 133 | + run: echo "date=$(date +'%Y%m%d-%H%M')" >> "$GITHUB_OUTPUT" |
| 134 | + |
| 135 | + - name: Move/update nightly tag to current commit |
| 136 | + if: steps.diff.outputs.skip != 'true' |
| 137 | + run: | |
| 138 | + git config user.name "github-actions[bot]" |
| 139 | + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 140 | + git tag -f nightly-macos-latest |
| 141 | + git push -f origin nightly-macos-latest |
| 142 | +
|
| 143 | + - name: Create/Update nightly pre-release |
| 144 | + if: steps.diff.outputs.skip != 'true' |
| 145 | + uses: softprops/action-gh-release@v2 |
| 146 | + with: |
| 147 | + tag_name: nightly-macos-latest |
| 148 | + name: Nightly Build (macOS) - ${{ steps.date.outputs.date }} |
| 149 | + prerelease: true |
| 150 | + generate_release_notes: false |
| 151 | + files: | |
| 152 | + lem-macos.zip |
0 commit comments