My personal project and infrastructure archive
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 
nomicon/infra/libkookie/overlays/rust/.github/workflows/sync-channels.yaml

83 lines
2.3 KiB

name: sync-channels
on:
schedule:
# The nightly channel is usually updated at 01:00:00 UTC.
- cron: '0 2 * * *' # *-*-* 02:00:00 UTC
push:
branches:
- trigger-sync
jobs:
sync-channels:
name: Sync channels and prefetch toolchains
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
with:
ref: master
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token
- name: Install python
uses: actions/setup-python@v2
with:
python-version: '3.x'
- name: Install python packages
run: pip3 install -r ./scripts/requirements.txt
- name: Install Nix
uses: cachix/install-nix-action@v16
with:
nix_path: nixpkgs=channel:nixpkgs-unstable
# Workaround for https://github.com/oxalica/rust-overlay/issues/54
- name: Don't let ~/.cargo/bin mess things up
run: rm -rf ~/.cargo/bin
- name: Sync stable channel
timeout-minutes: 5
run: python3 ./scripts/fetch.py stable
- name: Sync beta channel
timeout-minutes: 5
run: python3 ./scripts/fetch.py beta
- name: Sync nightly channel
timeout-minutes: 5
run: python3 ./scripts/fetch.py nightly
- name: Check and commit changes
id: commit
continue-on-error: true
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add manifests
git commit -m "manifest: update"
- name: Validate nix files changed
if: steps.commit.outcome == 'success'
run: |
files=( $(git diff --name-only HEAD HEAD^ '*.nix') )
echo "${#files[*]} nix files changed: ${files[*]}"
if [[ "${#files[*]}" -ne 0 ]]; then
nix-instantiate --parse "${files[@]}" >/dev/null
fi
- name: Test stable Rust
if: steps.commit.outcome == 'success'
run: |
cd examples/hello-world
set -o pipefail
nix-shell --pure --command "make run" | tee out
[[ "$(< out)" == *"Hello, world!"* ]]
- name: Push changes
if: steps.commit.outcome == 'success'
uses: ad-m/github-push-action@master
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
branch: master