# This is ci/actions-templates/linux-builds-template.yaml # Do not edit this file in .github/workflows 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 schedule: # skip-pr skip-stable - cron: "30 0 * * 1" # Every Monday at half past midnight UTC skip-pr skip-stable jobs: build: name: Build runs-on: ubuntu-latest strategy: fail-fast: false matrix: target: - x86_64-unknown-linux-gnu - armv7-unknown-linux-gnueabihf - aarch64-linux-android - aarch64-unknown-linux-gnu # skip-pr - 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-master - x86_64-unknown-netbsd # 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 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@v2 with: # v2 defaults to a shallow checkout, but we need at least to the previous tag fetch-depth: 0 - name: Acquire tags for the repo run: | git fetch --no-tags --prune --depth=1 origin +refs/tags/*:refs/tags/* - name: Display the current git status run: | git status git describe - name: Prep cargo dirs run: | mkdir -p ~/.cargo/{registry,git} - name: Set environment variables appropriately for the build run: | echo "$HOME/.cargo/bin" >> $GITHUB_PATH echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV - name: Skip tests run: | echo "SKIP_TESTS=yes" >> $GITHUB_ENV if: matrix.run_tests == '' - name: Cache cargo registry and git trees uses: actions/cache@v2 with: path: | ~/.cargo/registry ~/.cargo/git key: ${{ runner.os }}-cargo-${{ hashFiles('**/Cargo.lock') }} - name: Get rustc commit hash id: cargo-target-cache run: | echo "::set-output name=rust_hash::$(rustc -Vv | grep commit-hash | awk '{print $2}')" shell: bash - name: Cache cargo build uses: actions/cache@v2 with: path: target key: ${{ github.base_ref }}-${{ github.head_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} restore-keys: ${{ github.base_ref }}-${{ matrix.target }}-cargo-target-dir-${{ steps.cargo-target-cache.outputs.rust_hash }}-${{ hashFiles('**/Cargo.lock') }} - name: Install Rustup run: | curl https://sh.rustup.rs -sSf | sh -s -- --default-toolchain=none --profile=minimal -y - name: Ensure Stable is up to date run: | if rustc +stable -vV >/dev/null 2>/dev/null; then rustup toolchain uninstall stable fi rustup toolchain install --profile=minimal stable - name: Ensure we have our goal target installed run: | rustup target install "$TARGET" - name: Determine which docker we need to run in run: | case "$TARGET" in *-linux-android*) DOCKER=android ;; # Android uses a local docker image *) DOCKER="$TARGET" ;; esac echo "DOCKER=$DOCKER" >> $GITHUB_ENV - name: Fetch the docker run: bash ci/fetch-rust-docker.bash "${TARGET}" - name: Maybe build a docker from there run: | if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then docker build -t "$DOCKER" -f "ci/docker/${DOCKER}/Dockerfile" . fi - name: Run the build within the docker image run: | mkdir -p "${PWD}/target" chown -R "$(id -u)":"$(id -g)" "${PWD}/target" docker run \ --entrypoint sh \ --user "$(id -u)":"$(id -g)" \ --volume "$(rustc --print sysroot)":/rustc-sysroot:ro \ --volume "${PWD}":/checkout:ro \ --volume "${PWD}"/target:/checkout/target \ --workdir /checkout \ --env TARGET="${TARGET}" \ --env SKIP_TESTS="${SKIP_TESTS}" \ --volume "${HOME}/.cargo:/cargo" \ --env CARGO_HOME=/cargo \ --env CARGO_TARGET_DIR=/checkout/target \ --env LIBZ_SYS_STATIC=1 \ --tty \ --init \ --rm \ "${DOCKER}" \ -c 'PATH="${PATH}":/rustc-sysroot/bin bash ci/run.bash' - name: Upload the built artifact if: false uses: actions/upload-artifact@v2 with: name: rustup-init-${{ matrix.target }} path: | target/${{ matrix.target }}/release/rustup-init retention-days: 7 - name: Acquire the AWS tooling run: | pip3 install -U setuptools pip3 install awscli if: false && github.event_name == 'push' && github.ref == 'refs/heads/stable' - name: Prepare the dist run: | bash ci/prepare-deploy.bash if: false && github.event_name == 'push' && github.ref == 'refs/heads/stable' - name: Deploy build to dev-static dist tree for release team run: | aws s3 cp --recursive deploy/ s3://dev-static-rust-lang-org/rustup/ env: AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} AWS_DEFAULT_REGION: us-west-1 if: false && github.event_name == 'push' && github.ref == 'refs/heads/stable' - name: Clear the cargo caches run: | cargo install cargo-cache --no-default-features --features ci-autoclean cargo-cache