diff --git a/.cirrus.yml b/.cirrus.yml deleted file mode 100644 index f07c6523c3..0000000000 --- a/.cirrus.yml +++ /dev/null @@ -1,16 +0,0 @@ -# This is ci/actions-templates/linux-builds-template.yaml -# Do not edit this file in .cirrus.yml - -task: - name: FreeBSD - freebsd_instance: - image: freebsd-13-2-release-amd64 - setup_script: | - pkg install -y git gmake bash - echo "=========" - echo "create non-root user and log into it" - pw group add -n tester - pw user add -n tester -g tester -s `which bash` - pw user mod tester -d `pwd` - chown -R tester . - sudo -u tester bash ci/cirrus-templates/script.bash diff --git a/.github/workflows/centos-fmt-clippy-on-all.yaml b/.github/workflows/centos-fmt-clippy-on-all.yaml deleted file mode 100644 index f75f37151a..0000000000 --- a/.github/workflows/centos-fmt-clippy-on-all.yaml +++ /dev/null @@ -1,97 +0,0 @@ -# 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@v4 - 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 diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml new file mode 100644 index 0000000000..9291668283 --- /dev/null +++ b/.github/workflows/ci.yaml @@ -0,0 +1,1228 @@ +# GitHub Actions workflow generated by ci/actions-templates/gen-workflows.sh +# Do not edit this file in .github/workflows + +name: CI + +on: + pull_request: + branches: + - "*" + push: + branches: + - master + - stable + - renovate/* + schedule: + - cron: "30 0 * * 1" # Every Monday at half past midnight UTC + +jobs: + + # This is ci/actions-templates/windows-builds-template.yaml + # Do not edit this file in .github/workflows + build-windows-pr: # job-name skip-master skip-stable + runs-on: windows-latest + if: ${{ github.event.pull_request }} # skip-master skip-stable + env: + RUSTFLAGS: -Ctarget-feature=+crt-static + strategy: + fail-fast: false + matrix: + target: + - x86_64-pc-windows-msvc + mode: + - dev + - release + include: + - target: x86_64-pc-windows-msvc + run_tests: YES + steps: + - uses: actions/checkout@v4 + # 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 "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + shell: powershell + if: matrix.mingw != '' + - name: Set PATH + run: | + echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 + - name: Skip tests + if: matrix.run_tests == '' || matrix.mode == 'release' + run: | + echo "SKIP_TESTS=yes" >> $GITHUB_ENV + shell: bash + - 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 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 + shell: bash + - name: Install the target + run: | + rustup target install ${{ matrix.target }} + - name: Run a full build + env: + TARGET: ${{ matrix.target }} + BUILD_PROFILE: ${{ matrix.mode }} + run: bash ci/run.bash + - name: Run cargo check and clippy + if: matrix.mode != 'release' + env: + TARGET: ${{ matrix.target }} + # os-specific code leads to lints escaping if we only run this in one target + run: | + cargo check --all --all-targets --features test + git ls-files -- '*.rs' | xargs touch + cargo clippy --workspace --all-targets --features test + - name: Upload the built artifact + if: matrix.mode == 'release' + uses: actions/upload-artifact@v4 + with: + name: rustup-init-${{ matrix.target }} + path: | + target/${{ matrix.target }}/release/rustup-init.exe + retention-days: 7 + - name: Acquire the AWS tooling + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + choco upgrade awscli + - name: Prepare the dist + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + .\ci\prepare-deploy.ps1 + shell: powershell + - 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 --debug s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist + 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 + + # This is ci/actions-templates/windows-builds-template.yaml + # Do not edit this file in .github/workflows + build-windows-master: # job-name skip-pr skip-stable + runs-on: windows-latest + if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + env: + RUSTFLAGS: -Ctarget-feature=+crt-static + strategy: + fail-fast: false + matrix: + target: + - x86_64-pc-windows-msvc + - aarch64-pc-windows-msvc # skip-pr + - x86_64-pc-windows-gnu # skip-pr + mode: + - dev + - release + include: + - target: x86_64-pc-windows-msvc + run_tests: YES + - target: x86_64-pc-windows-gnu # skip-pr + mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr + mingwdir: mingw64 # skip-pr + steps: + - uses: actions/checkout@v4 + # 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 "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + shell: powershell + if: matrix.mingw != '' + - name: Set PATH + run: | + echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 + - name: Skip tests + if: matrix.run_tests == '' || matrix.mode == 'release' + run: | + echo "SKIP_TESTS=yes" >> $GITHUB_ENV + shell: bash + - 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 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 + shell: bash + - name: Install the target + run: | + rustup target install ${{ matrix.target }} + - name: Run a full build + env: + TARGET: ${{ matrix.target }} + BUILD_PROFILE: ${{ matrix.mode }} + run: bash ci/run.bash + - name: Run cargo check and clippy + if: matrix.mode != 'release' + env: + TARGET: ${{ matrix.target }} + # os-specific code leads to lints escaping if we only run this in one target + run: | + cargo check --all --all-targets --features test + git ls-files -- '*.rs' | xargs touch + cargo clippy --workspace --all-targets --features test + - name: Upload the built artifact + if: matrix.mode == 'release' + uses: actions/upload-artifact@v4 + with: + name: rustup-init-${{ matrix.target }} + path: | + target/${{ matrix.target }}/release/rustup-init.exe + retention-days: 7 + - name: Acquire the AWS tooling + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + choco upgrade awscli + - name: Prepare the dist + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + .\ci\prepare-deploy.ps1 + shell: powershell + - 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 --debug s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist + 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 + + # This is ci/actions-templates/windows-builds-template.yaml + # Do not edit this file in .github/workflows + build-windows-stable: # job-name skip-master skip-pr + runs-on: windows-latest + if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master + 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 + - aarch64-pc-windows-msvc # skip-pr + - x86_64-pc-windows-gnu # skip-pr + - i686-pc-windows-gnu # skip-pr skip-master + mode: + - dev + - release + include: + - target: x86_64-pc-windows-msvc + run_tests: YES + - target: x86_64-pc-windows-gnu # skip-pr + mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr + mingwdir: mingw64 # skip-pr + - target: i686-pc-windows-gnu # skip-pr skip-master + mingwdir: mingw32 # skip-pr skip-master + mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master + steps: + - uses: actions/checkout@v4 + # 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 "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + shell: powershell + if: matrix.mingw != '' + - name: Set PATH + run: | + echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 + echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 + - name: Skip tests + if: matrix.run_tests == '' || matrix.mode == 'release' + run: | + echo "SKIP_TESTS=yes" >> $GITHUB_ENV + shell: bash + - 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 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 + shell: bash + - name: Install the target + run: | + rustup target install ${{ matrix.target }} + - name: Run a full build + env: + TARGET: ${{ matrix.target }} + BUILD_PROFILE: ${{ matrix.mode }} + run: bash ci/run.bash + - name: Run cargo check and clippy + if: matrix.mode != 'release' + env: + TARGET: ${{ matrix.target }} + # os-specific code leads to lints escaping if we only run this in one target + run: | + cargo check --all --all-targets --features test + git ls-files -- '*.rs' | xargs touch + cargo clippy --workspace --all-targets --features test + - name: Upload the built artifact + if: matrix.mode == 'release' + uses: actions/upload-artifact@v4 + with: + name: rustup-init-${{ matrix.target }} + path: | + target/${{ matrix.target }}/release/rustup-init.exe + retention-days: 7 + - name: Acquire the AWS tooling + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + choco upgrade awscli + - name: Prepare the dist + if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' + run: | + .\ci\prepare-deploy.ps1 + shell: powershell + - 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 --debug s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist + 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 + + # This is ci/actions-templates/linux-builds-template.yaml + # Do not edit this file in .github/workflows + build-linux-pr: # job-name skip-master skip-stable + runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} # skip-master skip-stable + strategy: + fail-fast: false + matrix: + mode: + - dev + - release + target: + - x86_64-unknown-linux-gnu + - armv7-unknown-linux-gnueabihf + - aarch64-linux-android + include: + - target: x86_64-unknown-linux-gnu + run_tests: YES + #snap_arch: amd64 + - target: armv7-unknown-linux-gnueabihf + #snap_arch: armhf + steps: + - name: Clone repo + uses: actions/checkout@v4 + 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 base docker images from rust-lang/rust + 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@v4 + 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 + + # This is ci/actions-templates/linux-builds-template.yaml + # Do not edit this file in .github/workflows + build-linux-master: # job-name skip-pr skip-stable + runs-on: ubuntu-latest + if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + 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@v4 + 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 base docker images from rust-lang/rust + 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@v4 + 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 + + # This is ci/actions-templates/linux-builds-template.yaml + # Do not edit this file in .github/workflows + build-linux-stable: # job-name skip-master skip-pr + runs-on: ubuntu-latest + if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master + 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 + - aarch64-unknown-linux-musl # skip-pr skip-master + - 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 + - x86_64-unknown-illumos # 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 + - riscv64gc-unknown-linux-gnu # skip-pr skip-master + - loongarch64-unknown-linux-gnu # skip-pr skip-master + include: + - target: x86_64-unknown-linux-gnu + run_tests: YES + #snap_arch: amd64 + - target: i686-unknown-linux-gnu # skip-pr skip-master + #snap_arch: i386 # skip-pr skip-master + - target: aarch64-unknown-linux-gnu # skip-pr + #snap_arch: arm64 # skip-pr + - target: armv7-unknown-linux-gnueabihf + #snap_arch: armhf + - target: powerpc64le-unknown-linux-gnu # skip-pr skip-master + #snap_arch: ppc64el # skip-pr skip-master + - target: s390x-unknown-linux-gnu # skip-pr skip-master + #snap_arch: s390x # skip-pr skip-master + steps: + - name: Clone repo + uses: actions/checkout@v4 + 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 base docker images from rust-lang/rust + 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@v4 + 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 + + # This is ci/actions-templates/macos-builds-template.yaml + # Do not edit this file in .github/workflows + build-macos: # job-name + runs-on: macos-latest + strategy: + matrix: + target: + - x86_64-apple-darwin + - aarch64-apple-darwin + mode: + - dev + - release + include: + - target: x86_64-apple-darwin + run_tests: YES + steps: + - uses: actions/checkout@v4 + 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 + echo "SKIP_TESTS=" >> $GITHUB_ENV + echo "LZMA_API_STATIC=1" >> $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: aarch64-specific items + run: | + # Use nightly for now + rustup toolchain install --profile=minimal nightly + rustup default nightly + if: matrix.target == 'aarch64-apple-darwin' + - name: Ensure we have our goal target installed + run: | + rustup target install "$TARGET" + - name: Run a full build and test + env: + BUILD_PROFILE: ${{ matrix.mode }} + run: bash ci/run.bash + - name: Dump dynamic link targets + if: matrix.mode == 'release' + run: | + otool -L target/${TARGET}/release/rustup-init + if otool -L target/${TARGET}/release/rustup-init | grep -q -F /usr/local/; then + echo >&2 "Unfortunately there are /usr/local things in the link. Fail." + exit 1 + fi + - name: Upload the built artifact + if: matrix.mode == 'release' + uses: actions/upload-artifact@v4 + 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 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 + - name: Flush cache + # This is a workaround for a bug with GitHub Actions Cache that causes + # corrupt cache entries (particularly in the target directory). See + # https://github.com/actions/cache/issues/403 and + # https://github.com/rust-lang/cargo/issues/8603. + run: sudo /usr/sbin/purge + + # This is ci/actions-templates/freebsd-builds-template.yaml + # Do not edit this file in .github/workflows + build-freebsd: # job-name + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + 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: Run a full build + uses: vmactions/freebsd-vm@v1 + with: + release: 13.2 + usesh: true + copyback: false + prepare: | + pkg install -y git gmake bash sudo + run: | + echo "=========" + echo "create non-root user and log into it" + pw group add -n tester + pw user add -n tester -g tester -s `which bash` + pw user mod tester -d `pwd` + chown -R tester . + sudo -u tester bash ci/freebsd/script.bash + + # This is ci/actions-templates/centos-fmt-clippy.yaml + # Do not edit this file in .github/workflows + check: # job-name + runs-on: ubuntu-latest + strategy: + fail-fast: false + steps: + - name: Clone repo + uses: actions/checkout@v4 + 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: Run CI workflow generation checks + run: | + ./ci/actions-templates/gen-workflows.sh + git diff --quiet + - 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 is ci/actions-templates/all-features-template.yaml + # Do not edit this file in .github/workflows + # + # 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. + build-all-features: # job-name + runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} + strategy: + fail-fast: false + matrix: + # Might add more targets in future. + target: + - x86_64-unknown-linux-gnu + steps: + - name: Clone repo + uses: actions/checkout@v4 + - 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 is ci/actions-templates/test-docs-templates.yaml + # Do not edit this file in .github/workflows + # + # Builds docs for both stable and master branches. + # stable is placed in the root of the gh-pages branch, while master is placed at /devel + doc: # job-name + runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} + steps: + - uses: actions/checkout@v4 + 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 user-guide + run: | + cd doc/user-guide + mdbook build + - name: Build dev-guide + run: | + cd doc/dev-guide + mdbook build + + # This is ci/actions-templates/conclusion-template.yaml + # Do not edit this file in .github/workflows + conclusion: + # https://github.com/PyO3/pyo3/blob/42601f3af94242b017402b763a495798a92da8f8/.github/workflows/ci.yml#L452-L472 + if: always() + runs-on: ubuntu-latest + steps: + - name: Result + run: | + jq -C <<< "${needs}" + # Check if all needs were successful or skipped. + "$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")" + env: + needs: ${{ toJson(needs) }} + needs: + - build-all-features + - check + - build-freebsd + - build-linux-pr + - build-linux-master + - build-linux-stable + - build-macos + - doc + - build-windows-pr + - build-windows-master + - build-windows-stable diff --git a/.github/workflows/linux-builds-on-master.yaml b/.github/workflows/linux-builds-on-master.yaml deleted file mode 100644 index 3a53089a1a..0000000000 --- a/.github/workflows/linux-builds-on-master.yaml +++ /dev/null @@ -1,159 +0,0 @@ -# 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@v4 - 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 base docker images from rust-lang/rust - 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@v4 - 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 diff --git a/.github/workflows/linux-builds-on-pr.yaml b/.github/workflows/linux-builds-on-pr.yaml deleted file mode 100644 index e6ffd388c6..0000000000 --- a/.github/workflows/linux-builds-on-pr.yaml +++ /dev/null @@ -1,153 +0,0 @@ -# This is ci/actions-templates/linux-builds-template.yaml -# Do not edit this file in .github/workflows - -name: Linux (PR) # skip-master skip-stable - -on: - pull_request: # skip-master skip-stable - branches: # skip-master skip-stable - - "*" # skip-master skip-stable - - renovate/* # skip-master 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 - include: - - target: x86_64-unknown-linux-gnu - run_tests: YES - #snap_arch: amd64 - - target: armv7-unknown-linux-gnueabihf - #snap_arch: armhf - steps: - - name: Clone repo - uses: actions/checkout@v4 - 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 base docker images from rust-lang/rust - 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@v4 - 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 diff --git a/.github/workflows/linux-builds-on-stable.yaml b/.github/workflows/linux-builds-on-stable.yaml deleted file mode 100644 index 1cac2fe5ee..0000000000 --- a/.github/workflows/linux-builds-on-stable.yaml +++ /dev/null @@ -1,183 +0,0 @@ -# This is ci/actions-templates/linux-builds-template.yaml -# Do not edit this file in .github/workflows - -name: Linux (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: - mode: - - dev - - release - target: - - x86_64-unknown-linux-gnu - - armv7-unknown-linux-gnueabihf - - aarch64-linux-android - - aarch64-unknown-linux-gnu # skip-pr - - aarch64-unknown-linux-musl # skip-pr skip-master - - 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 - - x86_64-unknown-illumos # 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 - - riscv64gc-unknown-linux-gnu # skip-pr skip-master - - loongarch64-unknown-linux-gnu # skip-pr skip-master - include: - - target: x86_64-unknown-linux-gnu - run_tests: YES - #snap_arch: amd64 - - target: i686-unknown-linux-gnu # skip-pr skip-master - #snap_arch: i386 # skip-pr skip-master - - target: aarch64-unknown-linux-gnu # skip-pr - #snap_arch: arm64 # skip-pr - - target: armv7-unknown-linux-gnueabihf - #snap_arch: armhf - - target: powerpc64le-unknown-linux-gnu # skip-pr skip-master - #snap_arch: ppc64el # skip-pr skip-master - - target: s390x-unknown-linux-gnu # skip-pr skip-master - #snap_arch: s390x # skip-pr skip-master - steps: - - name: Clone repo - uses: actions/checkout@v4 - 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 base docker images from rust-lang/rust - 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@v4 - 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 diff --git a/.github/workflows/macos-builds-on-all.yaml b/.github/workflows/macos-builds-on-all.yaml deleted file mode 100644 index 95088e0ba0..0000000000 --- a/.github/workflows/macos-builds-on-all.yaml +++ /dev/null @@ -1,138 +0,0 @@ -# This is ci/actions-templates/macos-builds-template.yaml -# Do not edit this file in .github/workflows - -name: macOS -on: - pull_request: - branches: - - "*" - push: - branches: - - master - - stable - - renovate/* - 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 - - aarch64-apple-darwin - mode: - - dev - - release - include: - - target: x86_64-apple-darwin - run_tests: YES - steps: - - uses: actions/checkout@v4 - 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 - echo "SKIP_TESTS=" >> $GITHUB_ENV - echo "LZMA_API_STATIC=1" >> $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: aarch64-specific items - run: | - # Use nightly for now - rustup toolchain install --profile=minimal nightly - rustup default nightly - if: matrix.target == 'aarch64-apple-darwin' - - name: Ensure we have our goal target installed - run: | - rustup target install "$TARGET" - - name: Run a full build and test - env: - BUILD_PROFILE: ${{ matrix.mode }} - run: bash ci/run.bash - - name: Dump dynamic link targets - if: matrix.mode == 'release' - run: | - otool -L target/${TARGET}/release/rustup-init - if otool -L target/${TARGET}/release/rustup-init | grep -q -F /usr/local/; then - echo >&2 "Unfortunately there are /usr/local things in the link. Fail." - exit 1 - fi - - name: Upload the built artifact - if: matrix.mode == 'release' - uses: actions/upload-artifact@v4 - 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 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 - - name: Flush cache - # This is a workaround for a bug with GitHub Actions Cache that causes - # corrupt cache entries (particularly in the target directory). See - # https://github.com/actions/cache/issues/403 and - # https://github.com/rust-lang/cargo/issues/8603. - run: sudo /usr/sbin/purge diff --git a/.github/workflows/windows-builds-on-master.yaml b/.github/workflows/windows-builds-on-master.yaml deleted file mode 100644 index 877a3c0f5c..0000000000 --- a/.github/workflows/windows-builds-on-master.yaml +++ /dev/null @@ -1,147 +0,0 @@ -# This is ci/actions-templates/windows-builds-template.yaml -# Do not edit this file in .github/workflows - -name: Windows (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 - - aarch64-pc-windows-msvc # skip-pr - - x86_64-pc-windows-gnu # skip-pr - mode: - - dev - - release - include: - - target: x86_64-pc-windows-msvc - run_tests: YES - - target: x86_64-pc-windows-gnu # skip-pr - mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr - mingwdir: mingw64 # skip-pr - steps: - - uses: actions/checkout@v4 - # 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 "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - shell: powershell - if: matrix.mingw != '' - - name: Set PATH - run: | - echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 - - name: Skip tests - if: matrix.run_tests == '' || matrix.mode == 'release' - run: | - echo "SKIP_TESTS=yes" >> $GITHUB_ENV - shell: bash - - 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 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 - shell: bash - - name: Install the target - run: | - rustup target install ${{ matrix.target }} - - name: Run a full build - env: - TARGET: ${{ matrix.target }} - BUILD_PROFILE: ${{ matrix.mode }} - run: bash ci/run.bash - - name: Run cargo check and clippy - if: matrix.mode != 'release' - env: - TARGET: ${{ matrix.target }} - # os-specific code leads to lints escaping if we only run this in one target - run: | - cargo check --all --all-targets --features test - git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets --features test - - name: Upload the built artifact - if: matrix.mode == 'release' - uses: actions/upload-artifact@v4 - with: - name: rustup-init-${{ matrix.target }} - path: | - target/${{ matrix.target }}/release/rustup-init.exe - retention-days: 7 - - name: Acquire the AWS tooling - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - choco upgrade awscli - - name: Prepare the dist - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - .\ci\prepare-deploy.ps1 - shell: powershell - - 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 --debug s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist - 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 diff --git a/.github/workflows/windows-builds-on-pr.yaml b/.github/workflows/windows-builds-on-pr.yaml deleted file mode 100644 index 0a4bd47d31..0000000000 --- a/.github/workflows/windows-builds-on-pr.yaml +++ /dev/null @@ -1,141 +0,0 @@ -# This is ci/actions-templates/windows-builds-template.yaml -# Do not edit this file in .github/workflows - -name: Windows (PR) # skip-master skip-stable - -on: - pull_request: # skip-master skip-stable - branches: # skip-master skip-stable - - "*" # skip-master skip-stable - - renovate/* # 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 - mode: - - dev - - release - include: - - target: x86_64-pc-windows-msvc - run_tests: YES - steps: - - uses: actions/checkout@v4 - # 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 "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - shell: powershell - if: matrix.mingw != '' - - name: Set PATH - run: | - echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 - - name: Skip tests - if: matrix.run_tests == '' || matrix.mode == 'release' - run: | - echo "SKIP_TESTS=yes" >> $GITHUB_ENV - shell: bash - - 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 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 - shell: bash - - name: Install the target - run: | - rustup target install ${{ matrix.target }} - - name: Run a full build - env: - TARGET: ${{ matrix.target }} - BUILD_PROFILE: ${{ matrix.mode }} - run: bash ci/run.bash - - name: Run cargo check and clippy - if: matrix.mode != 'release' - env: - TARGET: ${{ matrix.target }} - # os-specific code leads to lints escaping if we only run this in one target - run: | - cargo check --all --all-targets --features test - git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets --features test - - name: Upload the built artifact - if: matrix.mode == 'release' - uses: actions/upload-artifact@v4 - with: - name: rustup-init-${{ matrix.target }} - path: | - target/${{ matrix.target }}/release/rustup-init.exe - retention-days: 7 - - name: Acquire the AWS tooling - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - choco upgrade awscli - - name: Prepare the dist - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - .\ci\prepare-deploy.ps1 - shell: powershell - - 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 --debug s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist - 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 diff --git a/.github/workflows/windows-builds-on-stable.yaml b/.github/workflows/windows-builds-on-stable.yaml deleted file mode 100644 index 768ca6091d..0000000000 --- a/.github/workflows/windows-builds-on-stable.yaml +++ /dev/null @@ -1,150 +0,0 @@ -# This is ci/actions-templates/windows-builds-template.yaml -# Do not edit this file in .github/workflows - -name: Windows (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 - - aarch64-pc-windows-msvc # skip-pr - - x86_64-pc-windows-gnu # skip-pr - - i686-pc-windows-gnu # skip-pr skip-master - mode: - - dev - - release - include: - - target: x86_64-pc-windows-msvc - run_tests: YES - - target: x86_64-pc-windows-gnu # skip-pr - mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr - mingwdir: mingw64 # skip-pr - - target: i686-pc-windows-gnu # skip-pr skip-master - mingwdir: mingw32 # skip-pr skip-master - mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master - steps: - - uses: actions/checkout@v4 - # 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 "C:\msys64\usr\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - echo "C:\msys64\${{ matrix.mingwdir }}\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - shell: powershell - if: matrix.mingw != '' - - name: Set PATH - run: | - echo "%USERPROFILE%\.cargo\bin" | Out-File -Append -FilePath $env:GITHUB_PATH -Encoding utf8 - echo "TARGET=${{ matrix.target }}" | Out-File -Append -FilePath $env:GITHUB_ENV -Encoding utf8 - - name: Skip tests - if: matrix.run_tests == '' || matrix.mode == 'release' - run: | - echo "SKIP_TESTS=yes" >> $GITHUB_ENV - shell: bash - - 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 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 - shell: bash - - name: Install the target - run: | - rustup target install ${{ matrix.target }} - - name: Run a full build - env: - TARGET: ${{ matrix.target }} - BUILD_PROFILE: ${{ matrix.mode }} - run: bash ci/run.bash - - name: Run cargo check and clippy - if: matrix.mode != 'release' - env: - TARGET: ${{ matrix.target }} - # os-specific code leads to lints escaping if we only run this in one target - run: | - cargo check --all --all-targets --features test - git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets --features test - - name: Upload the built artifact - if: matrix.mode == 'release' - uses: actions/upload-artifact@v4 - with: - name: rustup-init-${{ matrix.target }} - path: | - target/${{ matrix.target }}/release/rustup-init.exe - retention-days: 7 - - name: Acquire the AWS tooling - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - choco upgrade awscli - - name: Prepare the dist - if: github.event_name == 'push' && github.ref == 'refs/heads/stable' && matrix.mode == 'release' - run: | - .\ci\prepare-deploy.ps1 - shell: powershell - - 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 --debug s3 cp --recursive dist s3://dev-static-rust-lang-org/rustup/dist - 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 diff --git a/.github/workflows/all-features.yaml b/ci/actions-templates/all-features-template.yaml similarity index 70% rename from .github/workflows/all-features.yaml rename to ci/actions-templates/all-features-template.yaml index a596654806..7e7bab0c21 100644 --- a/.github/workflows/all-features.yaml +++ b/ci/actions-templates/all-features-template.yaml @@ -1,20 +1,15 @@ -name: AllFeatures (PR) +jobs: # skip-all -# 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 + # This is ci/actions-templates/all-features-template.yaml + # Do not edit this file in .github/workflows + # + # 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. + build-all-features: # job-name runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} strategy: fail-fast: false matrix: diff --git a/ci/actions-templates/centos-fmt-clippy-template.yaml b/ci/actions-templates/centos-fmt-clippy-template.yaml index f75f37151a..99482e56bc 100644 --- a/ci/actions-templates/centos-fmt-clippy-template.yaml +++ b/ci/actions-templates/centos-fmt-clippy-template.yaml @@ -1,23 +1,8 @@ -# This is ci/actions-templates/centos-fmt-clippy.yaml -# Do not edit this file in .github/workflows +jobs: # skip-all -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 + # This is ci/actions-templates/centos-fmt-clippy.yaml + # Do not edit this file in .github/workflows + check: # job-name runs-on: ubuntu-latest strategy: fail-fast: false @@ -34,6 +19,10 @@ jobs: run: | git status git describe + - name: Run CI workflow generation checks + run: | + ./ci/actions-templates/gen-workflows.sh + git diff --quiet - name: Prep cargo dirs run: | mkdir -p ~/.cargo/{registry,git} diff --git a/ci/actions-templates/conclusion-template.yaml b/ci/actions-templates/conclusion-template.yaml new file mode 100644 index 0000000000..451398a093 --- /dev/null +++ b/ci/actions-templates/conclusion-template.yaml @@ -0,0 +1,17 @@ +jobs: # skip-all + + # This is ci/actions-templates/conclusion-template.yaml + # Do not edit this file in .github/workflows + conclusion: + # https://github.com/PyO3/pyo3/blob/42601f3af94242b017402b763a495798a92da8f8/.github/workflows/ci.yml#L452-L472 + if: always() + runs-on: ubuntu-latest + steps: + - name: Result + run: | + jq -C <<< "${needs}" + # Check if all needs were successful or skipped. + "$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")" + env: + needs: ${{ toJson(needs) }} + needs: diff --git a/ci/actions-templates/freebsd-builds-template.yaml b/ci/actions-templates/freebsd-builds-template.yaml new file mode 100644 index 0000000000..22e2aeab2a --- /dev/null +++ b/ci/actions-templates/freebsd-builds-template.yaml @@ -0,0 +1,30 @@ +jobs: # skip-all + + # This is ci/actions-templates/freebsd-builds-template.yaml + # Do not edit this file in .github/workflows + build-freebsd: # job-name + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + 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: Run a full build + uses: vmactions/freebsd-vm@v1 + with: + release: 13.2 + usesh: true + copyback: false + prepare: | + pkg install -y git gmake bash sudo + run: | + echo "=========" + echo "create non-root user and log into it" + pw group add -n tester + pw user add -n tester -g tester -s `which bash` + pw user mod tester -d `pwd` + chown -R tester . + sudo -u tester bash ci/freebsd/script.bash diff --git a/ci/actions-templates/gen-workflows.sh b/ci/actions-templates/gen-workflows.sh index d9c12019d1..abe8d1d385 100755 --- a/ci/actions-templates/gen-workflows.sh +++ b/ci/actions-templates/gen-workflows.sh @@ -1,25 +1,49 @@ #!/bin/sh INPATH=$(dirname "$0") -OUTPATH="${INPATH}/../../.github/workflows" +OUTPATH="${INPATH}/../../.github/workflows/ci.yaml" -gen_workflow () { - grep -v "skip-$2" "$INPATH/$1-template.yaml" > "$OUTPATH/$1-on-$2.yaml" +gen_job () { + grep -v "skip-$2" "$INPATH/$1-template.yaml" >> "$OUTPATH" } -mkdir -p "$OUTPATH" - -# macOS 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 - +cat << EOF > "$OUTPATH" +# GitHub Actions workflow generated by ci/actions-templates/gen-workflows.sh +# Do not edit this file in .github/workflows + +name: CI + +on: + pull_request: + branches: + - "*" + push: + branches: + - master + - stable + - renovate/* + schedule: + - cron: "30 0 * * 1" # Every Monday at half past midnight UTC + +jobs: +EOF + +gen_job windows-builds pr +gen_job windows-builds master +gen_job windows-builds stable + +gen_job linux-builds pr +gen_job linux-builds master +gen_job linux-builds stable + +# The following targets only have a single job +gen_job macos-builds all +gen_job freebsd-builds all +gen_job centos-fmt-clippy all +gen_job all-features all +gen_job test-docs all + +# Finally, we generate the conclusion, +# adding all the `# job-name` jobs to the `needs` list. +gen_job conclusion all +cat "$INPATH"/*-template.yaml | perl -nE 'say " - $1" if (m/^\s*([\w-_]+)\s*:.*job-name.*$/)' >> "$OUTPATH" diff --git a/ci/actions-templates/linux-builds-template.yaml b/ci/actions-templates/linux-builds-template.yaml index b6febedeb7..7523a706ce 100644 --- a/ci/actions-templates/linux-builds-template.yaml +++ b/ci/actions-templates/linux-builds-template.yaml @@ -1,26 +1,14 @@ -# This is ci/actions-templates/linux-builds-template.yaml -# Do not edit this file in .github/workflows +jobs: # skip-master skip-pr skip-stable -name: Linux (PR) # skip-master skip-stable -name: Linux (master) # skip-pr skip-stable -name: Linux (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 - - renovate/* # skip-master 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 + # This is ci/actions-templates/linux-builds-template.yaml + # Do not edit this file in .github/workflows + build-linux-pr: # job-name skip-master skip-stable + build-linux-master: # job-name skip-pr skip-stable + build-linux-stable: # job-name skip-master skip-pr runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} # skip-master skip-stable + if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master strategy: fail-fast: false matrix: diff --git a/ci/actions-templates/macos-builds-template.yaml b/ci/actions-templates/macos-builds-template.yaml index 95088e0ba0..e80db22354 100644 --- a/ci/actions-templates/macos-builds-template.yaml +++ b/ci/actions-templates/macos-builds-template.yaml @@ -1,22 +1,8 @@ -# This is ci/actions-templates/macos-builds-template.yaml -# Do not edit this file in .github/workflows +jobs: # skip-all -name: macOS -on: - pull_request: - branches: - - "*" - push: - branches: - - master - - stable - - renovate/* - schedule: - - cron: "30 0 * * 1" # Every Monday at half past midnight UTC - -jobs: - build: - name: Build + # This is ci/actions-templates/macos-builds-template.yaml + # Do not edit this file in .github/workflows + build-macos: # job-name runs-on: macos-latest strategy: matrix: diff --git a/.github/workflows/test-docs.yaml b/ci/actions-templates/test-docs-template.yaml similarity index 61% rename from .github/workflows/test-docs.yaml rename to ci/actions-templates/test-docs-template.yaml index 2c4e5bd56d..c17cd52193 100644 --- a/.github/workflows/test-docs.yaml +++ b/ci/actions-templates/test-docs-template.yaml @@ -1,17 +1,13 @@ -name: Test build docs on PR +jobs: # skip-all -on: - pull_request: - branches: - - "*" - -# Builds docs for both stable and master branches. -# stable is placed in the root of the gh-pages branch, while master is placed at /devel - -jobs: - doc: - name: Documentation + # This is ci/actions-templates/test-docs-templates.yaml + # Do not edit this file in .github/workflows + # + # Builds docs for both stable and master branches. + # stable is placed in the root of the gh-pages branch, while master is placed at /devel + doc: # job-name runs-on: ubuntu-latest + if: ${{ github.event.pull_request }} steps: - uses: actions/checkout@v4 with: @@ -28,4 +24,4 @@ jobs: - name: Build dev-guide run: | cd doc/dev-guide - mdbook build \ No newline at end of file + mdbook build diff --git a/ci/actions-templates/windows-builds-template.yaml b/ci/actions-templates/windows-builds-template.yaml index a2db565216..e8f2af7bfd 100644 --- a/ci/actions-templates/windows-builds-template.yaml +++ b/ci/actions-templates/windows-builds-template.yaml @@ -1,26 +1,14 @@ -# This is ci/actions-templates/windows-builds-template.yaml -# Do not edit this file in .github/workflows +jobs: # skip-master skip-pr skip-stable -name: Windows (PR) # skip-master skip-stable -name: Windows (master) # skip-pr skip-stable -name: Windows (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 - - renovate/* # skip-master 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 + # This is ci/actions-templates/windows-builds-template.yaml + # Do not edit this file in .github/workflows + build-windows-pr: # job-name skip-master skip-stable + build-windows-master: # job-name skip-pr skip-stable + build-windows-stable: # job-name skip-master skip-pr runs-on: windows-latest + if: ${{ github.event.pull_request }} # skip-master skip-stable + if: ${{ (github.event.push && github.ref_name == 'master') || github.event.schedule }} # skip-pr skip-stable + if: ${{ github.event.push && github.ref_name == 'stable' }} # skip-pr skip-master env: RUSTFLAGS: -Ctarget-feature=+crt-static strategy: @@ -34,16 +22,16 @@ jobs: - i686-pc-windows-gnu # skip-pr skip-master mode: - dev - - release + - release include: - target: x86_64-pc-windows-msvc run_tests: YES - - target: x86_64-pc-windows-gnu # skip-pr - mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr - mingwdir: mingw64 # skip-pr - - target: i686-pc-windows-gnu # skip-pr skip-master - mingwdir: mingw32 # skip-pr skip-master - mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master + - target: x86_64-pc-windows-gnu # skip-pr + mingw: https://ci-mirrors.rust-lang.org/rustc/x86_64-6.3.0-release-posix-seh-rt_v5-rev2.7z # skip-pr + mingwdir: mingw64 # skip-pr + - target: i686-pc-windows-gnu # skip-pr skip-master + mingwdir: mingw32 # skip-pr skip-master + mingw: https://ci-mirrors.rust-lang.org/rustc/i686-6.3.0-release-posix-dwarf-rt_v5-rev2.7z # skip-pr skip-master steps: - uses: actions/checkout@v4 # v2 defaults to a shallow checkout, but we need at least to the previous tag @@ -116,18 +104,18 @@ jobs: rustup target install ${{ matrix.target }} - name: Run a full build env: - TARGET: ${{ matrix.target }} + TARGET: ${{ matrix.target }} BUILD_PROFILE: ${{ matrix.mode }} run: bash ci/run.bash - name: Run cargo check and clippy if: matrix.mode != 'release' env: - TARGET: ${{ matrix.target }} + TARGET: ${{ matrix.target }} # os-specific code leads to lints escaping if we only run this in one target run: | cargo check --all --all-targets --features test git ls-files -- '*.rs' | xargs touch - cargo clippy --workspace --all-targets --features test + cargo clippy --workspace --all-targets --features test - name: Upload the built artifact if: matrix.mode == 'release' uses: actions/upload-artifact@v4 diff --git a/ci/cirrus-templates/freebsd.yaml b/ci/cirrus-templates/freebsd.yaml deleted file mode 100644 index 7df435be07..0000000000 --- a/ci/cirrus-templates/freebsd.yaml +++ /dev/null @@ -1,16 +0,0 @@ -# This is ci/actions-templates/linux-builds-template.yaml -# Do not edit this file in .cirrus.yml - -task: - name: FreeBSD - freebsd_instance: - image: freebsd-13-0-release-amd64 - setup_script: | - pkg install -y git gmake bash - echo "=========" - echo "create non-root user and log into it" - pw group add -n tester - pw user add -n tester -g tester -s `which bash` - pw user mod tester -d `pwd` - chown -R tester . - sudo -u tester bash ci/cirrus-templates/script.bash diff --git a/ci/cirrus-templates/gen-workflows.sh b/ci/cirrus-templates/gen-workflows.sh deleted file mode 100644 index 14d130ee9f..0000000000 --- a/ci/cirrus-templates/gen-workflows.sh +++ /dev/null @@ -1,6 +0,0 @@ -#!/bin/sh - -INPATH=$(dirname "$0") -OUTPATH="${INPATH}/../.." - -cp freebsd.yaml "$OUTPATH/.cirrus.yml" diff --git a/ci/cirrus-templates/script.bash b/ci/freebsd/script.bash similarity index 88% rename from ci/cirrus-templates/script.bash rename to ci/freebsd/script.bash index 98a4bade0e..5cf833fa47 100644 --- a/ci/cirrus-templates/script.bash +++ b/ci/freebsd/script.bash @@ -5,15 +5,11 @@ set -ex # First, we check that this script is not run as root because it would fail tests. if [ "root" == "$(whoami)" ]; then exit 1; fi -echo "=========" -echo "Acquire tags for the repo" - -git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* - echo "=========" echo "Display the current git status" git status +git tag --list git describe echo "========="