|
| 1 | +# Copyright (C) 2022 <Positron Solutions> |
| 2 | + |
| 3 | +# Permission is hereby granted, free of charge, to any person obtaining a copy of |
| 4 | +# this software and associated documentation files (the "Software"), to deal in |
| 5 | +# the Software without restriction, including without limitation the rights to |
| 6 | +# use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of |
| 7 | +# the Software, and to permit persons to whom the Software is furnished to do so, |
| 8 | +# subject to the following conditions: |
| 9 | + |
| 10 | +# The above copyright notice and this permission notice shall be included in all |
| 11 | +# copies or substantial portions of the Software. |
| 12 | + |
| 13 | +# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
| 14 | +# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS |
| 15 | +# FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR |
| 16 | +# COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER |
| 17 | +# IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN |
| 18 | +# CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
| 19 | + |
| 20 | +name: CI |
| 21 | + |
| 22 | +on: # trigger this workflow on |
| 23 | + push: |
| 24 | + branches: [ $default-branch ] # pushes to the default branch |
| 25 | + pull_request: |
| 26 | + # or every pull request, from any branch to any branch |
| 27 | + |
| 28 | + workflow_dispatch: |
| 29 | + # Allows you to run this workflow manually from the Actions tab |
| 30 | + |
| 31 | +jobs: |
| 32 | + continuous-integration: # just a job name |
| 33 | + |
| 34 | + # Run on every OS and Emacsen |
| 35 | + # Some steps specify their own logic! |
| 36 | + strategy: |
| 37 | + # Don't abort steps if any fails on any platform |
| 38 | + fail-fast: false |
| 39 | + matrix: |
| 40 | + os: [ubuntu-latest, macos-latest] |
| 41 | + emacsPkg: [ emacsNativeComp |
| 42 | + emacsUnstable |
| 43 | + # emacsGit |
| 44 | + # emacs |
| 45 | + ] |
| 46 | + runs-on: ${{ matrix.os }} |
| 47 | + |
| 48 | + steps: |
| 49 | + |
| 50 | + - uses: cachix/install-nix-action@v15 |
| 51 | + with: |
| 52 | + extra_nix_config: | |
| 53 | + access-tokens = github.com=${{ secrets.GITHUB_TOKEN }} |
| 54 | + - uses: cachix/cachix-action@v10 |
| 55 | + with: |
| 56 | + name: cargo2nix-gh |
| 57 | + # This CACHIX_AUTH_TOKEN is a secret you must provide |
| 58 | + authToken: ${{ secrets.CACHIX_AUTH_TOKEN }} |
| 59 | + # Some paths may confuse cachix. Add them with a pipe to the pushFilter |
| 60 | + # pushFilter: "(something-else$|.drv.chroot$)" |
| 61 | + |
| 62 | + # Loading the development shell with frozen versions is important to |
| 63 | + # verify that any flake commands will successfully run straight off of the |
| 64 | + # github repository. |
| 65 | + - name: load the shell with frozen versions |
| 66 | + run: nix develop .#${{ matrix.emacsPkg }} --ignore-environment --command "emacs" "--version" |
| 67 | + |
| 68 | + # Linting the package is less useful on multiple version. Modify the |
| 69 | + # logic if you wish to expand lint coverage. |
| 70 | + - name: lint package |
| 71 | + if: matrix.emacsPkgs == "emacsNativeComp" && matrix.os == "ubuntu-latest" |
| 72 | + run: | |
| 73 | + nix develop \ |
| 74 | + --override-input nixpkgs github:nixos/nixpkgs/release-22.05 |
| 75 | + --update-input emacs-overlay \ |
| 76 | + .#${{ matrix.emacsPkg }} |
| 77 | +
|
| 78 | + # Lint the package |
| 79 | + emacs --script ./test/elisp-repo-kit-lint.el |
| 80 | +
|
| 81 | + # Lint the tests |
| 82 | + emacs --script test/elisp-repo-kit-lint-tests.el |
| 83 | +
|
| 84 | + - name: run tests |
| 85 | + run: | |
| 86 | + # First load the shell. Updating inputs will update the view of ELPA |
| 87 | + # Emacs git, and nixpkgs. |
| 88 | +
|
| 89 | + # Possible RUNNER_OS values: Windows Linux MacOS |
| 90 | + # https://docs.github.com/en/actions/learn-github-actions/environment-variables#default-environment-variables |
| 91 | + if [[ $RUNNER_OS == Linux ]]; then |
| 92 | + nix develop \ |
| 93 | + --override-input nixpkgs github:nixos/nixpkgs/release-22.05 |
| 94 | + --update-input emacs-overlay \ |
| 95 | + .#${{ matrix.emacsPkg }} |
| 96 | +
|
| 97 | + else |
| 98 | + nix develop \ |
| 99 | + --override-input nixpkgs github:nixos/nixpkgs/nixpkgs-22.05-darwin |
| 100 | + --update-input emacs-overlay |
| 101 | + .#${{ matrix.emacsPkg }} |
| 102 | + fi |
| 103 | +
|
| 104 | + # Runs the tests |
| 105 | + emacs --quick --load test/emacs-repo-kit-test-setup.el -- $GITHUB_SHA |
| 106 | +
|
| 107 | + # If you need terminal tests too, uncomment |
| 108 | + # emacs --script test/emacs-repo-kit-test-setup.el -- $GITHUB_SHA |
0 commit comments