-
-
Notifications
You must be signed in to change notification settings - Fork 58
82 lines (69 loc) · 2.17 KB
/
sync-channels.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
name: Sync channels
on:
schedule:
# The nightly channel is usually updated at 01:00:00 UTC.
- cron: '0 2 * * *' # *-*-* 02:00:00 UTC
workflow_dispatch:
permissions:
contents: write
jobs:
sync-channels:
name: Sync channels and prefetch toolchains
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
persist-credentials: false
ref: master
- name: Install Nix
uses: cachix/install-nix-action@v22
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
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/fetch.py stable
- name: Sync beta channel
timeout-minutes: 5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/fetch.py beta
- name: Sync nightly channel
timeout-minutes: 5
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./scripts/fetch.py nightly
- name: Check and commit changes
id: commit
continue-on-error: true
run: |
git config --local user.email "[email protected]"
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