feat: add copy install mode for CI caching #98
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: CI | |
| on: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| types: [opened, synchronize, reopened] | |
| permissions: | |
| actions: read | |
| contents: write | |
| pull-requests: write | |
| id-token: write | |
| jobs: | |
| # Prerelease job - runs on PR creation/updates only | |
| prerelease: | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'pull_request' && contains(fromJSON('["opened", "synchronize", "reopened"]'), github.event.action) | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| ref: ${{ github.head_ref }} | |
| # Install mise | |
| - name: Install mise | |
| run: | | |
| curl https://mise.run | sh | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| # Install Lua and dependencies (mise.toml uses brew on macOS, apt on Linux) | |
| - name: Install Lua and dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y lua5.3 liblua5.3-dev luarocks libreadline-dev | |
| # Install all tools from mise.toml and initialize | |
| - name: Install mise tools | |
| run: | | |
| mise install | |
| mise plugin link nix $PWD --force | |
| sudo luarocks install busted --force | |
| # Run tests | |
| - name: Run tests | |
| run: | | |
| eval "$(mise env)" | |
| mise run test | |
| mise run e2e | |
| env: | |
| LUA_PATH: "lib/?.lua;;" | |
| MISE_NIX_REQUIRE_DOCKER: "1" | |
| MISE_LIBGIT2: "false" | |
| MISE_GIX: "false" | |
| # Release job - runs only when MR is merged to main | |
| release: | |
| runs-on: ubuntu-latest | |
| if: github.ref == 'refs/heads/main' && github.event_name == 'push' && contains(github.event.head_commit.message, 'Merge pull request') | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| # Install mise | |
| - name: Install mise | |
| run: | | |
| curl https://mise.run | sh | |
| echo "$HOME/.local/bin" >> $GITHUB_PATH | |
| # Install Lua and dependencies (mise.toml uses brew on macOS, apt on Linux) | |
| - name: Install Lua and dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y lua5.3 liblua5.3-dev luarocks libreadline-dev | |
| # Install all tools from mise.toml and initialize | |
| - name: Install mise tools | |
| run: | | |
| mise install | |
| mise plugin link nix $PWD --force | |
| sudo luarocks install busted --force | |
| # Run tests | |
| - name: Run tests | |
| run: | | |
| eval "$(mise env)" | |
| mise run test | |
| mise run e2e | |
| env: | |
| LUA_PATH: "lib/?.lua;;" | |
| MISE_NIX_REQUIRE_DOCKER: "1" | |
| MISE_LIBGIT2: "false" | |
| MISE_GIX: "false" | |
| - name: Create release | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| VERSION="$(lua -e 'dofile("metadata.lua"); print(PLUGIN.version)')" | |
| gh release create "mise-nix@${VERSION}" --generate-notes | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |