-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
11 changed files
with
1,301 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
name: AllFeatures (PR) | ||
|
||
# This is an additional workflow to test building with all feature combinations. | ||
# Unlike our main workflows, this doesn't self-test the rustup install scripts, | ||
# nor run on the rust docker images. This permits a smaller workflow without the | ||
# templating and so on. | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "*" | ||
- renovate/* | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
# Might add more targets in future. | ||
target: | ||
- x86_64-unknown-linux-gnu | ||
steps: | ||
- name: Clone repo | ||
uses: actions/checkout@v3 | ||
- name: Install rustup stable | ||
run: rustup toolchain install stable --profile minimal | ||
- name: Install Protoc | ||
uses: arduino/setup-protoc@v1 | ||
with: | ||
version: "3.x" | ||
repo-token: ${{ secrets.GITHUB_TOKEN }} | ||
- name: Set environment variables appropriately for the build | ||
run: | | ||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | ||
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV | ||
- name: Cache Cargo | ||
uses: Swatinem/rust-cache@v2 | ||
- name: Install cargo-all-features | ||
run: cargo install cargo-all-features --git https://github.com/rbtcollins/cargo-all-features.git | ||
- name: Ensure we have our goal target installed | ||
run: | | ||
rustup target install "$TARGET" | ||
- name: Build every combination | ||
run: | | ||
cargo check-all-features --root-only |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,97 @@ | ||
# This is ci/actions-templates/centos-fmt-clippy.yaml | ||
# Do not edit this file in .github/workflows | ||
|
||
name: General Checks | ||
|
||
on: | ||
pull_request: | ||
branches: | ||
- "*" | ||
push: | ||
branches: | ||
- master | ||
- stable | ||
- renovate/* | ||
schedule: | ||
- cron: "30 0 * * 1" # Every Monday at half past midnight | ||
|
||
jobs: | ||
check: | ||
name: Checks | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
steps: | ||
- name: Clone repo | ||
uses: actions/checkout@v3 | ||
with: | ||
# v2 defaults to a shallow checkout, but we need at least to the previous tag | ||
fetch-depth: 0 | ||
- name: Acquire tags for the repo | ||
run: | | ||
git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* | ||
- name: Display the current git status | ||
run: | | ||
git status | ||
git describe | ||
- name: Prep cargo dirs | ||
run: | | ||
mkdir -p ~/.cargo/{registry,git} | ||
- name: Set environment variables appropriately for the build | ||
run: | | ||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | ||
- name: Cache cargo registry and git trees | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Get rustc commit hash | ||
id: cargo-target-cache | ||
run: | | ||
echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT | ||
shell: bash | ||
- name: Cache cargo build | ||
uses: actions/cache@v3 | ||
with: | ||
path: target | ||
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ runner.os }}-cargo-clippy-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ github.base_ref }}-${{ runner.os }}-cargo-clippy-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Install Rustup using ./rustup-init.sh | ||
run: | | ||
sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y | ||
- name: Ensure Beta is up to date | ||
run: | | ||
if rustc +beta -vV >/dev/null 2>/dev/null; then | ||
rustup toolchain uninstall beta | ||
fi | ||
rustup toolchain install --profile=minimal beta | ||
rustup default beta | ||
- name: Ensure we have the components we need | ||
run: | | ||
rustup component add rustfmt | ||
rustup component add clippy | ||
- name: Run the centos check within the docker image | ||
run: | | ||
docker run \ | ||
--volume "$PWD":/checkout:ro \ | ||
--workdir /checkout \ | ||
--tty \ | ||
--init \ | ||
--rm \ | ||
centos:7 \ | ||
sh ./ci/raw_init.sh | ||
- name: Run shell checks | ||
run: | | ||
shellcheck -x -s dash -- rustup-init.sh | ||
git ls-files -- '*.sh' | xargs shellcheck -x -s dash | ||
git ls-files -- '*.bash' | xargs shellcheck -x -s bash | ||
- name: Run formatting checks | ||
run: | | ||
cargo fmt --all --check | ||
- name: Run cargo check and clippy | ||
run: | | ||
cargo check --all --all-targets --features test | ||
git ls-files -- '*.rs' | xargs touch | ||
cargo clippy --all --all-targets --features test |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,55 @@ | ||
name: Deploy Docs | ||
|
||
on: | ||
push: | ||
branches: | ||
- stable | ||
- master | ||
|
||
# Builds all docs for both stable and master branches. | ||
# In the gh-pages branch, we place: | ||
# stable user-guide at / | ||
# master user-guide at /devel | ||
# master dev-guide at /dev-guide | ||
|
||
jobs: | ||
doc: | ||
name: Documentation | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- name: Install mdbook | ||
run: | | ||
mkdir mdbook | ||
curl -Lf https://github.com/rust-lang/mdBook/releases/download/v0.4.6/mdbook-v0.4.6-x86_64-unknown-linux-gnu.tar.gz | tar -xz --directory=./mdbook | ||
echo "`pwd`/mdbook" >> $GITHUB_PATH | ||
- name: Build book | ||
run: | | ||
# Build for stable | ||
git checkout stable | ||
# Support both old and new directory structure during the transition | ||
cd doc/user-guide || cd doc | ||
mdbook build | ||
mv book ${{ runner.temp }} | ||
# Build for master | ||
cd $(git rev-parse --show-toplevel) | ||
git checkout master | ||
cd doc/user-guide | ||
mdbook build | ||
mv book ${{ runner.temp }}/book/devel | ||
# Build dev-guide for master | ||
cd ../dev-guide | ||
mdbook build | ||
mv book ${{ runner.temp }}/book/dev-guide | ||
- name: Deploy to GitHub | ||
run: | | ||
cd ${{ runner.temp }}/book | ||
git init | ||
git config user.name "Deploy from CI" | ||
git config user.email "" | ||
git add . .nojekyll | ||
git commit -m "Deploy $GITHUB_REF $GITHUB_SHA to gh-pages" | ||
git remote add origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/$GITHUB_REPOSITORY | ||
git push --force --set-upstream origin master:gh-pages |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,159 @@ | ||
# This is ci/actions-templates/linux-builds-template.yaml | ||
# Do not edit this file in .github/workflows | ||
|
||
name: Linux (master) # skip-pr skip-stable | ||
|
||
on: | ||
push: # skip-pr | ||
branches: # skip-pr | ||
- master # skip-pr skip-stable | ||
schedule: # skip-pr skip-stable | ||
- cron: "30 0 * * 1" # Every Monday at half past midnight UTC skip-pr skip-stable | ||
|
||
jobs: | ||
build: | ||
name: Build | ||
runs-on: ubuntu-latest | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
mode: | ||
- dev | ||
- release | ||
target: | ||
- x86_64-unknown-linux-gnu | ||
- armv7-unknown-linux-gnueabihf | ||
- aarch64-linux-android | ||
- aarch64-unknown-linux-gnu # skip-pr | ||
- powerpc64-unknown-linux-gnu # skip-pr | ||
- x86_64-unknown-linux-musl # skip-pr | ||
include: | ||
- target: x86_64-unknown-linux-gnu | ||
run_tests: YES | ||
#snap_arch: amd64 | ||
- target: aarch64-unknown-linux-gnu # skip-pr | ||
#snap_arch: arm64 # skip-pr | ||
- target: armv7-unknown-linux-gnueabihf | ||
#snap_arch: armhf | ||
steps: | ||
- name: Clone repo | ||
uses: actions/checkout@v3 | ||
with: | ||
# v2 defaults to a shallow checkout, but we need at least to the previous tag | ||
fetch-depth: 0 | ||
- name: Acquire tags for the repo | ||
run: | | ||
git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* | ||
- name: Display the current git status | ||
run: | | ||
git status | ||
git describe | ||
- name: Prep cargo dirs | ||
run: | | ||
mkdir -p ~/.cargo/{registry,git} | ||
- name: Set environment variables appropriately for the build | ||
run: | | ||
echo "$HOME/.cargo/bin" >> $GITHUB_PATH | ||
echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV | ||
- name: Skip tests | ||
if: matrix.run_tests == '' || matrix.mode == 'release' | ||
run: | | ||
echo "SKIP_TESTS=yes" >> $GITHUB_ENV | ||
- name: Cache cargo registry and git trees | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.cargo/registry | ||
~/.cargo/git | ||
key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Get rustc commit hash | ||
id: cargo-target-cache | ||
run: | | ||
echo "{rust_hash}={$(rustc -Vv | grep commit-hash | awk '{print $2}')}" >> $GITHUB_OUTPUT | ||
shell: bash | ||
- name: Cache cargo build | ||
uses: actions/cache@v3 | ||
with: | ||
path: target | ||
key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} | ||
restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-${{ matrix.mode }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} | ||
- name: Install Rustup using ./rustup-init.sh | ||
run: | | ||
sh ./rustup-init.sh --default-toolchain=none --profile=minimal -y | ||
- name: Ensure Stable is up to date | ||
run: | | ||
if rustc +stable -vV >/dev/null 2>/dev/null; then | ||
rustup toolchain uninstall stable | ||
fi | ||
rustup toolchain install --profile=minimal stable | ||
- name: Ensure we have our goal target installed | ||
run: | | ||
rustup target install "$TARGET" | ||
- name: Determine which docker we need to run in | ||
run: | | ||
case "$TARGET" in | ||
*-linux-android*) DOCKER=android ;; # Android uses a local docker image | ||
*) DOCKER="$TARGET" ;; | ||
esac | ||
echo "DOCKER=$DOCKER" >> $GITHUB_ENV | ||
- name: Fetch the docker | ||
run: bash ci/fetch-rust-docker.bash "${TARGET}" | ||
- name: Maybe build a docker from there | ||
run: | | ||
if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then | ||
docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" . | ||
fi | ||
- name: Run the build within the docker image | ||
env: | ||
BUILD_PROFILE: ${{ matrix.mode }} | ||
run: | | ||
mkdir -p "${PWD}/target" | ||
chown -R "$(id -u)":"$(id -g)" "${PWD}/target" | ||
docker run \ | ||
--entrypoint sh \ | ||
--env BUILD_PROFILE="${BUILD_PROFILE}" \ | ||
--env CARGO_HOME=/cargo \ | ||
--env CARGO_TARGET_DIR=/checkout/target \ | ||
--env LIBZ_SYS_STATIC=1 \ | ||
--env SKIP_TESTS="${SKIP_TESTS}" \ | ||
--env TARGET="${TARGET}" \ | ||
--init \ | ||
--rm \ | ||
--tty \ | ||
--user "$(id -u)":"$(id -g)" \ | ||
--volume "$(rustc --print sysroot)":/rustc-sysroot:ro \ | ||
--volume "${HOME}/.cargo:/cargo" \ | ||
--volume "${PWD}":/checkout:ro \ | ||
--volume "${PWD}"/target:/checkout/target \ | ||
--workdir /checkout \ | ||
"${DOCKER}" \ | ||
-c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' | ||
- name: Upload the built artifact | ||
uses: actions/upload-artifact@v3 | ||
if: matrix.mode == 'release' | ||
with: | ||
name: rustup-init-${{ matrix.target }} | ||
path: | | ||
target/${{ matrix.target }}/release/rustup-init | ||
retention-days: 7 | ||
- name: Acquire the AWS tooling | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' | ||
run: | | ||
pip3 install -U setuptools | ||
pip3 install awscli | ||
- name: Prepare the dist | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' | ||
run: | | ||
bash ci/prepare-deploy.bash | ||
- name: Deploy build to dev-static dist tree for release team | ||
if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' | ||
run: | | ||
aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/ | ||
env: | ||
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | ||
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | ||
AWS_DEFAULT_REGION: us-west-1 | ||
- name: Clear the cargo caches | ||
run: | | ||
cargo install cargo-cache --no-default-features --features ci-autoclean | ||
cargo-cache |
Oops, something went wrong.