Skip to content

Commit 3008ac7

Browse files
authored
Merge pull request #2190 from kinnison/github-actions
GitHub actions
2 parents e59e575 + b34e892 commit 3008ac7

22 files changed

+1766
-475
lines changed
Lines changed: 93 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,93 @@
1+
# This is ci/actions-templates/centos-fmt-clippy.yaml
2+
# Do not edit this file in .github/workflows
3+
4+
name: Centos checks, formatting, clippy, and shellcheck, of Rustup
5+
6+
on:
7+
pull_request:
8+
branches:
9+
- "*"
10+
push:
11+
branches:
12+
- master
13+
- stable
14+
schedule:
15+
- cron: "30 0 * * 1" # Every Monday at half past midnight
16+
17+
jobs:
18+
check:
19+
name: Checks
20+
runs-on: ubuntu-latest
21+
strategy:
22+
fail-fast: false
23+
steps:
24+
- uses: actions/checkout@v2
25+
with:
26+
# v2 defaults to a shallow checkout, but we need at least to the previous tag
27+
fetch-depth: 0
28+
- name: Acquire tags for the repo
29+
run: |
30+
git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/*
31+
- name: Display the current git status
32+
run: |
33+
git status
34+
git describe
35+
- name: Prep cargo dirs
36+
run: |
37+
mkdir -p ~/.cargo/{registry,git}
38+
- name: Set environment variables appropriately for the build
39+
run: |
40+
echo "::add-path::$HOME/.cargo/bin"
41+
- name: Cache cargo registry
42+
uses: actions/cache@v1
43+
with:
44+
path: ~/.cargo/registry
45+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
46+
- name: Cache cargo index
47+
uses: actions/cache@v1
48+
with:
49+
path: ~/.cargo/git
50+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
51+
- name: Cache cargo build
52+
uses: actions/cache@v1
53+
with:
54+
path: target
55+
key: ${{ runner.os }}-cargo-build-clippy-beta-${{ hashFiles('**/Cargo.lock') }}
56+
- name: Install Rustup using ./rustup-init.sh
57+
run: |
58+
sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y
59+
- name: Ensure Beta is up to date
60+
run: |
61+
if rustc +beta -vV >/dev/null 2>/dev/null; then
62+
rustup toolchain uninstall beta
63+
fi
64+
rustup toolchain install --profile=minimal beta
65+
rustup default beta
66+
- name: Ensure we have the components we need
67+
run: |
68+
rustup component add rustfmt
69+
rustup component add clippy
70+
- name: Run the centos check within the docker image
71+
run: |
72+
HERE=$(pwd)
73+
docker run \
74+
--volume "$HERE":/checkout:ro \
75+
--workdir /checkout \
76+
--tty \
77+
--init \
78+
--rm \
79+
centos:6 \
80+
sh ./ci/raw_init.sh
81+
- name: Run shell checks
82+
run: |
83+
shellcheck -s dash -- rustup-init.sh
84+
git ls-files -- '*.sh' | xargs shellcheck -s dash -e SC1090
85+
git ls-files -- '*.bash' | xargs shellcheck -s bash -e SC1090
86+
- name: Run formatting checks
87+
run: |
88+
cargo fmt --all -- --check
89+
- name: Run cargo check and clippy
90+
run: |
91+
cargo check --all --all-targets
92+
git ls-files -- '*.rs' | xargs touch
93+
cargo clippy --all --all-targets
Lines changed: 132 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,132 @@
1+
# This is ci/actions-templates/linux-builds-template.yaml
2+
# Do not edit this file in .github/workflows
3+
4+
name: Linux-hosted builds of Rustup (master) # skip-pr skip-stable
5+
6+
on:
7+
push: # skip-pr
8+
branches: # skip-pr
9+
- master # skip-pr skip-stable
10+
schedule: # skip-pr skip-stable
11+
- cron: "30 0 * * 1" # Every Monday at half past midnight UTC skip-pr skip-stable
12+
13+
jobs:
14+
build:
15+
name: Build
16+
runs-on: ubuntu-latest
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
target:
21+
- x86_64-unknown-linux-gnu
22+
- armv7-unknown-linux-gnueabihf
23+
- aarch64-linux-android
24+
- aarch64-unknown-linux-gnu # skip-pr
25+
- powerpc64-unknown-linux-gnu # skip-pr
26+
- x86_64-unknown-linux-musl # skip-pr
27+
include:
28+
- target: x86_64-unknown-linux-gnu
29+
run_tests: YES
30+
steps:
31+
- uses: actions/checkout@v2
32+
with:
33+
# v2 defaults to a shallow checkout, but we need at least to the previous tag
34+
fetch-depth: 0
35+
- name: Acquire tags for the repo
36+
run: |
37+
git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/*
38+
- name: Display the current git status
39+
run: |
40+
git status
41+
git describe
42+
- name: Prep cargo dirs
43+
run: |
44+
mkdir -p ~/.cargo/{registry,git}
45+
- name: Set environment variables appropriately for the build
46+
run: |
47+
echo "::add-path::$HOME/.cargo/bin"
48+
echo "::set-env name=TARGET::${{matrix.target}}"
49+
- name: Skip tests
50+
run: |
51+
echo "::set-env name=SKIP_TESTS::yes"
52+
if: matrix.run_tests == ''
53+
- name: Cache cargo registry
54+
uses: actions/cache@v1
55+
with:
56+
path: ~/.cargo/registry
57+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
58+
- name: Cache cargo index
59+
uses: actions/cache@v1
60+
with:
61+
path: ~/.cargo/git
62+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
63+
- name: Cache cargo build
64+
uses: actions/cache@v1
65+
with:
66+
path: target
67+
key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
68+
- name: Install Rustup using ./rustup-init.sh
69+
run: |
70+
sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y
71+
- name: Ensure Stable is up to date
72+
run: |
73+
if rustc +stable -vV >/dev/null 2>/dev/null; then
74+
rustup toolchain uninstall stable
75+
fi
76+
rustup toolchain install --profile=minimal stable
77+
- name: Ensure we have our goal target installed
78+
run: |
79+
rustup target install "$TARGET"
80+
- name: Determine which docker we need to run in
81+
run: |
82+
case "$TARGET" in
83+
*-linux-android*) DOCKER=android ;; # Android uses a local docker image
84+
*) DOCKER="$TARGET" ;;
85+
esac
86+
echo "::set-env name=DOCKER::$DOCKER"
87+
- name: Fetch the docker
88+
run: bash ci/fetch-rust-docker.bash "${TARGET}"
89+
- name: Maybe build a docker from there
90+
run: |
91+
if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then
92+
docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" .
93+
fi
94+
- name: Run the build within the docker image
95+
run: |
96+
HERE=$(pwd)
97+
mkdir -p "${HERE}/target"
98+
chown -R "$(id -u)":"$(id -g)" "${HERE}/target"
99+
docker run \
100+
--entrypoint sh \
101+
--user "$(id -u)":"$(id -g)" \
102+
--volume "$(rustc --print sysroot)":/rustc-sysroot:ro \
103+
--volume "${HERE}":/checkout:ro \
104+
--volume "${HERE}"/target:/checkout/target \
105+
--workdir /checkout \
106+
--env TARGET="${TARGET}" \
107+
--env SKIP_TESTS="${SKIP_TESTS}" \
108+
--volume "${HOME}/.cargo:/cargo" \
109+
--env CARGO_HOME=/cargo \
110+
--env CARGO_TARGET_DIR=/checkout/target \
111+
--env LIBZ_SYS_STATIC=1 \
112+
--tty \
113+
--init \
114+
--rm \
115+
"${DOCKER}" \
116+
-c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash'
117+
- name: Acquire the AWS tooling
118+
run: |
119+
pip3 install -U setuptools
120+
pip3 install awscli
121+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
122+
- name: Prepare the dist
123+
run: |
124+
bash ci/prepare-deploy.bash
125+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
126+
- name: Deploy build to dev-static dist tree for release team
127+
run: |
128+
aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/
129+
env:
130+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
131+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
132+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
Lines changed: 127 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,127 @@
1+
# This is ci/actions-templates/linux-builds-template.yaml
2+
# Do not edit this file in .github/workflows
3+
4+
name: Linux-hosted builds of Rustup (PR) # skip-master skip-stable
5+
6+
on:
7+
pull_request: # skip-master skip-stable
8+
branches: # skip-master skip-stable
9+
- "*" # skip-master skip-stable
10+
11+
jobs:
12+
build:
13+
name: Build
14+
runs-on: ubuntu-latest
15+
strategy:
16+
fail-fast: false
17+
matrix:
18+
target:
19+
- x86_64-unknown-linux-gnu
20+
- armv7-unknown-linux-gnueabihf
21+
- aarch64-linux-android
22+
include:
23+
- target: x86_64-unknown-linux-gnu
24+
run_tests: YES
25+
steps:
26+
- uses: actions/checkout@v2
27+
with:
28+
# v2 defaults to a shallow checkout, but we need at least to the previous tag
29+
fetch-depth: 0
30+
- name: Acquire tags for the repo
31+
run: |
32+
git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/*
33+
- name: Display the current git status
34+
run: |
35+
git status
36+
git describe
37+
- name: Prep cargo dirs
38+
run: |
39+
mkdir -p ~/.cargo/{registry,git}
40+
- name: Set environment variables appropriately for the build
41+
run: |
42+
echo "::add-path::$HOME/.cargo/bin"
43+
echo "::set-env name=TARGET::${{matrix.target}}"
44+
- name: Skip tests
45+
run: |
46+
echo "::set-env name=SKIP_TESTS::yes"
47+
if: matrix.run_tests == ''
48+
- name: Cache cargo registry
49+
uses: actions/cache@v1
50+
with:
51+
path: ~/.cargo/registry
52+
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }}
53+
- name: Cache cargo index
54+
uses: actions/cache@v1
55+
with:
56+
path: ~/.cargo/git
57+
key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }}
58+
- name: Cache cargo build
59+
uses: actions/cache@v1
60+
with:
61+
path: target
62+
key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }}
63+
- name: Install Rustup using ./rustup-init.sh
64+
run: |
65+
sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y
66+
- name: Ensure Stable is up to date
67+
run: |
68+
if rustc +stable -vV >/dev/null 2>/dev/null; then
69+
rustup toolchain uninstall stable
70+
fi
71+
rustup toolchain install --profile=minimal stable
72+
- name: Ensure we have our goal target installed
73+
run: |
74+
rustup target install "$TARGET"
75+
- name: Determine which docker we need to run in
76+
run: |
77+
case "$TARGET" in
78+
*-linux-android*) DOCKER=android ;; # Android uses a local docker image
79+
*) DOCKER="$TARGET" ;;
80+
esac
81+
echo "::set-env name=DOCKER::$DOCKER"
82+
- name: Fetch the docker
83+
run: bash ci/fetch-rust-docker.bash "${TARGET}"
84+
- name: Maybe build a docker from there
85+
run: |
86+
if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then
87+
docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" .
88+
fi
89+
- name: Run the build within the docker image
90+
run: |
91+
HERE=$(pwd)
92+
mkdir -p "${HERE}/target"
93+
chown -R "$(id -u)":"$(id -g)" "${HERE}/target"
94+
docker run \
95+
--entrypoint sh \
96+
--user "$(id -u)":"$(id -g)" \
97+
--volume "$(rustc --print sysroot)":/rustc-sysroot:ro \
98+
--volume "${HERE}":/checkout:ro \
99+
--volume "${HERE}"/target:/checkout/target \
100+
--workdir /checkout \
101+
--env TARGET="${TARGET}" \
102+
--env SKIP_TESTS="${SKIP_TESTS}" \
103+
--volume "${HOME}/.cargo:/cargo" \
104+
--env CARGO_HOME=/cargo \
105+
--env CARGO_TARGET_DIR=/checkout/target \
106+
--env LIBZ_SYS_STATIC=1 \
107+
--tty \
108+
--init \
109+
--rm \
110+
"${DOCKER}" \
111+
-c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash'
112+
- name: Acquire the AWS tooling
113+
run: |
114+
pip3 install -U setuptools
115+
pip3 install awscli
116+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
117+
- name: Prepare the dist
118+
run: |
119+
bash ci/prepare-deploy.bash
120+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'
121+
- name: Deploy build to dev-static dist tree for release team
122+
run: |
123+
aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/
124+
env:
125+
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
126+
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
127+
if: github.event_name == 'push' && github.ref == 'refs/heads/stable'

0 commit comments

Comments
 (0)