diff --git a/.github/workflows/centos-fmt-clippy-on-all.yaml b/.github/workflows/centos-fmt-clippy-on-all.yaml new file mode 100644 index 0000000000..fc2c156a13 --- /dev/null +++ b/.github/workflows/centos-fmt-clippy-on-all.yaml @@ -0,0 +1,93 @@ +# This is ci/actions-templates/centos-fmt-clippy.yaml +# Do not edit this file in .github/workflows + +name: Centos checks, formatting, clippy, and shellcheck, of Rustup + +on: + pull_request: + branches: + - "*" + push: + branches: + - master + - stable + schedule: + - cron: "30 0 * * 1" # Every Monday at half past midnight + +jobs: + check: + name: Checks + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v2 + 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 "::add-path::$HOME/.cargo/bin" + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-clippy-beta-${{ 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: | + HERE=$(pwd) + docker run \ + --volume "$HERE":/checkout:ro \ + --workdir /checkout \ + --tty \ + --init \ + --rm \ + centos:6 \ + sh ./ci/raw_init.sh + - name: Run shell checks + run: | + shellcheck -s dash -- rustup-init.sh + git ls-files -- '*.sh' | xargs shellcheck -s dash -e SC1090 + git ls-files -- '*.bash' | xargs shellcheck -s bash -e SC1090 + - name: Run formatting checks + run: | + cargo fmt --all -- --check + - name: Run cargo check and clippy + run: | + cargo check --all --all-targets + git ls-files -- '*.rs' | xargs touch + cargo clippy --all --all-targets diff --git a/.github/workflows/linux-builds-on-master.yaml b/.github/workflows/linux-builds-on-master.yaml new file mode 100644 index 0000000000..261e2a177a --- /dev/null +++ b/.github/workflows/linux-builds-on-master.yaml @@ -0,0 +1,132 @@ +# This is ci/actions-templates/linux-builds-template.yaml +# Do not edit this file in .github/workflows + +name: Linux-hosted builds of Rustup (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: + 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 + steps: + - uses: actions/checkout@v2 + 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 "::add-path::$HOME/.cargo/bin" + echo "::set-env name=TARGET::${{matrix.target}}" + - name: Skip tests + run: | + echo "::set-env name=SKIP_TESTS::yes" + if: matrix.run_tests == '' + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ 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 "::set-env name=DOCKER::$DOCKER" + - 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 + run: | + HERE=$(pwd) + mkdir -p "${HERE}/target" + chown -R "$(id -u)":"$(id -g)" "${HERE}/target" + docker run \ + --entrypoint sh \ + --user "$(id -u)":"$(id -g)" \ + --volume "$(rustc --print sysroot)":/rustc-sysroot:ro \ + --volume "${HERE}":/checkout:ro \ + --volume "${HERE}"/target:/checkout/target \ + --workdir /checkout \ + --env TARGET="${TARGET}" \ + --env SKIP_TESTS="${SKIP_TESTS}" \ + --volume "${HOME}/.cargo:/cargo" \ + --env CARGO_HOME=/cargo \ + --env CARGO_TARGET_DIR=/checkout/target \ + --env LIBZ_SYS_STATIC=1 \ + --tty \ + --init \ + --rm \ + "${DOCKER}" \ + -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' + - name: Acquire the AWS tooling + run: | + pip3 install -U setuptools + pip3 install awscli + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Prepare the dist + run: | + bash ci/prepare-deploy.bash + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Deploy build to dev-static dist tree for release team + 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 }} + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' diff --git a/.github/workflows/linux-builds-on-pr.yaml b/.github/workflows/linux-builds-on-pr.yaml new file mode 100644 index 0000000000..467112aea8 --- /dev/null +++ b/.github/workflows/linux-builds-on-pr.yaml @@ -0,0 +1,127 @@ +# This is ci/actions-templates/linux-builds-template.yaml +# Do not edit this file in .github/workflows + +name: Linux-hosted builds of Rustup (PR) # skip-master skip-stable + +on: + pull_request: # skip-master skip-stable + branches: # skip-master skip-stable + - "*" # skip-master skip-stable + +jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + target: + - x86_64-unknown-linux-gnu + - armv7-unknown-linux-gnueabihf + - aarch64-linux-android + include: + - target: x86_64-unknown-linux-gnu + run_tests: YES + steps: + - uses: actions/checkout@v2 + 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 "::add-path::$HOME/.cargo/bin" + echo "::set-env name=TARGET::${{matrix.target}}" + - name: Skip tests + run: | + echo "::set-env name=SKIP_TESTS::yes" + if: matrix.run_tests == '' + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ 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 "::set-env name=DOCKER::$DOCKER" + - 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 + run: | + HERE=$(pwd) + mkdir -p "${HERE}/target" + chown -R "$(id -u)":"$(id -g)" "${HERE}/target" + docker run \ + --entrypoint sh \ + --user "$(id -u)":"$(id -g)" \ + --volume "$(rustc --print sysroot)":/rustc-sysroot:ro \ + --volume "${HERE}":/checkout:ro \ + --volume "${HERE}"/target:/checkout/target \ + --workdir /checkout \ + --env TARGET="${TARGET}" \ + --env SKIP_TESTS="${SKIP_TESTS}" \ + --volume "${HOME}/.cargo:/cargo" \ + --env CARGO_HOME=/cargo \ + --env CARGO_TARGET_DIR=/checkout/target \ + --env LIBZ_SYS_STATIC=1 \ + --tty \ + --init \ + --rm \ + "${DOCKER}" \ + -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' + - name: Acquire the AWS tooling + run: | + pip3 install -U setuptools + pip3 install awscli + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Prepare the dist + run: | + bash ci/prepare-deploy.bash + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Deploy build to dev-static dist tree for release team + 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 }} + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' diff --git a/.github/workflows/linux-builds-on-stable.yaml b/.github/workflows/linux-builds-on-stable.yaml new file mode 100644 index 0000000000..99d2eaf992 --- /dev/null +++ b/.github/workflows/linux-builds-on-stable.yaml @@ -0,0 +1,146 @@ +# This is ci/actions-templates/linux-builds-template.yaml +# Do not edit this file in .github/workflows + +name: Linux-hosted builds of Rustup (stable) # skip-master skip-pr + +on: + push: # skip-pr + branches: # skip-pr + - stable # skip-pr skip-master + +jobs: + build: + name: Build + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + 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 + - i686-unknown-linux-gnu # skip-pr skip-master + - arm-unknown-linux-gnueabi # skip-pr skip-master + - arm-unknown-linux-gnueabihf # skip-pr skip-master + - x86_64-unknown-freebsd # skip-pr skip-master + - x86_64-unknown-netbsd # skip-pr skip-master + - powerpc-unknown-linux-gnu # skip-pr skip-master + - powerpc64le-unknown-linux-gnu # skip-pr skip-master + - mips-unknown-linux-gnu # skip-pr skip-master + - mips64-unknown-linux-gnuabi64 # skip-pr skip-master + - mipsel-unknown-linux-gnu # skip-pr skip-master + - mips64el-unknown-linux-gnuabi64 # skip-pr skip-master + - s390x-unknown-linux-gnu # skip-pr skip-master + - arm-linux-androideabi # skip-pr skip-master + - armv7-linux-androideabi # skip-pr skip-master + - i686-linux-android # skip-pr skip-master + - x86_64-linux-android # skip-pr skip-master + include: + - target: x86_64-unknown-linux-gnu + run_tests: YES + steps: + - uses: actions/checkout@v2 + 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 "::add-path::$HOME/.cargo/bin" + echo "::set-env name=TARGET::${{matrix.target}}" + - name: Skip tests + run: | + echo "::set-env name=SKIP_TESTS::yes" + if: matrix.run_tests == '' + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ 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 "::set-env name=DOCKER::$DOCKER" + - 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 + run: | + HERE=$(pwd) + mkdir -p "${HERE}/target" + chown -R "$(id -u)":"$(id -g)" "${HERE}/target" + docker run \ + --entrypoint sh \ + --user "$(id -u)":"$(id -g)" \ + --volume "$(rustc --print sysroot)":/rustc-sysroot:ro \ + --volume "${HERE}":/checkout:ro \ + --volume "${HERE}"/target:/checkout/target \ + --workdir /checkout \ + --env TARGET="${TARGET}" \ + --env SKIP_TESTS="${SKIP_TESTS}" \ + --volume "${HOME}/.cargo:/cargo" \ + --env CARGO_HOME=/cargo \ + --env CARGO_TARGET_DIR=/checkout/target \ + --env LIBZ_SYS_STATIC=1 \ + --tty \ + --init \ + --rm \ + "${DOCKER}" \ + -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' + - name: Acquire the AWS tooling + run: | + pip3 install -U setuptools + pip3 install awscli + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Prepare the dist + run: | + bash ci/prepare-deploy.bash + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Deploy build to dev-static dist tree for release team + 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 }} + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' diff --git a/.github/workflows/macos-builds-on-all.yaml b/.github/workflows/macos-builds-on-all.yaml new file mode 100644 index 0000000000..3d37709794 --- /dev/null +++ b/.github/workflows/macos-builds-on-all.yaml @@ -0,0 +1,79 @@ +# This is ci/actions-templates/macos-builds-template.yaml +# Do not edit this file in .github/workflows + +name: Mac OS builds of Rustup +on: + pull_request: + branches: + - "*" + push: + branches: + - master + - stable + schedule: + - cron: "30 0 * * 1" # Every Monday at half past midnight UTC + +jobs: + build: + name: Build + runs-on: macos-latest + strategy: + matrix: + target: + - x86_64-apple-darwin + steps: + - uses: actions/checkout@v2 + 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 "::add-path::$HOME/.cargo/bin" + echo "::set-env name=TARGET::${{matrix.target}}" + echo "::set-env name=SKIP_TESTS::" + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using ./rustup-init.sh + run: | + sh ./rustup-init.sh --default-toolchain=stable --profile=minimal -y + rustup target install "$TARGET" + - name: Run a full build and test + run: bash ci/run.bash + - name: Acquire the AWS tooling + run: | + pip3 install awscli + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Prepare the dist + run: | + bash ci/prepare-deploy.bash + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Deploy build to dev-static dist tree for release team + 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 }} + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' diff --git a/.github/workflows/windows-builds-on-master.yaml b/.github/workflows/windows-builds-on-master.yaml new file mode 100644 index 0000000000..38f7c90c36 --- /dev/null +++ b/.github/workflows/windows-builds-on-master.yaml @@ -0,0 +1,174 @@ +# This is ci/actions-templates/windows-builds-template.yaml +# Do not edit this file in .github/workflows + +name: Windows builds of Rustup (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: windows-latest + env: + RUSTFLAGS: -Ctarget-feature=+crt-static + strategy: + fail-fast: false + matrix: + target: + - x86_64-pc-windows-msvc + - x86_64-pc-windows-gnu # skip-pr + include: + - target: x86_64-pc-windows-gnu + mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z + mingwdir: mingw64 + - target: i686-pc-windows-gnu + mingwdir: mingw32 + mingw: https://ci-mirrors.rust-lang.org/rustc/i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z + steps: + - uses: actions/checkout@v2 + # v2 defaults to a shallow checkout, but we need at least to the previous tag + with: + 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: | + New-Item "${env:USERPROFILE}\.cargo\registry" -ItemType Directory -Force + New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force + shell: powershell + - name: Install mingw + run: | + # We retrieve mingw from the Rust CI buckets + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z + 7z x -y mingw.7z -oC:\msys64 | Out-Null + del mingw.7z + echo ::add-path::C:\msys64\usr\bin + echo ::add-path::C:\msys64\${{ matrix.mingwdir }}\bin + shell: powershell + if: matrix.mingw != '' + - name: Set environment variables appropriately for the build + run: | + echo "::add-path::%USERPROFILE%\.cargo\bin" + echo "::set-env name=TARGET::${{matrix.target}}" + echo "::set-env name=SKIP_TESTS::" + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-static-crt-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using win.rustup.rs + run: | + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe + .\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --profile=minimal + del rustup-init.exe + shell: powershell + - name: Ensure stable toolchain is up to date + run: | + rustup update stable + - name: Install the target + run: | + rustup target install ${{ matrix.target }} + - name: Run a full build + run: | + cargo build --release --target ${{ matrix.target }} --locked + cargo run --release --target ${{ matrix.target }} --locked -- --dump-testament + # The test sequence relies on the total set of test binaries not changing + # because I have no idea how to script it. TODO: Get someone to script it? + # A script might be nicer, though these in theory could be made to run + # independently, assuming the run above succeeded, allowing us to run + # the full test suite rather than stop on first error, at least in PRs + - name: Run download and bin tests + run: | + cargo test --release --target ${{ matrix.target }} -p download + cargo test --release --target ${{ matrix.target }} --bin rustup-init + if: env.SKIP_TESTS == '' + - name: Run the lib and doc tests + run: | + cargo test --release --target ${{ matrix.target }} --lib --all + cargo test --release --target ${{ matrix.target }} --doc --all + if: env.SKIP_TESTS == '' + - name: Run the cli-exact test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-exact + if: env.SKIP_TESTS == '' + - name: Run the cli-inst-interactive test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-inst-interactive + if: env.SKIP_TESTS == '' + - name: Run the cli-misc test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-misc + if: env.SKIP_TESTS == '' + - name: Run the cli-rustup test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-rustup + if: env.SKIP_TESTS == '' + - name: Run the cli-self-upd test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-self-upd + if: env.SKIP_TESTS == '' + - name: Run the cli-v1 test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-v1 + if: env.SKIP_TESTS == '' + - name: Run the cli-v2 test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-v2 + if: env.SKIP_TESTS == '' + - name: Run the dist_install test + run: | + cargo test --release --target ${{ matrix.target }} --test dist_install + if: env.SKIP_TESTS == '' + - name: Run the dist_manifest test + run: | + cargo test --release --target ${{ matrix.target }} --test dist_manifest + if: env.SKIP_TESTS == '' + - name: Run the dist test + run: | + cargo test --release --target ${{ matrix.target }} --test dist -- --test-threads 1 + if: env.SKIP_TESTS == '' + - name: Run the dist_transactions test + run: | + cargo test --release --target ${{ matrix.target }} --test dist_transactions + if: env.SKIP_TESTS == '' + - name: Acquire the AWS tooling + run: | + pip3 install awscli + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Prepare the dist + run: | + .\ci\prepare-deploy.ps1 + shell: powershell + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Deploy build to dev-static dist tree for release team + run: | + aws s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist + shell: powershell + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' diff --git a/.github/workflows/windows-builds-on-pr.yaml b/.github/workflows/windows-builds-on-pr.yaml new file mode 100644 index 0000000000..7c0c332d71 --- /dev/null +++ b/.github/workflows/windows-builds-on-pr.yaml @@ -0,0 +1,171 @@ +# This is ci/actions-templates/windows-builds-template.yaml +# Do not edit this file in .github/workflows + +name: Windows builds of Rustup (PR) # skip-master skip-stable + +on: + pull_request: # skip-master skip-stable + branches: # skip-master skip-stable + - "*" # skip-master skip-stable + +jobs: + build: + name: Build + runs-on: windows-latest + env: + RUSTFLAGS: -Ctarget-feature=+crt-static + strategy: + fail-fast: false + matrix: + target: + - x86_64-pc-windows-msvc + include: + - target: x86_64-pc-windows-gnu + mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z + mingwdir: mingw64 + - target: i686-pc-windows-gnu + mingwdir: mingw32 + mingw: https://ci-mirrors.rust-lang.org/rustc/i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z + steps: + - uses: actions/checkout@v2 + # v2 defaults to a shallow checkout, but we need at least to the previous tag + with: + 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: | + New-Item "${env:USERPROFILE}\.cargo\registry" -ItemType Directory -Force + New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force + shell: powershell + - name: Install mingw + run: | + # We retrieve mingw from the Rust CI buckets + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z + 7z x -y mingw.7z -oC:\msys64 | Out-Null + del mingw.7z + echo ::add-path::C:\msys64\usr\bin + echo ::add-path::C:\msys64\${{ matrix.mingwdir }}\bin + shell: powershell + if: matrix.mingw != '' + - name: Set environment variables appropriately for the build + run: | + echo "::add-path::%USERPROFILE%\.cargo\bin" + echo "::set-env name=TARGET::${{matrix.target}}" + echo "::set-env name=SKIP_TESTS::" + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-static-crt-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using win.rustup.rs + run: | + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe + .\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --profile=minimal + del rustup-init.exe + shell: powershell + - name: Ensure stable toolchain is up to date + run: | + rustup update stable + - name: Install the target + run: | + rustup target install ${{ matrix.target }} + - name: Run a full build + run: | + cargo build --release --target ${{ matrix.target }} --locked + cargo run --release --target ${{ matrix.target }} --locked -- --dump-testament + # The test sequence relies on the total set of test binaries not changing + # because I have no idea how to script it. TODO: Get someone to script it? + # A script might be nicer, though these in theory could be made to run + # independently, assuming the run above succeeded, allowing us to run + # the full test suite rather than stop on first error, at least in PRs + - name: Run download and bin tests + run: | + cargo test --release --target ${{ matrix.target }} -p download + cargo test --release --target ${{ matrix.target }} --bin rustup-init + if: env.SKIP_TESTS == '' + - name: Run the lib and doc tests + run: | + cargo test --release --target ${{ matrix.target }} --lib --all + cargo test --release --target ${{ matrix.target }} --doc --all + if: env.SKIP_TESTS == '' + - name: Run the cli-exact test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-exact + if: env.SKIP_TESTS == '' + - name: Run the cli-inst-interactive test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-inst-interactive + if: env.SKIP_TESTS == '' + - name: Run the cli-misc test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-misc + if: env.SKIP_TESTS == '' + - name: Run the cli-rustup test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-rustup + if: env.SKIP_TESTS == '' + - name: Run the cli-self-upd test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-self-upd + if: env.SKIP_TESTS == '' + - name: Run the cli-v1 test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-v1 + if: env.SKIP_TESTS == '' + - name: Run the cli-v2 test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-v2 + if: env.SKIP_TESTS == '' + - name: Run the dist_install test + run: | + cargo test --release --target ${{ matrix.target }} --test dist_install + if: env.SKIP_TESTS == '' + - name: Run the dist_manifest test + run: | + cargo test --release --target ${{ matrix.target }} --test dist_manifest + if: env.SKIP_TESTS == '' + - name: Run the dist test + run: | + cargo test --release --target ${{ matrix.target }} --test dist -- --test-threads 1 + if: env.SKIP_TESTS == '' + - name: Run the dist_transactions test + run: | + cargo test --release --target ${{ matrix.target }} --test dist_transactions + if: env.SKIP_TESTS == '' + - name: Acquire the AWS tooling + run: | + pip3 install awscli + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Prepare the dist + run: | + .\ci\prepare-deploy.ps1 + shell: powershell + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Deploy build to dev-static dist tree for release team + run: | + aws s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist + shell: powershell + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' diff --git a/.github/workflows/windows-builds-on-stable.yaml b/.github/workflows/windows-builds-on-stable.yaml new file mode 100644 index 0000000000..6d40d0d35b --- /dev/null +++ b/.github/workflows/windows-builds-on-stable.yaml @@ -0,0 +1,174 @@ +# This is ci/actions-templates/windows-builds-template.yaml +# Do not edit this file in .github/workflows + +name: Windows builds of Rustup (stable) # skip-master skip-pr + +on: + push: # skip-pr + branches: # skip-pr + - stable # skip-pr skip-master + +jobs: + build: + name: Build + runs-on: windows-latest + env: + RUSTFLAGS: -Ctarget-feature=+crt-static + strategy: + fail-fast: false + matrix: + target: + - x86_64-pc-windows-msvc + - i686-pc-windows-msvc # skip-pr skip-master + - x86_64-pc-windows-gnu # skip-pr + - i686-pc-windows-gnu # skip-pr skip-master + include: + - target: x86_64-pc-windows-gnu + mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z + mingwdir: mingw64 + - target: i686-pc-windows-gnu + mingwdir: mingw32 + mingw: https://ci-mirrors.rust-lang.org/rustc/i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z + steps: + - uses: actions/checkout@v2 + # v2 defaults to a shallow checkout, but we need at least to the previous tag + with: + 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: | + New-Item "${env:USERPROFILE}\.cargo\registry" -ItemType Directory -Force + New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force + shell: powershell + - name: Install mingw + run: | + # We retrieve mingw from the Rust CI buckets + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z + 7z x -y mingw.7z -oC:\msys64 | Out-Null + del mingw.7z + echo ::add-path::C:\msys64\usr\bin + echo ::add-path::C:\msys64\${{ matrix.mingwdir }}\bin + shell: powershell + if: matrix.mingw != '' + - name: Set environment variables appropriately for the build + run: | + echo "::add-path::%USERPROFILE%\.cargo\bin" + echo "::set-env name=TARGET::${{matrix.target}}" + echo "::set-env name=SKIP_TESTS::" + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-static-crt-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using win.rustup.rs + run: | + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe + .\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --profile=minimal + del rustup-init.exe + shell: powershell + - name: Ensure stable toolchain is up to date + run: | + rustup update stable + - name: Install the target + run: | + rustup target install ${{ matrix.target }} + - name: Run a full build + run: | + cargo build --release --target ${{ matrix.target }} --locked + cargo run --release --target ${{ matrix.target }} --locked -- --dump-testament + # The test sequence relies on the total set of test binaries not changing + # because I have no idea how to script it. TODO: Get someone to script it? + # A script might be nicer, though these in theory could be made to run + # independently, assuming the run above succeeded, allowing us to run + # the full test suite rather than stop on first error, at least in PRs + - name: Run download and bin tests + run: | + cargo test --release --target ${{ matrix.target }} -p download + cargo test --release --target ${{ matrix.target }} --bin rustup-init + if: env.SKIP_TESTS == '' + - name: Run the lib and doc tests + run: | + cargo test --release --target ${{ matrix.target }} --lib --all + cargo test --release --target ${{ matrix.target }} --doc --all + if: env.SKIP_TESTS == '' + - name: Run the cli-exact test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-exact + if: env.SKIP_TESTS == '' + - name: Run the cli-inst-interactive test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-inst-interactive + if: env.SKIP_TESTS == '' + - name: Run the cli-misc test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-misc + if: env.SKIP_TESTS == '' + - name: Run the cli-rustup test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-rustup + if: env.SKIP_TESTS == '' + - name: Run the cli-self-upd test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-self-upd + if: env.SKIP_TESTS == '' + - name: Run the cli-v1 test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-v1 + if: env.SKIP_TESTS == '' + - name: Run the cli-v2 test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-v2 + if: env.SKIP_TESTS == '' + - name: Run the dist_install test + run: | + cargo test --release --target ${{ matrix.target }} --test dist_install + if: env.SKIP_TESTS == '' + - name: Run the dist_manifest test + run: | + cargo test --release --target ${{ matrix.target }} --test dist_manifest + if: env.SKIP_TESTS == '' + - name: Run the dist test + run: | + cargo test --release --target ${{ matrix.target }} --test dist -- --test-threads 1 + if: env.SKIP_TESTS == '' + - name: Run the dist_transactions test + run: | + cargo test --release --target ${{ matrix.target }} --test dist_transactions + if: env.SKIP_TESTS == '' + - name: Acquire the AWS tooling + run: | + pip3 install awscli + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Prepare the dist + run: | + .\ci\prepare-deploy.ps1 + shell: powershell + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Deploy build to dev-static dist tree for release team + run: | + aws s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist + shell: powershell + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 831d3fe296..0000000000 --- a/.travis.yml +++ /dev/null @@ -1,156 +0,0 @@ -dist: xenial -services: - - docker -language: shell - -git: - depth: false - quiet: true - -cache: - directories: - - "$HOME/.cargo" - - "$HOME/.cache/sccache" -before_cache: - - | - cargo install \ - --debug \ - --force \ - --git https://github.com/matthiaskrgr/cargo-cache \ - --no-default-features \ - --features ci-autoclean \ - --bin cargo-cache \ - -- \ - cargo-cache - - cargo cache - -matrix: - fast_finish: true - include: - # Linux builds use the `rust-slave-dist` image so we link them against a - # "super old glibc" to ensure that it runs on as many platforms as possible. - # These builds always run. PRs, master, staging, stable, etc. - - &linuxalways - os: linux - env: TARGET=x86_64-unknown-linux-gnu - # Most builds consuming this only run on the stable and staging branches - - &linuxstable - os: linux - env: TARGET=i686-unknown-linux-gnu - if: branch != master - # These builds run on non-pull-requests, so master, staging, stable... - - &linuxmaster - os: linux - env: SKIP_TESTS=1 TARGET=aarch64-unknown-linux-gnu - if: type != pull_request - - # Cross builds happen in the `rust-slave-linux-cross` image to ensure that - # we use the right cross compilers for these targets. That image should - # bundle all the gcc cross compilers to enable us to build OpenSSL - # Builds which occur only on stable (and staging branches) take linuxstable - # Those which occur on master or any other branch (but not PRs) linuxmaster - # And those which run always (PRs, master, staging, etc) linuxalways - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=arm-unknown-linux-gnueabi } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=arm-unknown-linux-gnueabihf } - - { <<: *linuxalways, env: SKIP_TESTS=1 TARGET=armv7-unknown-linux-gnueabihf } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=x86_64-unknown-freebsd } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=x86_64-unknown-netbsd } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=powerpc-unknown-linux-gnu } - - { <<: *linuxmaster, env: SKIP_TESTS=1 TARGET=powerpc64-unknown-linux-gnu } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=powerpc64le-unknown-linux-gnu } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=mips-unknown-linux-gnu } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=mipsel-unknown-linux-gnu } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=mips64-unknown-linux-gnuabi64 } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=mips64el-unknown-linux-gnuabi64 } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=s390x-unknown-linux-gnu } - - { <<: *linuxmaster, env: SKIP_TESTS=1 TARGET=x86_64-unknown-linux-musl } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=arm-linux-androideabi } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=armv7-linux-androideabi } - - { <<: *linuxalways, env: SKIP_TESTS=1 TARGET=aarch64-linux-android } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=i686-linux-android } - - { <<: *linuxstable, env: SKIP_TESTS=1 TARGET=x86_64-linux-android } - - # On OSX we want to target 10.7 so we ensure that the appropriate - # environment variable is set to tell the linker what we want. - # - # TODO: figure out why `xcode9.3`, the first image with OSX 10.13, breaks. - # Unclear why! - - &mac - os: osx - osx_image: xcode9.2 - if: type != pull_request - env: MACOSX_DEPLOYMENT_TARGET=10.7 TARGET=x86_64-apple-darwin - - <<: *mac - if: branch != master - env: MACOSX_DEPLOYMENT_TARGET=10.7 TARGET=i686-apple-darwin - - - name: rustfmt/clippy/rustup-init.sh/shellcheck - language: shell - before_install: - - sh ./rustup-init.sh --default-toolchain=beta --profile=minimal -y -c rustfmt -c clippy - - export PATH="$HOME/.cargo/bin:$PATH" - script: - - | - docker run \ - --volume "$TRAVIS_BUILD_DIR":/checkout:ro \ - --workdir /checkout \ - --rm \ - -it \ - centos:6 \ - sh ./ci/raw_init.sh; - - shellcheck -s dash -- rustup-init.sh; - - git ls-files -- '*.sh' | xargs shellcheck -s dash -e SC1090; - - git ls-files -- '*.bash' | xargs shellcheck -s bash -e SC1090; - - cargo fmt --all -- --check; - - cargo check --all --all-targets - - git ls-files -- '*.rs' | xargs touch - - cargo clippy --all --all-targets - before_deploy: - deploy: - - - &windows - os: windows - env: TARGET=x86_64-pc-windows-msvc EXE_EXT=.exe - services: nil - language: bash - if: branch == disabled-for-now - -before_install: - - sh ./rustup-init.sh --default-toolchain=stable --profile=minimal -y - - export PATH="$HOME/.cargo/bin:$PATH" - - rustup target add "$TARGET" - -install: - - export CARGO_TARGET_DIR="$TRAVIS_BUILD_DIR/target" - -script: - - mkdir -p target/"$TARGET"; - - | - case "$TARGET" in - *-linux-android*) DOCKER=android ;; # Android uses a local docker image - *-apple-darwin) ;; - *-pc-windows-*) ;; - *) DOCKER="$TARGET" ;; - esac - - | - if [ -n "$DOCKER" ]; then - bash ci/build-run-docker.bash "$DOCKER" "$TARGET" "$SKIP_TESTS"; - else - bash ci/run.bash; - fi - -before_deploy: - - bash ci/prepare-deploy-travis.bash - -deploy: - - provider: s3 - bucket: dev-static-rust-lang-org - skip_cleanup: true - local_dir: deploy - upload_dir: rustup - acl: public_read - region: us-west-1 - access_key_id: $AWS_ACCESS_KEY_ID - secret_access_key: $AWS_SECRET_ACCESS_KEY - on: - branch: stable diff --git a/appveyor.yml b/appveyor.yml deleted file mode 100644 index 4e96b85c82..0000000000 --- a/appveyor.yml +++ /dev/null @@ -1,141 +0,0 @@ -image: Visual Studio 2017 - -branches: - # whitelist - only: - - master - - stable - - auto -cache: - - '%USERPROFILE%\.cargo\' - - target -# before cache -after_test: - - powershell -File ci/prepare-deploy-appveyor.ps1 - - set CARGO_TARGET_DIR=%APPVEYOR_BUILD_FOLDER%\target - - cargo install - --debug - --force - --git https://github.com/matthiaskrgr/cargo-cache - --no-default-features - --features ci-autoclean - --bin cargo-cache - -- - cargo-cache - - cargo cache - -environment: - global: - RUSTFLAGS: -Ctarget-feature=+crt-static - RUST_BACKTRACE: 1 - matrix: - - TARGET: x86_64-pc-windows-msvc - ALLOW_PR: 1 - - TARGET: i686-pc-windows-msvc - - TARGET: x86_64-pc-windows-gnu - MINGW_DIR: mingw64 - - TARGET: i686-pc-windows-gnu - MINGW_DIR: mingw32 - access_token: - secure: q8Wqx0brgfpOYFQqWauvucE2h0o1WYb41a3gKaCKV9QiE4eTz6qLNlqyC3mdsp4Q - -matrix: - fast_finish: true # set this flag to immediately finish build once one of the jobs fails. - -install: - # If this is a PR and we're not allowed to test PRs, skip the whole build. - # Also if we're on the master branch no need to run the full test suite, so - # just do a smoke test. - - if defined APPVEYOR_PULL_REQUEST_NUMBER if NOT defined ALLOW_PR appveyor exit - - if "%APPVEYOR_REPO_BRANCH%" == "master" if NOT defined ALLOW_PR appveyor exit - - # Install MSYS2 and MINGW (32-bit & 64-bit) - - ps: | - # Check if MSYS2 was restored from cache - if($env:MINGW_DIR) { - if($env:MINGW_DIR -eq "mingw32") { - # Download and install MINGW (32-bit) - Write-Host "Installing MinGW (32-bit)..." -ForegroundColor Cyan - Write-Host "Downloading installation package..." - appveyor-retry appveyor DownloadFile https://ci-mirrors.rust-lang.org/rustc/i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z -FileName mingw.7z - } elseif($env:MINGW_DIR -eq "mingw64") { - # Download and install MINGW (64-bit) - Write-Host "Installing MinGW (64-bit)..." -ForegroundColor Cyan - Write-Host "Downloading installation package..." - appveyor-retry appveyor DownloadFile https://ci-mirrors.rust-lang.org/rustc/x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z -FileName mingw.7z - } - Write-Host "Extracting installation package..." - 7z x -y mingw.7z -oC:\msys64 | Out-Null - del mingw.7z - } else { - Write-Host "MSYS2 not required" -ForegroundColor Green - } - - # Install rust, x86_64-pc-windows-msvc host - - appveyor-retry appveyor DownloadFile https://win.rustup.rs/ -FileName rustup-init.exe - - rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --profile=minimal - - set PATH=%PATH%;%USERPROFILE%\.cargo\bin - - del rustup-init.exe - - # Install the target we're compiling for - - rustup target add %TARGET% - - # add mingw to PATH if necessary - - if defined MINGW_DIR set PATH=C:\msys64\%MINGW_DIR%\bin;C:\msys64\usr\bin;%PATH% - # And if mingw, re-put appveyor's git in place - - if defined MINGW_DIR set PATH=C:\Program Files\Git\cmd;%PATH% - - # let's see what we got - - where gcc rustc cargo - - rustc -vV - - cargo -V - -# Build settings, not to be confused with "before_build" and "after_build". -build: false - -build_script: - - cargo build --release --target %TARGET% --locked - - cargo run --release --target %TARGET% --locked -- --dump-testament - -test_script: - # The rest of this relies on the set of things to test not changing - # because I have no idea how to script it. TODO: Get someone to script it? - - cargo test --release --target %TARGET% -p download - - cargo test --release --target %TARGET% --bin rustup-init - - cargo test --release --target %TARGET% --lib --all - - cargo test --release --target %TARGET% --doc --all - - cargo test --release --target %TARGET% --test cli-exact - - cargo test --release --target %TARGET% --test cli-inst-interactive - - cargo test --release --target %TARGET% --test cli-misc - - cargo test --release --target %TARGET% --test cli-rustup - - cargo test --release --target %TARGET% --test cli-self-upd - - cargo test --release --target %TARGET% --test cli-v1 - - cargo test --release --target %TARGET% --test cli-v2 - - cargo test --release --target %TARGET% --test dist_install - - cargo test --release --target %TARGET% --test dist_manifest - - cargo test --release --target %TARGET% --test dist -- --test-threads 1 - - cargo test --release --target %TARGET% --test dist_transactions - - -artifacts: - - path: dist\$(TARGET)\rustup-init.exe - name: rustup-init - - path: dist\$(TARGET)\rustup-init.exe.sha256 - name: rustup-init-sha - - path: dist\$(TARGET)\rustup-setup.exe - name: rustup-setup - - path: dist\$(TARGET)\rustup-setup.exe.sha256 - name: rustup-setup-sha - -deploy: - - provider: S3 - skip_cleanup: true - access_key_id: $(AWS_ACCESS_KEY_ID) - secret_access_key: $(AWS_SECRET_ACCESS_KEY) - bucket: dev-static-rust-lang-org - set_public: true - region: us-west-1 - artifact: rustup-init,rustup-init-sha,rustup-setup,rustup-setup-sha - folder: rustup - on: - branch: stable diff --git a/ci/actions-templates/README.md b/ci/actions-templates/README.md new file mode 100644 index 0000000000..7e69479970 --- /dev/null +++ b/ci/actions-templates/README.md @@ -0,0 +1,96 @@ +# Rustup Github Actions Workflows + +This directory contains all the workflows we use in Rustup for Github Actions. + +## Triggers for CI builds + +Rustup has four situations in which we perform CI builds: + +1. On PR changes +2. On merge to master +3. Time-based rebuilds of master +4. Pushes to the stable branch + +The goals for each of those situations are subtly different. For PR changes, +we want to know as quickly as possible if the change is likely to be an issue. + +Once a change hits master, we want to know that all our targets build. + +Time based rebuilds of master are about determining if updates to the toolchain +have caused us problems, and also to try and hilight if we have flaky tests. + +The stable branch is about making releases. Builds from that branch are uploaded +to S3 so that we can then make a release of rustup. + +## Targets we need to build + +We build for all the Tier one targets and a non-trivial number of the tier two +targets of Rust. We do not even attempt tier three builds. + +We don't run the tests on all the targets because many are cross-built. If we +cross-build we don't run the tests. All the builds which aren't mac or windows +are built on an x86_64 system because that's the easiest way to get a performant +system. + +| Target | Cross | Tier | On PR? | On master? | +| ----------------------------- | ---------- | ----- | ------ | ---------- | +| x86_64-unknown-linux-gnu | No | One | Yes | Yes | +| armv7-unknown-linux-gnueabihf | Yes | Two | Yes | Yes | +| aarch64-linux-android | Yes | Two | Yes | Yes | +| aarch64-unknown-linux-gnu | Yes | Two | No | Yes | +| powerpc64-unknown-linux-gnu | Yes | Two | No | Yes | +| x86_64-unknown-linux-musl | Yes | Two | No | Yes | +| i686-unknown-linux-gnu | Yes | One | No | No | +| arm-unknown-linux-gnueabi | Yes | Two | No | No | +| arm-unknown-linux-gnueabihf | Yes | Two | No | No | +| x86_64-unknown-freebsd | Yes | Two | No | No | +| x86_64-unknown-netbsd | Yes | Two | No | No | +| powerpc-unknown-linux-gnu | Yes | Two | No | No | +| powerpc64le-unknown-linux-gnu | Yes | Two | No | No | +| mips-unknown-linux-gnu | Yes | Two | No | No | +| mips64-unknown-linux-gnu | Yes | Two | No | No | +| mipsel-unknown-linux-gnu | Yes | Two | No | No | +| mips64el-unknown-linux-gnu | Yes | Two | No | No | +| s390x-unknown-linux-gnu | Yes | Two | No | No | +| arm-linux-androideabi | Yes | Two | No | No | +| armv7-linux-androideabi | Yes | Two | No | No | +| i686-linux-android | Yes | Two | No | No | +| x86_64-linux-android | Yes | Two | No | No | +| ----------------------------- | ---------- | ----- | ------ | ---------- | +| x86_64-apple-darwin | No | One | Yes | Yes | +| ----------------------------- | ---------- | ----- | ------ | ---------- | +| x86_64-pc-windows-msvc | No | One | Yes | Yes | +| x86_64-pc-windows-gnu | No | One | No | Yes | +| i686-pc-windows-msvc | No | One | No | No | +| i686-pc-windows-gnu | No | One | No | No | + +We also have a clippy/shellcheck target which runs on x86_64 linux and is +run in all cases. It does a `cargo fmt` check, a `cargo clippy` check on the +beta toolchain, and also runs `rustup-init.sh` through to completion inside +a centos 6 docker to ensure that we continue to work on there OK. + +## Useful notes about how we run builds + +For the builds which run on x86_64 linux, we deliberately run inside a docker +image which comes from `rust-lang/rust`'s CI so that we know we're linking against +the same libc etc as the release of Rust. + +For the builds which run on Windows, we retrieve mingw from Rust's CI as well +so that we're clearly using the right version of that. + +In all cases, we attempt to use the `rustup-init.sh` from the branch under test +where at all possible, so that we spot errors in that ASAP. + +Given that, we prefer to not use a preinstalled rust/rustup at all if we can, +so we start from as bare a VM as makes sense. + +For Windows builds, we use a Visual Studio 2017 image if we can. + +## The workflows + +Due to limitations in how github workflows work, we have to create our workflows +from template files and then commit them. + +The templates are in this directory, and the built workflows end up in the +`.github/workflows` directory. `-all` always runs, `-on-pr` `-on-master` and +`-on-stable` do the obvious. diff --git a/ci/actions-templates/centos-fmt-clippy-template.yaml b/ci/actions-templates/centos-fmt-clippy-template.yaml new file mode 100644 index 0000000000..fc2c156a13 --- /dev/null +++ b/ci/actions-templates/centos-fmt-clippy-template.yaml @@ -0,0 +1,93 @@ +# This is ci/actions-templates/centos-fmt-clippy.yaml +# Do not edit this file in .github/workflows + +name: Centos checks, formatting, clippy, and shellcheck, of Rustup + +on: + pull_request: + branches: + - "*" + push: + branches: + - master + - stable + schedule: + - cron: "30 0 * * 1" # Every Monday at half past midnight + +jobs: + check: + name: Checks + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - uses: actions/checkout@v2 + 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 "::add-path::$HOME/.cargo/bin" + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-clippy-beta-${{ 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: | + HERE=$(pwd) + docker run \ + --volume "$HERE":/checkout:ro \ + --workdir /checkout \ + --tty \ + --init \ + --rm \ + centos:6 \ + sh ./ci/raw_init.sh + - name: Run shell checks + run: | + shellcheck -s dash -- rustup-init.sh + git ls-files -- '*.sh' | xargs shellcheck -s dash -e SC1090 + git ls-files -- '*.bash' | xargs shellcheck -s bash -e SC1090 + - name: Run formatting checks + run: | + cargo fmt --all -- --check + - name: Run cargo check and clippy + run: | + cargo check --all --all-targets + git ls-files -- '*.rs' | xargs touch + cargo clippy --all --all-targets diff --git a/ci/actions-templates/gen-workflows.sh b/ci/actions-templates/gen-workflows.sh new file mode 100644 index 0000000000..182bd80220 --- /dev/null +++ b/ci/actions-templates/gen-workflows.sh @@ -0,0 +1,25 @@ +#!/bin/sh + +INPATH=$(dirname "$0") +OUTPATH="${INPATH}/../../.github/workflows" + +gen_workflow () { + grep -v "skip-$2" "$INPATH/$1-template.yaml" > "$OUTPATH/$1-on-$2.yaml" +} + +mkdir -p "$OUTPATH" + +# Mac OS only has a single target so single flow +gen_workflow macos-builds all + +gen_workflow windows-builds pr +gen_workflow windows-builds master +gen_workflow windows-builds stable + +gen_workflow linux-builds pr +gen_workflow linux-builds master +gen_workflow linux-builds stable + +# The clippy checks only have a single target and thus single flow +gen_workflow centos-fmt-clippy all + diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml new file mode 100644 index 0000000000..8014f6b69d --- /dev/null +++ b/ci/actions-templates/linux-builds-template.yaml @@ -0,0 +1,154 @@ +# This is ci/actions-templates/linux-builds-template.yaml +# Do not edit this file in .github/workflows + +name: Linux-hosted builds of Rustup (PR) # skip-master skip-stable +name: Linux-hosted builds of Rustup (master) # skip-pr skip-stable +name: Linux-hosted builds of Rustup (stable) # skip-master skip-pr + +on: + pull_request: # skip-master skip-stable + branches: # skip-master skip-stable + - "*" # skip-master skip-stable + push: # skip-pr + branches: # skip-pr + - master # skip-pr skip-stable + - stable # skip-pr skip-master + 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: + 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 + - i686-unknown-linux-gnu # skip-pr skip-master + - arm-unknown-linux-gnueabi # skip-pr skip-master + - arm-unknown-linux-gnueabihf # skip-pr skip-master + - x86_64-unknown-freebsd # skip-pr skip-master + - x86_64-unknown-netbsd # skip-pr skip-master + - powerpc-unknown-linux-gnu # skip-pr skip-master + - powerpc64le-unknown-linux-gnu # skip-pr skip-master + - mips-unknown-linux-gnu # skip-pr skip-master + - mips64-unknown-linux-gnuabi64 # skip-pr skip-master + - mipsel-unknown-linux-gnu # skip-pr skip-master + - mips64el-unknown-linux-gnuabi64 # skip-pr skip-master + - s390x-unknown-linux-gnu # skip-pr skip-master + - arm-linux-androideabi # skip-pr skip-master + - armv7-linux-androideabi # skip-pr skip-master + - i686-linux-android # skip-pr skip-master + - x86_64-linux-android # skip-pr skip-master + include: + - target: x86_64-unknown-linux-gnu + run_tests: YES + steps: + - uses: actions/checkout@v2 + 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 "::add-path::$HOME/.cargo/bin" + echo "::set-env name=TARGET::${{matrix.target}}" + - name: Skip tests + run: | + echo "::set-env name=SKIP_TESTS::yes" + if: matrix.run_tests == '' + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ 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 "::set-env name=DOCKER::$DOCKER" + - 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 + run: | + HERE=$(pwd) + mkdir -p "${HERE}/target" + chown -R "$(id -u)":"$(id -g)" "${HERE}/target" + docker run \ + --entrypoint sh \ + --user "$(id -u)":"$(id -g)" \ + --volume "$(rustc --print sysroot)":/rustc-sysroot:ro \ + --volume "${HERE}":/checkout:ro \ + --volume "${HERE}"/target:/checkout/target \ + --workdir /checkout \ + --env TARGET="${TARGET}" \ + --env SKIP_TESTS="${SKIP_TESTS}" \ + --volume "${HOME}/.cargo:/cargo" \ + --env CARGO_HOME=/cargo \ + --env CARGO_TARGET_DIR=/checkout/target \ + --env LIBZ_SYS_STATIC=1 \ + --tty \ + --init \ + --rm \ + "${DOCKER}" \ + -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' + - name: Acquire the AWS tooling + run: | + pip3 install -U setuptools + pip3 install awscli + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Prepare the dist + run: | + bash ci/prepare-deploy.bash + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Deploy build to dev-static dist tree for release team + 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 }} + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' diff --git a/ci/actions-templates/macos-builds-template.yaml b/ci/actions-templates/macos-builds-template.yaml new file mode 100644 index 0000000000..3d37709794 --- /dev/null +++ b/ci/actions-templates/macos-builds-template.yaml @@ -0,0 +1,79 @@ +# This is ci/actions-templates/macos-builds-template.yaml +# Do not edit this file in .github/workflows + +name: Mac OS builds of Rustup +on: + pull_request: + branches: + - "*" + push: + branches: + - master + - stable + schedule: + - cron: "30 0 * * 1" # Every Monday at half past midnight UTC + +jobs: + build: + name: Build + runs-on: macos-latest + strategy: + matrix: + target: + - x86_64-apple-darwin + steps: + - uses: actions/checkout@v2 + 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 "::add-path::$HOME/.cargo/bin" + echo "::set-env name=TARGET::${{matrix.target}}" + echo "::set-env name=SKIP_TESTS::" + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using ./rustup-init.sh + run: | + sh ./rustup-init.sh --default-toolchain=stable --profile=minimal -y + rustup target install "$TARGET" + - name: Run a full build and test + run: bash ci/run.bash + - name: Acquire the AWS tooling + run: | + pip3 install awscli + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Prepare the dist + run: | + bash ci/prepare-deploy.bash + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Deploy build to dev-static dist tree for release team + 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 }} + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml new file mode 100644 index 0000000000..5bcd76d7c2 --- /dev/null +++ b/ci/actions-templates/windows-builds-template.yaml @@ -0,0 +1,182 @@ +# This is ci/actions-templates/windows-builds-template.yaml +# Do not edit this file in .github/workflows + +name: Windows builds of Rustup (PR) # skip-master skip-stable +name: Windows builds of Rustup (master) # skip-pr skip-stable +name: Windows builds of Rustup (stable) # skip-master skip-pr + +on: + pull_request: # skip-master skip-stable + branches: # skip-master skip-stable + - "*" # skip-master skip-stable + push: # skip-pr + branches: # skip-pr + - master # skip-pr skip-stable + - stable # skip-pr skip-master + 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: windows-latest + env: + RUSTFLAGS: -Ctarget-feature=+crt-static + strategy: + fail-fast: false + matrix: + target: + - x86_64-pc-windows-msvc + - i686-pc-windows-msvc # skip-pr skip-master + - x86_64-pc-windows-gnu # skip-pr + - i686-pc-windows-gnu # skip-pr skip-master + include: + - target: x86_64-pc-windows-gnu + mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-4.9.2-release-win32-seh-rt_v4-rev4.7z + mingwdir: mingw64 + - target: i686-pc-windows-gnu + mingwdir: mingw32 + mingw: https://ci-mirrors.rust-lang.org/rustc/i686-4.9.2-release-win32-dwarf-rt_v4-rev4.7z + steps: + - uses: actions/checkout@v2 + # v2 defaults to a shallow checkout, but we need at least to the previous tag + with: + 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: | + New-Item "${env:USERPROFILE}\.cargo\registry" -ItemType Directory -Force + New-Item "${env:USERPROFILE}\.cargo\git" -ItemType Directory -Force + shell: powershell + - name: Install mingw + run: | + # We retrieve mingw from the Rust CI buckets + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest ${{ matrix.mingw }} -OutFile mingw.7z + 7z x -y mingw.7z -oC:\msys64 | Out-Null + del mingw.7z + echo ::add-path::C:\msys64\usr\bin + echo ::add-path::C:\msys64\${{ matrix.mingwdir }}\bin + shell: powershell + if: matrix.mingw != '' + - name: Set environment variables appropriately for the build + run: | + echo "::add-path::%USERPROFILE%\.cargo\bin" + echo "::set-env name=TARGET::${{matrix.target}}" + echo "::set-env name=SKIP_TESTS::" + - name: Cache cargo registry + uses: actions/cache@v1 + with: + path: ~/.cargo/registry + key: ${{ runner.os }}-cargo-registry-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo index + uses: actions/cache@v1 + with: + path: ~/.cargo/git + key: ${{ runner.os }}-cargo-index-${{ hashFiles('**/Cargo.lock') }} + - name: Cache cargo build + uses: actions/cache@v1 + with: + path: target + key: ${{ runner.os }}-cargo-build-static-crt-${{ matrix.target }}-${{ hashFiles('**/Cargo.lock') }} + - name: Install Rustup using win.rustup.rs + run: | + # Disable the download progress bar which can cause perf issues + $ProgressPreference = "SilentlyContinue" + Invoke-WebRequest https://win.rustup.rs/ -OutFile rustup-init.exe + .\rustup-init.exe -y --default-host=x86_64-pc-windows-msvc --profile=minimal + del rustup-init.exe + shell: powershell + - name: Ensure stable toolchain is up to date + run: | + rustup update stable + - name: Install the target + run: | + rustup target install ${{ matrix.target }} + - name: Run a full build + run: | + cargo build --release --target ${{ matrix.target }} --locked + cargo run --release --target ${{ matrix.target }} --locked -- --dump-testament + # The test sequence relies on the total set of test binaries not changing + # because I have no idea how to script it. TODO: Get someone to script it? + # A script might be nicer, though these in theory could be made to run + # independently, assuming the run above succeeded, allowing us to run + # the full test suite rather than stop on first error, at least in PRs + - name: Run download and bin tests + run: | + cargo test --release --target ${{ matrix.target }} -p download + cargo test --release --target ${{ matrix.target }} --bin rustup-init + if: env.SKIP_TESTS == '' + - name: Run the lib and doc tests + run: | + cargo test --release --target ${{ matrix.target }} --lib --all + cargo test --release --target ${{ matrix.target }} --doc --all + if: env.SKIP_TESTS == '' + - name: Run the cli-exact test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-exact + if: env.SKIP_TESTS == '' + - name: Run the cli-inst-interactive test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-inst-interactive + if: env.SKIP_TESTS == '' + - name: Run the cli-misc test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-misc + if: env.SKIP_TESTS == '' + - name: Run the cli-rustup test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-rustup + if: env.SKIP_TESTS == '' + - name: Run the cli-self-upd test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-self-upd + if: env.SKIP_TESTS == '' + - name: Run the cli-v1 test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-v1 + if: env.SKIP_TESTS == '' + - name: Run the cli-v2 test + run: | + cargo test --release --target ${{ matrix.target }} --test cli-v2 + if: env.SKIP_TESTS == '' + - name: Run the dist_install test + run: | + cargo test --release --target ${{ matrix.target }} --test dist_install + if: env.SKIP_TESTS == '' + - name: Run the dist_manifest test + run: | + cargo test --release --target ${{ matrix.target }} --test dist_manifest + if: env.SKIP_TESTS == '' + - name: Run the dist test + run: | + cargo test --release --target ${{ matrix.target }} --test dist -- --test-threads 1 + if: env.SKIP_TESTS == '' + - name: Run the dist_transactions test + run: | + cargo test --release --target ${{ matrix.target }} --test dist_transactions + if: env.SKIP_TESTS == '' + - name: Acquire the AWS tooling + run: | + pip3 install awscli + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Prepare the dist + run: | + .\ci\prepare-deploy.ps1 + shell: powershell + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' + - name: Deploy build to dev-static dist tree for release team + run: | + aws s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist + shell: powershell + env: + AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' diff --git a/ci/build-run-docker.bash b/ci/build-run-docker.bash deleted file mode 100644 index d0627bf63b..0000000000 --- a/ci/build-run-docker.bash +++ /dev/null @@ -1,61 +0,0 @@ -#!/bin/bash - -script_dir=$(cd "$(dirname "$0")" && pwd) -root_dir="${script_dir}/.." - -. "${script_dir}/shared.bash" - -set -e -# Disable cause it makes shared script not to work properly -#set -x - -mkdir -p target -mkdir -p "${HOME}"/.cargo -mkdir -p "${HOME}"/.cache/sccache - -DOCKER="$1" -TARGET="$2" -SKIP_TESTS="$3" - -travis_fold start "fetch.image.${TARGET}" -travis_time_start -travis_do_cmd bash ci/fetch-rust-docker.bash "${TARGET}" -travis_time_finish -travis_fold end "fetch.image.${TARGET}" - -if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then - travis_fold start "build.Dockerfile.${DOCKER}" - travis_time_start - travis_do_cmd docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" . - travis_time_finish - travis_fold end "build.Dockerfile.${DOCKER}" -fi - -# shellcheck disable=SC2016 -docker run \ - --entrypoint sh \ - --user "$(id -u)":"$(id -g)" \ - --volume "$(rustc --print sysroot)":/rustc-sysroot:ro \ - --volume "${root_dir}":/checkout:ro \ - --volume "${root_dir}"/target:/checkout/target \ - --workdir /checkout \ - --env TARGET="${TARGET}" \ - --env SKIP_TESTS="${SKIP_TESTS}" \ - --volume "${HOME}/.cargo:/cargo" \ - --env CARGO_HOME=/cargo \ - --env CARGO_TARGET_DIR=/checkout/target \ - --env LIBZ_SYS_STATIC=1 \ - --volume "${HOME}"/.cache/sccache:/sccache \ - --env SCCACHE_DIR=/sccache \ - --tty \ - --init \ - --rm \ - "${DOCKER}" \ - -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' - -# check that rustup-init was built with ssl support -# see https://github.com/rust-lang/rustup/issues/1051 -if ! (nm target/"${TARGET}"/release/rustup-init | grep -q Curl_ssl_version); then - echo "Missing ssl support!!!!" >&2 - exit 1 -fi diff --git a/ci/fetch-rust-docker.bash b/ci/fetch-rust-docker.bash index d5412a4b10..df1bc764a1 100644 --- a/ci/fetch-rust-docker.bash +++ b/ci/fetch-rust-docker.bash @@ -49,7 +49,7 @@ if [ -z "$(docker images -q "${LOCAL_DOCKER_TAG}")" ]; then echo "Attempting to download $url" rm -f "$cache" set +e - travis_retry curl -y 30 -Y 10 --connect-timeout 30 -f -L -C - -o "$cache" "$url" + command_retry curl -y 30 -Y 10 --connect-timeout 30 -f -L -C - -o "$cache" "$url" set -e docker load --quiet -i "$cache" docker tag "$digest" "${LOCAL_DOCKER_TAG}" diff --git a/ci/prepare-deploy-travis.bash b/ci/prepare-deploy-travis.bash deleted file mode 100644 index 5c24a02718..0000000000 --- a/ci/prepare-deploy-travis.bash +++ /dev/null @@ -1,41 +0,0 @@ -#!/bin/bash - -set -u -e - -# Not every build sets EXE_EXT since it is empty for non .exe builds -# So this sets it explicitly to the empty string if it's unset. -EXE_EXT=${EXE_EXT:=} - -if [ "$TRAVIS_PULL_REQUEST" = "true" ] || [ "$TRAVIS_BRANCH" = "auto" ]; then - exit 0 -fi - -# Copy rustup-init to rustup-setup for backwards compatibility -cp target/"$TARGET"/release/rustup-init"${EXE_EXT}" target/"$TARGET"/release/rustup-setup"${EXE_EXT}" - -# Generate hashes -if [ "$TRAVIS_OS_NAME" = "osx" ]; then - find target/"$TARGET"/release/ -maxdepth 1 -type f -exec sh -c 'fn="$1"; shasum -a 256 -b "$fn" > "$fn".sha256' sh {} \; -else - find target/"$TARGET"/release/ -maxdepth 1 -type f -exec sh -c 'fn="$1"; sha256sum -b "$fn" > "$fn".sha256' sh {} \; -fi - -# The directory for deployment artifacts -dest="deploy" - -# Prepare bins for upload -bindest="$dest/dist/$TARGET" -mkdir -p "$bindest/" -cp target/"$TARGET"/release/rustup-init"${EXE_EXT}" "$bindest/" -cp target/"$TARGET"/release/rustup-init"${EXE_EXT}".sha256 "$bindest/" -cp target/"$TARGET"/release/rustup-setup"${EXE_EXT}" "$bindest/" -cp target/"$TARGET"/release/rustup-setup"${EXE_EXT}".sha256 "$bindest/" - -if [ "$TARGET" != "x86_64-unknown-linux-gnu" ]; then - exit 0 -fi - -cp rustup-init.sh "$dest/" - -# Prepare website for upload -cp -R www "$dest/www" diff --git a/ci/prepare-deploy.bash b/ci/prepare-deploy.bash new file mode 100644 index 0000000000..137d62858d --- /dev/null +++ b/ci/prepare-deploy.bash @@ -0,0 +1,33 @@ +#!/bin/bash + +set -u -e + +# Copy rustup-init to rustup-setup for backwards compatibility +cp target/"$TARGET"/release/rustup-init target/"$TARGET"/release/rustup-setup + +# Generate hashes +if [ "$(uname -s)" = "Darwin" ]; then + find target/"$TARGET"/release/ -maxdepth 1 -type f -exec sh -c 'fn="$1"; shasum -a 256 -b "$fn" > "$fn".sha256' sh {} \; +else + find target/"$TARGET"/release/ -maxdepth 1 -type f -exec sh -c 'fn="$1"; sha256sum -b "$fn" > "$fn".sha256' sh {} \; +fi + +# The directory for deployment artifacts +dest="deploy" + +# Prepare bins for upload +bindest="$dest/dist/$TARGET" +mkdir -p "$bindest/" +cp target/"$TARGET"/release/rustup-init "$bindest/" +cp target/"$TARGET"/release/rustup-init.sha256 "$bindest/" +cp target/"$TARGET"/release/rustup-setup "$bindest/" +cp target/"$TARGET"/release/rustup-setup.sha256 "$bindest/" + +if [ "$TARGET" != "x86_64-unknown-linux-gnu" ]; then + exit 0 +fi + +cp rustup-init.sh "$dest/" + +# Prepare website for upload +cp -R www "$dest/www" diff --git a/ci/prepare-deploy-appveyor.ps1 b/ci/prepare-deploy.ps1 similarity index 85% rename from ci/prepare-deploy-appveyor.ps1 rename to ci/prepare-deploy.ps1 index 78abf1a53f..8b964e211d 100644 --- a/ci/prepare-deploy-appveyor.ps1 +++ b/ci/prepare-deploy.ps1 @@ -1,10 +1,3 @@ -if ($env:APPVEYOR_PULL_REQUEST_NUMBER) { - exit 0 -} - -if ($env:APPVEYOR_REPO_BRANCH -eq "auto") { - exit 0 -} # Copy rustup-init to rustup-setup for backwards compatibility cp target\${env:TARGET}\release\rustup-init.exe target\${env:TARGET}\release\rustup-setup.exe diff --git a/ci/shared.bash b/ci/shared.bash index f4972d62ea..b540304371 100644 --- a/ci/shared.bash +++ b/ci/shared.bash @@ -3,27 +3,17 @@ # This file is intended to be sourced, so it is not being marked as # an executable file in git. -# This is from +# This is modified from # https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_setup_env.bash -travis_setup_env() { - export ANSI_RED='\033[31;1m' - export ANSI_GREEN='\033[32;1m' - export ANSI_YELLOW='\033[33;1m' - export ANSI_RESET='\033[0m' - export ANSI_CLEAR='\033[0K' -} - -# This is from -# https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_fold.bash -travis_fold() { - local action="${1}" - local name="${2}" - printf 'travis_fold:%s:%s\r'"${ANSI_CLEAR}" "${action}" "${name}" -} +export ANSI_RED='\033[31;1m' +export ANSI_GREEN='\033[32;1m' +export ANSI_YELLOW='\033[33;1m' +export ANSI_RESET='\033[0m' +export ANSI_CLEAR='\033[0K' # This is modified loop version of # https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/travis_retry.bash -travis_retry() { +command_retry() { local result=0 local count=1 local max=5 @@ -43,54 +33,3 @@ travis_retry() { return "${result}" } -# This is from -# https://github.com/travis-ci/travis-build/blob/master/lib/travis/build/bash/ -travis_nanoseconds() { - local cmd='date' - local format='+%s%N' - - if command -v gdate >/dev/null; then - cmd='gdate' - elif [ "$(uname)" = Darwin ]; then - format='+%s000000000' - fi - - "${cmd}" -u "${format}" -} - -# Generate random integer like bash's `$RANDOM`. -travis_generate_rand() { - shuf -i 0-$((0xffffffff)) -n 1 -} - -travis_time_start() { - TRAVIS_TIMER_ID="$(printf '%08x' "$(travis_generate_rand)")" - TRAVIS_TIMER_START_TIME="$(travis_nanoseconds)" - export TRAVIS_TIMER_ID TRAVIS_TIMER_START_TIME - printf 'travis_time:start:%s\r'"${ANSI_CLEAR}" "${TRAVIS_TIMER_ID}" -} - -travis_time_finish() { - travis_timer_end_time="$(travis_nanoseconds)" - local duration="$((travis_timer_end_time - TRAVIS_TIMER_START_TIME))" - printf '\ntravis_time:end:%s:start=%s,finish=%s,duration=%s\r'"${ANSI_CLEAR}" \ - "${TRAVIS_TIMER_ID}" "${TRAVIS_TIMER_START_TIME}" \ - "${travis_timer_end_time}" "${duration}" -} - -travis_do_cmd() { - echo "$ ${*}" - "${@}" - local result="$?" - export TRAVIS_TEST_RESULT=$((${TRAVIS_TEST_RESULT:-0} | $((result != 0)))) - - if [ "${result}" -eq 0 ]; then - printf '%b' "${ANSI_GREEN}" - else - printf '%b' "${ANSI_RED}" - fi - printf 'The command "%s" exited with %d.'"${ANSI_RESET}"'\n' "${*}" "${result}" - return "$result" -} - -travis_setup_env