.github: Added attic configuration to workflows #329
This file contains 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: check | |
on: | |
push: | |
pull_request: | |
workflow_dispatch: | |
jobs: | |
check: | |
name: check nix flake | |
runs-on: ubuntu-latest | |
steps: | |
# Taken from https://github.com/lilyinstarlight/foosteros/blob/aa611d0cf03bd82f6c1c701e73f86f27abb8d8e4/.github/workflows/installer.yml | |
# MIT licensed | |
- name: Free up runner disk space | |
run: | | |
# Large docker images | |
sudo docker image prune --all --force | |
# Large packages | |
sudo apt-get purge -y '^llvm-.*' 'php.*' '^mongodb-.*' '^mysql-.*' azure-cli google-cloud-cli google-chrome-stable firefox powershell microsoft-edge-stable | |
sudo apt-get autoremove -y | |
sudo apt-get clean | |
# Large folders | |
sudo rm -rf /var/lib/apt/lists/* /opt/hostedtoolcache /usr/local/games /usr/local/sqlpackage /usr/local/.ghcup /usr/local/share/powershell /usr/local/share/edge_driver | |
sudo rm -rf /usr/local/share/gecko_driver /usr/local/share/chromium /usr/local/share/chromedriver-linux64 /usr/local/share/vcpkg /usr/local/lib/python* | |
sudo rm -rf /usr/local/lib/node_modules /usr/local/julia* /opt/mssql-tools /etc/skel /usr/share/vim /usr/share/postgresql /usr/share/man /usr/share/apache-maven-* | |
sudo rm -rf /usr/share/R /usr/share/alsa /usr/share/miniconda /usr/share/grub /usr/share/gradle-* /usr/share/locale /usr/share/texinfo /usr/share/kotlinc /usr/share/swift | |
sudo rm -rf /usr/share/doc /usr/share/az_9.3.0 /usr/share/sbt /usr/share/ri /usr/share/icons /usr/share/java /usr/share/fonts /usr/lib/google-cloud-sdk /usr/lib/jvm | |
sudo rm -rf /usr/lib/mono /usr/lib/R /usr/lib/postgresql /usr/lib/heroku /usr/lib/gcc | |
- uses: actions/checkout@v4 | |
- uses: DeterminateSystems/nix-installer-action@main | |
with: | |
extra-conf: | | |
extra-trusted-substituters = https://helix.cachix.org https://cache.thalheim.io https://nix-community.cachix.org https://cache.garnix.io https://numtide.cachix.org https://staging.attic.rs/attic-ci | |
extra-trusted-public-keys = helix.cachix.org-1:ejp9KQpR1FBI2onstMQ34yogDm4OgU2ru6lIwPvuCVs= cache.nixos.org-1:6NCHdD59X431o0gWypbMrAURkbJ16ZPMQFGspcDShjY= cache.thalheim.io-1:R7msbosLEZKrxk/lKxf9BTjOOH7Ax3H0Qj0/6wiHOgc= nix-community.cachix.org-1:mB9FSh9qf2dCimDSUo8Zy7bkq5CX+/rkCWyvRCYg3Fs= cache.garnix.io:CTFPyKSLcx5RMJKfLo5EEPUObbA78b0YQ2DTCJXqr9g= numtide.cachix.org-1:2ps1kLBUWjxIneOy1Ik6cQjb41X0iXVXeHigGmycPPE= attic-ci:U5Sey4mUxwBXM3iFapmP0/ogODXywKLRNgRPQpEXxbo= | |
- uses: DeterminateSystems/magic-nix-cache-action@main | |
- name: Install and configure attic | |
continue-on-error: true | |
run: | | |
nix profile install "github.com:zhaofengli/attic/main#attic-client" | |
echo ATTIC_CACHE=$ATTIC_CACHE >>$GITHUB_ENV | |
export PATH=$HOME/.nix-profile/bin:$PATH | |
attic login --set-default ci "$ATTIC_SERVER" "$ATTIC_TOKEN" | |
attic use "$ATTIC_CACHE" | |
env: | |
ATTIC_SERVER: ${{ secrets.ATTIC_SERVER }} | |
ATTIC_CACHE: ${{ secrets.ATTIC_CACHE }} | |
ATTIC_TOKEN: ${{ secrets.ATTIC_TOKEN }} | |
- run: | | |
attic watch-store "ci:$ATTIC_CACHE" & | |
nix flake check | |
kill %1 |