From 6cfde938995b3337a40925be6407946edb6ae1e3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Thu, 18 Nov 2021 21:56:19 +0100 Subject: [PATCH 01/89] switch to GHCR and use more github actions --- .github/bors.toml | 2 +- .github/workflows/ci.yml | 39 +++++ .github/workflows/docker.yml | 289 +++++++++++++++++++++++++++++++++++ azure-pipelines.yml | 125 --------------- ci/azure-install-rust.yml | 41 ----- ci/docker_push.sh | 2 +- cross_test/Cargo.toml | 10 ++ src/docker.rs | 5 +- 8 files changed, 343 insertions(+), 170 deletions(-) create mode 100644 .github/workflows/docker.yml delete mode 100644 azure-pipelines.yml delete mode 100644 ci/azure-install-rust.yml create mode 100644 cross_test/Cargo.toml diff --git a/.github/bors.toml b/.github/bors.toml index 79d3b7f58..949d7999e 100644 --- a/.github/bors.toml +++ b/.github/bors.toml @@ -1,5 +1,5 @@ block_labels = ["needs-decision"] delete_merged_branches = true required_approvals = 1 -status = ["shellcheck"] +status = ["docker-build", "CI"] timeout_sec = 21600 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8e69329b1..4b987b17d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,9 +3,48 @@ on: [pull_request, push] name: CI jobs: + ci: + name: CI + needs: [shellcheck, test, fmt] + runs-on: ubuntu-latest + steps: + - name: I Complete + run: exit 0 shellcheck: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: ShellCheck uses: azohra/shell-linter@v0.3.0 + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: install rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + components: clippy + - name: Run unit tests + uses: actions-rs/cargo@v1 + with: + command: test + timeout-minutes: 5 + - name: Run clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + - name: install rust + uses: actions-rs/toolchain@v1 + with: + profile: minimal + components: clippy + - name: rustfmt -- --check + uses: actions-rs/cargo@v1 + with: + command: fmt + args: -- --check \ No newline at end of file diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml new file mode 100644 index 000000000..ac8c19a9c --- /dev/null +++ b/.github/workflows/docker.yml @@ -0,0 +1,289 @@ +on: + push: + branches: [master, staging, trying] + tags: + - "v*.*.*" + +name: Docker Build + +jobs: + docker-build: + needs: [docker-build] + runs-on: ${{ matrix.image }} + steps: + - name: Docker builds done + run: exit 0 + docker-builds: + name: Docker Build + runs-on: ${{ matrix.image }} + env: + CARGO_NET_RETRY: 3 + CARGO_HTTP_CHECK_REVOKE: false + strategy: + fail-fast: false + matrix: + toolchain: [1.42.0] + image: [ubuntu-latest] + include: + - target: aarch64-unknown-linux-gnu + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: arm-unknown-linux-gnueabi + cpp: 1 + dylib: 1 + std: 1 + run: 1 + - target: arm-unknown-linux-gnueabihf + cpp: 1 + dylib: 1 + std: 1 + run: 1 + - target: armv7-unknown-linux-gnueabihf + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: i586-unknown-linux-gnu + cpp: 1 + dylib: 1 + std: 1 + run: 1 + - target: i686-unknown-linux-gnu + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: native qemu-user qemu-system + - target: mips-unknown-linux-gnu + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: mipsel-unknown-linux-gnu + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: mips64-unknown-linux-gnuabi64 + cpp: 1 + dylib: 1 + std: 1 + run: 1 + - target: mips64el-unknown-linux-gnuabi64 + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: powerpc-unknown-linux-gnu + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: powerpc64-unknown-linux-gnu + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: powerpc64le-unknown-linux-gnu + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: riscv64gc-unknown-linux-gnu + cpp: 1 + std: 1 + run: 1 + - target: s390x-unknown-linux-gnu + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-system + - target: sparc64-unknown-linux-gnu + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-system + - target: x86_64-unknown-linux-gnu + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: native qemu-user qemu-system + deploy: 1 + CRATES_IO_PUBLISH: 1 + - target: aarch64-unknown-linux-musl + std: 1 + run: 1 + - target: arm-unknown-linux-musleabihf + std: 1 + run: 1 + - target: arm-unknown-linux-musleabi + std: 1 + run: 1 + - target: armv5te-unknown-linux-gnueabi + std: 1 + run: 1 + - target: armv5te-unknown-linux-musleabi + std: 1 + run: 1 + - target: armv7-unknown-linux-musleabihf + std: 1 + run: 1 + - target: i586-unknown-linux-musl + std: 1 + run: 1 + - target: i686-unknown-linux-musl + std: 1 + run: 1 + - target: mips-unknown-linux-musl + cpp: 1 + std: 1 + run: 1 + - target: mipsel-unknown-linux-musl + cpp: 1 + std: 1 + run: 1 + - target: x86_64-unknown-linux-musl + std: 1 + run: 1 + deploy: 1 + - target: aarch64-linux-android + cpp: 1 + std: 1 + run: 1 + - target: arm-linux-androideabi + cpp: 1 + std: 1 + run: 1 + - target: armv7-linux-androideabi + cpp: 1 + std: 1 + run: 1 + - target: i686-linux-android + cpp: 1 + std: 1 + run: 1 + - target: x86_64-linux-android + cpp: 1 + std: 1 + run: 1 + - target: x86_64-apple-darwin + cpp: 1 + dylib: 1 + std: 1 + run: 1 + image: macOS-latest + deploy: 1 + - target: x86_64-pc-windows-gnu + cpp: 1 + std: 1 + run: 1 + - target: i686-pc-windows-gnu + cpp: 1 + std: 1 + run: 1 + - target: x86_64-unknown-dragonfly + cpp: 1 + dylib: 1 + toolchain: nightly + - target: i686-unknown-freebsd + dylib: 1 + std: 1 + - target: x86_64-unknown-freebsd + dylib: 1 + std: 1 + - target: x86_64-unknown-netbsd + cpp: 1 + dylib: 1 + std: 1 + - target: sparcv9-sun-solaris + cpp: 1 + dylib: 1 + std: 1 + - target: x86_64-sun-solaris + cpp: 1 + dylib: 1 + std: 1 + - target: asmjs-unknown-emscripten + std: 1 + run: 1 + # `cargo run` fails with an assertion error (https://github.com/rust-lang/cargo/issues/4689) on `wasm32-unknown-emscripten`. + - target: wasm32-unknown-emscripten + std: 1 + - target: thumbv6m-none-eabi + std: 1 + - target: thumbv7em-none-eabi + std: 1 + - target: thumbv7em-none-eabihf + std: 1 + - target: thumbv7m-none-eabi + std: 1 + - target: x86_64-pc-windows-msvc + cpp: 1 + std: 1 + run: 1 + image: vs2017-win2016 + deploy: 1 + + steps: + - uses: actions/checkout@v2 + - name: install rust + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.target }} + default: true + profile: minimal + - run: echo "OS=${{ runner.os }}" >> $GITHUB_ENV + - run: echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV + if: startsWith(github.ref, 'refs/heads/') + - run: echo "TAG=${{ runner.os }}" >> $GITHUB_ENV + if: startsWith(github.ref, 'refs/tags/') + - name: Run unit tests + uses: actions-rs/cargo@v1 + with: + command: test + timeout-minutes: 5 + - name: Build Docker image + if: runner.os == 'Linux' + timeout-minutes: 360 + env: + TARGET: ${{ matrix.target }} + CPP: ${{ matrix.cpp }} + DYLIB: ${{ matrix.dylib }} + STD: ${{ matrix.std }} + RUN: ${{ matrix.run }} + RUNNERS: ${{ matrix.runners }} + run: ./build-docker-image.sh "${{ matrix.target }}" + - name: Test + run: ./ci/test.sh + - name: Publish on crates.io + if: startsWith(env.TAG, 'v') && matrix.CRATES_IO_PUBLISH == '1' + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + uses: actions-rs/cargo@v1 + with: + command: publish + args: --dry-run + - name: Create GitHub Release + if: startsWith(env.TAG, 'v') && env.DEPLOY == '1' + # TODO: Not sure what package to use for this step. + run: echo "TODO"; exit 1 + - name: Login to GHCR + if: (env.BRANCH == 'master' || startsWith(env.TAG, 'v') && runner.os == 'Linux' + run: echo "${ secrets.GITHUB_TOKEN }" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin + - name: Push image to GHCR + if: (env.BRANCH == 'master' || startsWith(env.TAG, 'v') && runner.os == 'Linux' + run: ./ci/docker_push.sh diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 6edbb7854..000000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,125 +0,0 @@ -trigger: - branches: - include: - - master - - staging - - trying - tags: - include: - - v*.*.* - -jobs: - - job: - pool: - vmImage: $(VM_IMAGE) - variables: - VM_IMAGE: ubuntu-latest - TOOLCHAIN: 1.42.0 - CARGO_NET_RETRY: 3 - CARGO_HTTP_CHECK_REVOKE: false - strategy: - matrix: - aarch64-unknown-linux-gnu: { TARGET: aarch64-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-user qemu-system } - arm-unknown-linux-gnueabi: { TARGET: arm-unknown-linux-gnueabi, CPP: 1, DYLIB: 1, STD: 1, RUN: 1 } - arm-unknown-linux-gnueabihf: { TARGET: arm-unknown-linux-gnueabihf, CPP: 1, DYLIB: 1, STD: 1, RUN: 1 } - armv7-unknown-linux-gnueabihf: { TARGET: armv7-unknown-linux-gnueabihf, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-user qemu-system } - i586-unknown-linux-gnu: { TARGET: i586-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1 } - i686-unknown-linux-gnu: { TARGET: i686-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: native qemu-user qemu-system } - mips-unknown-linux-gnu: { TARGET: mips-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-user qemu-system } - mipsel-unknown-linux-gnu: { TARGET: mipsel-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-user qemu-system } - mips64-unknown-linux-gnuabi64: { TARGET: mips64-unknown-linux-gnuabi64, CPP: 1, DYLIB: 1, STD: 1, RUN: 1 } - mips64el-unknown-linux-gnuabi64: { TARGET: mips64el-unknown-linux-gnuabi64, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-user qemu-system } - powerpc-unknown-linux-gnu: { TARGET: powerpc-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-user qemu-system } - powerpc64-unknown-linux-gnu: { TARGET: powerpc64-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-user qemu-system } - powerpc64le-unknown-linux-gnu: { TARGET: powerpc64le-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-user qemu-system } - riscv64gc-unknown-linux-gnu: { TARGET: riscv64gc-unknown-linux-gnu, CPP: 1, STD: 1, RUN: 1 } - s390x-unknown-linux-gnu: { TARGET: s390x-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-system } - sparc64-unknown-linux-gnu: { TARGET: sparc64-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: qemu-system } - x86_64-unknown-linux-gnu: { TARGET: x86_64-unknown-linux-gnu, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, RUNNERS: native qemu-user qemu-system, DEPLOY: 1, CRATES_IO_PUBLISH: 1 } - aarch64-unknown-linux-musl: { TARGET: aarch64-unknown-linux-musl, STD: 1, RUN: 1 } - arm-unknown-linux-musleabihf: { TARGET: arm-unknown-linux-musleabihf, STD: 1, RUN: 1 } - arm-unknown-linux-musleabi: { TARGET: arm-unknown-linux-musleabi, STD: 1, RUN: 1 } - armv5te-unknown-linux-gnueabi: { TARGET: armv5te-unknown-linux-gnueabi, STD: 1, RUN: 1 } - armv5te-unknown-linux-musleabi: { TARGET: armv5te-unknown-linux-musleabi, STD: 1, RUN: 1 } - armv7-unknown-linux-musleabihf: { TARGET: armv7-unknown-linux-musleabihf, STD: 1, RUN: 1 } - i586-unknown-linux-musl: { TARGET: i586-unknown-linux-musl, STD: 1, RUN: 1 } - i686-unknown-linux-musl: { TARGET: i686-unknown-linux-musl, STD: 1, RUN: 1 } - mips-unknown-linux-musl: { TARGET: mips-unknown-linux-musl, CPP: 1, STD: 1, RUN: 1 } - mipsel-unknown-linux-musl: { TARGET: mipsel-unknown-linux-musl, CPP: 1, STD: 1, RUN: 1 } - x86_64-unknown-linux-musl: { TARGET: x86_64-unknown-linux-musl, STD: 1, RUN: 1, DEPLOY: 1 } - aarch64-linux-android: { TARGET: aarch64-linux-android, CPP: 1, STD: 1, RUN: 1 } - arm-linux-androideabi: { TARGET: arm-linux-androideabi, CPP: 1, STD: 1, RUN: 1 } - armv7-linux-androideabi: { TARGET: armv7-linux-androideabi, CPP: 1, STD: 1, RUN: 1 } - i686-linux-android: { TARGET: i686-linux-android, CPP: 1, STD: 1, RUN: 1 } - x86_64-linux-android: { TARGET: x86_64-linux-android, CPP: 1, STD: 1, RUN: 1 } - x86_64-apple-darwin: { TARGET: x86_64-apple-darwin, CPP: 1, DYLIB: 1, STD: 1, RUN: 1, VM_IMAGE: macOS-latest, DEPLOY: 1 } - x86_64-pc-windows-gnu: { TARGET: x86_64-pc-windows-gnu, CPP: 1, STD: 1, RUN: 1 } - i686-pc-windows-gnu: { TARGET: i686-pc-windows-gnu, CPP: 1, STD: 1, RUN: 1 } - # x86_64-unknown-dragonfly: { TARGET: x86_64-unknown-dragonfly, CPP: 1, DYLIB: 1, TOOLCHAIN: nightly } - i686-unknown-freebsd: { TARGET: i686-unknown-freebsd, DYLIB: 1, STD: 1 } - x86_64-unknown-freebsd: { TARGET: x86_64-unknown-freebsd, DYLIB: 1, STD: 1 } - x86_64-unknown-netbsd: { TARGET: x86_64-unknown-netbsd, CPP: 1, DYLIB: 1, STD: 1 } - # sparcv9-sun-solaris: { TARGET: sparcv9-sun-solaris, CPP: 1, DYLIB: 1, STD: 1 } - # x86_64-sun-solaris: { TARGET: x86_64-sun-solaris, CPP: 1, DYLIB: 1, STD: 1 } - asmjs-unknown-emscripten: { TARGET: asmjs-unknown-emscripten, STD: 1, RUN: 1 } - # `cargo run` fails with an assertion error (https://github.com/rust-lang/cargo/issues/4689) on `wasm32-unknown-emscripten`. - wasm32-unknown-emscripten: { TARGET: wasm32-unknown-emscripten, STD: 1 } - thumbv6m-none-eabi: { TARGET: thumbv6m-none-eabi, STD: 1 } - thumbv7em-none-eabi: { TARGET: thumbv7em-none-eabi, STD: 1 } - thumbv7em-none-eabihf: { TARGET: thumbv7em-none-eabihf, STD: 1 } - thumbv7m-none-eabi: { TARGET: thumbv7m-none-eabi, STD: 1 } - x86_64-pc-windows-msvc: { TARGET: x86_64-pc-windows-msvc, CPP: 1, STD: 1, RUN: 1, VM_IMAGE: vs2017-win2016, DEPLOY: 1 } - timeoutInMinutes: 360 - steps: - - template: ci/azure-install-rust.yml - - bash: echo "##vso[task.setvariable variable=OS]$(echo "${AGENT_OS}" | tr '[:upper:]' '[:lower:]')" - displayName: Set OS Variable - - bash: echo "##vso[task.setvariable variable=BRANCH]${BUILD_SOURCEBRANCH##refs/heads/}" - displayName: Set BRANCH Variable - condition: startsWith(variables['Build.SourceBranch'], 'refs/heads/') - - bash: echo "##vso[task.setvariable variable=TAG]${BUILD_SOURCEBRANCH##refs/tags/}" - displayName: Set TAG Variable - condition: startsWith(variables['Build.SourceBranch'], 'refs/tags/') - - bash: cargo test - displayName: Run unit tests - timeoutInMinutes: 5 - - bash: ./build-docker-image.sh "${TARGET}" - displayName: Build Docker Image - timeoutInMinutes: 360 - condition: eq(variables['OS'], 'linux') - - bash: ci/test.sh - displayName: Test - - bash: cargo publish - displayName: Publish on crates.io - env: - CARGO_REGISTRY_TOKEN: $(CARGO_REGISTRY_TOKEN) - condition: and(startsWith(variables['TAG'], 'v'), eq(variables['CRATES_IO_PUBLISH'], '1')) - - bash: ci/build_release.sh - displayName: Build Release - condition: eq(variables['DEPLOY'], '1') - - task: ArchiveFiles@2 - inputs: - includeRootFolder: false - archiveType: tar - tarCompression: gz - archiveFile: $(Build.ArtifactStagingDirectory)/cross-$(TAG)-$(TARGET).tar.gz - verbose: true - condition: eq(variables['DEPLOY'], '1') - - task: GithubRelease@0 - displayName: Create GitHub Release - inputs: - githubConnection: github - assets: $(Build.ArtifactStagingDirectory)/cross-$(TAG)-$(TARGET).tar.gz - assetUploadMode: replace - action: edit - tag: $(TAG) - condition: and(startsWith(variables['TAG'], 'v'), eq(variables['DEPLOY'], '1')) - - task: Docker@2 - displayName: Log into Docker Hub - inputs: - containerRegistry: docker - command: login - condition: and(or(eq(variables['BRANCH'], 'master'), startsWith(variables['TAG'], 'v')), eq(variables['OS'], 'linux')) - - bash: ci/docker_push.sh - displayName: Push Image to Docker Hub - condition: and(or(eq(variables['BRANCH'], 'master'), startsWith(variables['TAG'], 'v')), eq(variables['OS'], 'linux')) diff --git a/ci/azure-install-rust.yml b/ci/azure-install-rust.yml deleted file mode 100644 index ad9dbc6e8..000000000 --- a/ci/azure-install-rust.yml +++ /dev/null @@ -1,41 +0,0 @@ -# source: https://github.com/rust-lang/cargo/blob/master/ci/azure-install-rust.yml - -steps: - - bash: | - set -euo pipefail - - if command -v rustup; then - echo `command -v rustup` `rustup -V` already installed - - if brew ls rustup &>/dev/null; then - brew upgrade rustup - else - rustup self update - fi - else - curl --retry 3 -sSfL https://sh.rustup.rs -o rustup-init.sh - sh rustup-init.sh -y --default-toolchain="$TOOLCHAIN" --profile=minimal - rm rustup-init.sh - echo "##vso[task.prependpath]$HOME/.cargo/bin" - fi - displayName: Install rustup - - - bash: | - set -euo pipefail - rustup set profile minimal - rustup component remove --toolchain=$TOOLCHAIN rust-docs || echo "already removed" - rustup update --no-self-update $TOOLCHAIN - if [ "$TOOLCHAIN" = "nightly" ]; then - rustup component add --toolchain=$TOOLCHAIN rustc-dev - fi - rustup default $TOOLCHAIN - displayName: Install rust - - - bash: | - set -x - set -euo pipefail - - rustup -V - rustc -Vv - cargo -V - displayName: Query rust and cargo versions diff --git a/ci/docker_push.sh b/ci/docker_push.sh index 4b47a5cf2..846684eca 100755 --- a/ci/docker_push.sh +++ b/ci/docker_push.sh @@ -2,7 +2,7 @@ set -eux -image_name="rustembedded/cross:${TARGET}" +image_name="ghcr.io/rustembedded/cross:${TARGET}" if [[ "${TAG-}" =~ ^v.* ]] && ! [[ "${TAG}" =~ alpha ]] && ! [[ "${TAG}" =~ dev ]]; then version="${TAG##v}" diff --git a/cross_test/Cargo.toml b/cross_test/Cargo.toml new file mode 100644 index 000000000..5b0f962e6 --- /dev/null +++ b/cross_test/Cargo.toml @@ -0,0 +1,10 @@ +[package] +build = "build.rs" +description = "Zero setup cross compilation and cross testing" +documentation = "https://github.com/rust-embedded/cross" +keywords = ["cross", "compilation", "testing", "tool"] +license = "MIT OR Apache-2.0" +name = "cross" +repository = "https://github.com/rust-embedded/cross" +version = "0.2.1" +edition = "2018" diff --git a/src/docker.rs b/src/docker.rs index 7022ab530..a93d65183 100644 --- a/src/docker.rs +++ b/src/docker.rs @@ -13,6 +13,7 @@ use crate::id; use crate::{Config, Target}; const DOCKER_IMAGES: &[&str] = &include!(concat!(env!("OUT_DIR"), "/docker-images.rs")); +const CROSS_IMAGE: &str = "ghcr.io/rustembedded/cross"; const DOCKER: &str = "docker"; const PODMAN: &str = "podman"; @@ -230,9 +231,9 @@ pub fn image(config: &Config, target: &Target) -> Result { let version = env!("CARGO_PKG_VERSION"); let image = if version.contains("alpha") || version.contains("dev") { - format!("rustembedded/cross:{}", triple) + format!("{image}:{}", image = CROSS_IMAGE, triple) } else { - format!("rustembedded/cross:{}-{}", triple, version) + format!("{image}:{}-{}", image = CROSS_IMAGE, triple, version) }; Ok(image) From cf0d6726e4a30534ff750bbcf4c855d67168bf85 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Thu, 18 Nov 2021 22:03:34 +0100 Subject: [PATCH 02/89] fix errors --- .github/workflows/ci.yml | 6 +++++- .github/workflows/docker.yml | 1 + 2 files changed, 6 insertions(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 4b987b17d..e194e82c5 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,17 +23,20 @@ jobs: - name: install rust uses: actions-rs/toolchain@v1 with: + toolchain: 1.42.0 profile: minimal components: clippy - name: Run unit tests uses: actions-rs/cargo@v1 with: command: test + args: --locked timeout-minutes: 5 - name: Run clippy uses: actions-rs/cargo@v1 with: command: clippy + args: --locked fmt: runs-on: ubuntu-latest steps: @@ -41,8 +44,9 @@ jobs: - name: install rust uses: actions-rs/toolchain@v1 with: + toolchain: 1.42.0 profile: minimal - components: clippy + components: rustfmt - name: rustfmt -- --check uses: actions-rs/cargo@v1 with: diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index ac8c19a9c..d81729382 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -255,6 +255,7 @@ jobs: uses: actions-rs/cargo@v1 with: command: test + args: --locked timeout-minutes: 5 - name: Build Docker image if: runner.os == 'Linux' From aa607bd2762b22acf9c99082df753e2c9d2299d4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Thu, 18 Nov 2021 22:07:20 +0100 Subject: [PATCH 03/89] apply rustfmt --- build.rs | 6 ++-- rustfmt.yml | 9 +++++ src/cargo.rs | 4 ++- src/config.rs | 6 ++-- src/extensions.rs | 15 ++++---- src/file.rs | 6 ++-- src/id.rs | 18 ++++++---- src/interpreter.rs | 7 ++-- src/main.rs | 87 ++++++++++++++++++++++++++++------------------ src/rustc.rs | 23 ++++++------ src/rustup.rs | 18 ++++++++-- 11 files changed, 126 insertions(+), 73 deletions(-) create mode 100644 rustfmt.yml diff --git a/build.rs b/build.rs index 52d5e7c87..f020eea8f 100644 --- a/build.rs +++ b/build.rs @@ -8,7 +8,8 @@ use std::process::Command; struct Some {} impl From for Some - where E: Error +where + E: Error, { fn from(_: E) -> Some { Some {} @@ -37,7 +38,8 @@ fn commit_info() -> String { } fn commit_hash() -> Result { - let output = Command::new("git").args(&["rev-parse", "--short", "HEAD"]) + let output = Command::new("git") + .args(&["rev-parse", "--short", "HEAD"]) .output()?; if output.status.success() { diff --git a/rustfmt.yml b/rustfmt.yml new file mode 100644 index 000000000..c1224bbf6 --- /dev/null +++ b/rustfmt.yml @@ -0,0 +1,9 @@ +condense_wildcard_suffixes = true +brace_style = "PreferSameLine" +fn_single_line = true +where_single_line = true +use_field_init_shorthand = true +reorder_impl_items = true +edition = "2018" +newline_style = "Unix" +format_code_in_doc_comments = true \ No newline at end of file diff --git a/src/cargo.rs b/src/cargo.rs index 28e2a7534..22ca648d5 100644 --- a/src/cargo.rs +++ b/src/cargo.rs @@ -81,7 +81,9 @@ pub fn root() -> Result> { let toml = dir.join("Cargo.toml"); if fs::metadata(&toml).is_ok() { - return Ok(Some(Root { path: dir.to_owned() })); + return Ok(Some(Root { + path: dir.to_owned(), + })); } match dir.parent() { diff --git a/src/config.rs b/src/config.rs index 62b3d9079..1601d9d1d 100644 --- a/src/config.rs +++ b/src/config.rs @@ -351,7 +351,7 @@ mod tests { let env = Environment::new(Some(map)); let config = Config::new_with(Some(toml(TOML_BUILD_VOLUMES)?), env); let expected = vec!["VOLUME3".to_string(), "VOLUME4".into()]; - + let result = config.env_volumes(&target()).unwrap(); assert!(result.len() == 2); assert!(result.contains(&expected[0])); @@ -369,8 +369,8 @@ mod tests { [target.aarch64-unknown-linux-gnu] xargo = false "#; - - static TOML_BUILD_VOLUMES: &str = r#" + + static TOML_BUILD_VOLUMES: &str = r#" [build.env] volumes = ["VOLUME3", "VOLUME4"] [target.aarch64-unknown-linux-gnu] diff --git a/src/extensions.rs b/src/extensions.rs index 81540a6f8..422a4b3ed 100644 --- a/src/extensions.rs +++ b/src/extensions.rs @@ -1,6 +1,6 @@ use std::borrow::Cow; -use std::process::{Command, ExitStatus}; use std::fmt; +use std::process::{Command, ExitStatus}; use crate::errors::*; @@ -43,7 +43,8 @@ impl CommandExt for Command { /// Runs the command to completion and returns its stdout fn run_and_get_stdout(&mut self, verbose: bool) -> Result { self.print_verbose(verbose); - let out = self.output() + let out = self + .output() .chain_err(|| format!("couldn't execute `{:?}`", self))?; self.status_result(out.status)?; @@ -68,17 +69,17 @@ impl SafeCommand { } pub fn arg<'b, S>(&mut self, arg: &S) -> &mut Self - where - S: ToString, + where + S: ToString, { self.args.push(arg.to_string()); self } pub fn args(&mut self, args: I) -> &mut Self - where - I: IntoIterator, - S: ToString, + where + I: IntoIterator, + S: ToString, { for arg in args { self.arg(&arg); diff --git a/src/file.rs b/src/file.rs index 636ceed3e..b1843478d 100644 --- a/src/file.rs +++ b/src/file.rs @@ -5,14 +5,16 @@ use std::path::Path; use crate::errors::*; pub fn read

(path: P) -> Result - where P: AsRef +where + P: AsRef, { read_(path.as_ref()) } fn read_(path: &Path) -> Result { let mut s = String::new(); - File::open(path).chain_err(|| format!("couldn't open {}", path.display()))? + File::open(path) + .chain_err(|| format!("couldn't open {}", path.display()))? .read_to_string(&mut s) .chain_err(|| format!("couldn't read {}", path.display()))?; Ok(s) diff --git a/src/id.rs b/src/id.rs index b2b462fa4..f91826f13 100644 --- a/src/id.rs +++ b/src/id.rs @@ -1,9 +1,13 @@ #[cfg(not(target_os = "windows"))] use libc; #[cfg(not(target_os = "windows"))] -use std::ffi::CStr; +use nix::{ + errno::{errno, Errno}, + unistd::{Gid, Uid}, + Error, +}; #[cfg(not(target_os = "windows"))] -use nix::{errno::{errno, Errno}, unistd::{Gid, Uid}, Error}; +use std::ffi::CStr; #[cfg(target_os = "windows")] pub fn group() -> u32 { @@ -36,7 +40,7 @@ pub fn username() -> Result, String> { GetUserNameW(ptr::null_mut(), &mut size); if size == 0 { - return Ok(None) + return Ok(None); } let mut username = Vec::with_capacity(size as usize); @@ -53,7 +57,7 @@ pub fn username() -> Result, String> { } #[cfg(not(target_os = "windows"))] -pub fn username() -> Result, Error> { +pub fn username() -> Result, Error> { let name = unsafe { Errno::clear(); @@ -62,9 +66,11 @@ pub fn username() -> Result, Error> { if passwd.is_null() { let errno = errno(); - if errno == 0 { return Ok(None) } + if errno == 0 { + return Ok(None); + } - return Err(Errno::from_i32(errno)) + return Err(Errno::from_i32(errno)); } CStr::from_ptr((*passwd).pw_name) diff --git a/src/interpreter.rs b/src/interpreter.rs index 6cd90729f..ed0daade7 100644 --- a/src/interpreter.rs +++ b/src/interpreter.rs @@ -12,11 +12,10 @@ pub fn is_registered(target: &Target) -> Result { let ok = if target.is_windows() { let wine = Path::new("/proc/sys/fs/binfmt_misc/wine"); - wine.exists() && - { + wine.exists() && { let f = file::read(wine)?; - f.contains("/usr/bin/run-detectors") || - f.contains("/usr/lib/binfmt-support/run-detectors") + f.contains("/usr/bin/run-detectors") + || f.contains("/usr/lib/binfmt-support/run-detectors") } } else { // NOTE checking any architecture will do, here we pick arm diff --git a/src/main.rs b/src/main.rs index cab83c8f9..f8d06360f 100644 --- a/src/main.rs +++ b/src/main.rs @@ -55,22 +55,24 @@ impl Host { /// /// `target == None` means `target == host` fn is_supported(&self, target: Option<&Target>) -> bool { - match std::env::var("CROSS_COMPATIBILITY_VERSION").as_ref().map(|v| v.as_str()) { + match std::env::var("CROSS_COMPATIBILITY_VERSION") + .as_ref() + .map(|v| v.as_str()) + { // Old behavior (up to cross version 0.2.1) can be activated on demand using environment // variable `CROSS_COMPATIBILITY_VERSION`. - Ok("0.2.1") => { - match self { - Host::X86_64AppleDarwin | Host::Aarch64AppleDarwin => { - target.map(|t| t.needs_docker()).unwrap_or(false) - } - Host::X86_64UnknownLinuxGnu | Host::Aarch64UnknownLinuxGnu | Host::X86_64UnknownLinuxMusl | Host::Aarch64UnknownLinuxMusl => { - target.map(|t| t.needs_docker()).unwrap_or(true) - } - Host::X86_64PcWindowsMsvc => { - target.map(|t| t.triple() != Host::X86_64PcWindowsMsvc.triple() && t.needs_docker()).unwrap_or(false) - } - Host::Other(_) => false, + Ok("0.2.1") => match self { + Host::X86_64AppleDarwin | Host::Aarch64AppleDarwin => { + target.map(|t| t.needs_docker()).unwrap_or(false) } + Host::X86_64UnknownLinuxGnu + | Host::Aarch64UnknownLinuxGnu + | Host::X86_64UnknownLinuxMusl + | Host::Aarch64UnknownLinuxMusl => target.map(|t| t.needs_docker()).unwrap_or(true), + Host::X86_64PcWindowsMsvc => target + .map(|t| t.triple() != Host::X86_64PcWindowsMsvc.triple() && t.needs_docker()) + .unwrap_or(false), + Host::Other(_) => false, }, // New behaviour, if a target is provided (--target ...) then always run with docker // image unless the target explicitly opts-out (i.e. unless needs_docker() returns false). @@ -82,7 +84,7 @@ impl Host { // example to test custom docker images. Cross should not try to recognize if host and // target are equal, it's a user decision and if user want's to bypass cross he can call // cargo directly or omit the `--target` option. - _ => target.map(|t| t.needs_docker()).unwrap_or(false) + _ => target.map(|t| t.needs_docker()).unwrap_or(false), } } @@ -181,9 +183,15 @@ impl Target { } fn needs_docker(&self) -> bool { - self.is_linux() || self.is_android() || self.is_bare_metal() || self.is_bsd() || - self.is_solaris() || !self.is_builtin() || self.is_windows() || self.is_emscripten() || - self.is_apple() + self.is_linux() + || self.is_android() + || self.is_bare_metal() + || self.is_bsd() + || self.is_solaris() + || !self.is_builtin() + || self.is_windows() + || self.is_emscripten() + || self.is_apple() } fn needs_interpreter(&self) -> bool { @@ -306,8 +314,9 @@ fn run() -> Result { } let available_targets = rustup::available_targets(&toolchain, verbose)?; - let uses_xargo = config.xargo(&target)? - .unwrap_or_else(|| !target.is_builtin() || !available_targets.contains(&target)); + let uses_xargo = config + .xargo(&target)? + .unwrap_or_else(|| !target.is_builtin() || !available_targets.contains(&target)); if !uses_xargo && !available_targets.is_installed(&target) @@ -337,7 +346,7 @@ fn run() -> Result { Err(err) => { eprintln!("Warning: {} Falling back to `cargo` on the host.", err); false - }, + } }; let filtered_args = if args @@ -407,9 +416,12 @@ impl Toml { .and_then(|t| t.get(triple)) .and_then(|t| t.get("image")) { - Ok(Some(value.as_str().ok_or_else(|| { - format!("target.{}.image must be a string", triple) - })?.to_string())) + Ok(Some( + value + .as_str() + .ok_or_else(|| format!("target.{}.image must be a string", triple))? + .to_string(), + )) } else { Ok(None) } @@ -427,7 +439,8 @@ impl Toml { { let value = value .as_str() - .ok_or_else(|| format!("target.{}.runner must be a string", triple))?.to_string(); + .ok_or_else(|| format!("target.{}.runner must be a string", triple))? + .to_string(); Ok(Some(value)) } else { Ok(None) @@ -439,11 +452,14 @@ impl Toml { let triple = target.triple(); if let Some(value) = self.table.get("build").and_then(|b| b.get("xargo")) { - return Ok((Some( - value - .as_bool() - .ok_or_else(|| "build.xargo must be a boolean")?, - ), None)); + return Ok(( + Some( + value + .as_bool() + .ok_or_else(|| "build.xargo must be a boolean")?, + ), + None, + )); } if let Some(value) = self @@ -452,9 +468,14 @@ impl Toml { .and_then(|b| b.get(triple)) .and_then(|t| t.get("xargo")) { - Ok((None, Some(value.as_bool().ok_or_else(|| { - format!("target.{}.xargo must be a boolean", triple) - })?))) + Ok(( + None, + Some( + value + .as_bool() + .ok_or_else(|| format!("target.{}.xargo must be a boolean", triple))?, + ), + )) } else { Ok((None, None)) } @@ -469,7 +490,7 @@ impl Toml { pub fn env_passthrough_target(&self, target: &Target) -> Result> { self.target_env(target, "passthrough") } - + /// Returns the list of environment variables to pass through for `build`, pub fn env_volumes_build(&self) -> Result> { self.build_env("volumes") diff --git a/src/rustc.rs b/src/rustc.rs index 02db833f4..69501202f 100644 --- a/src/rustc.rs +++ b/src/rustc.rs @@ -3,9 +3,9 @@ use std::process::Command; use rustc_version::{Version, VersionMeta}; -use crate::{Host, Target}; use crate::errors::*; use crate::extensions::CommandExt; +use crate::{Host, Target}; pub struct TargetList { pub triples: Vec, @@ -28,13 +28,14 @@ impl VersionMetaExt for VersionMeta { } fn needs_interpreter(&self) -> bool { - self.semver < Version { - major: 1, - minor: 19, - patch: 0, - pre: vec![], - build: vec![], - } + self.semver + < Version { + major: 1, + minor: 19, + patch: 0, + pre: vec![], + build: vec![], + } } } @@ -42,10 +43,8 @@ pub fn target_list(verbose: bool) -> Result { Command::new("rustc") .args(&["--print", "target-list"]) .run_and_get_stdout(verbose) - .map(|s| { - TargetList { - triples: s.lines().map(|l| l.to_owned()).collect(), - } + .map(|s| TargetList { + triples: s.lines().map(|l| l.to_owned()).collect(), }) } diff --git a/src/rustup.rs b/src/rustup.rs index 2b6bb74d9..07c37f11f 100644 --- a/src/rustup.rs +++ b/src/rustup.rs @@ -1,8 +1,8 @@ use std::process::Command; -use crate::Target; use crate::errors::*; use crate::extensions::CommandExt; +use crate::Target; #[derive(Debug)] pub struct AvailableTargets { @@ -28,7 +28,15 @@ pub fn installed_toolchains(verbose: bool) -> Result> { .args(&["toolchain", "list"]) .run_and_get_stdout(verbose)?; - Ok(out.lines().map(|l| l.replace(" (default)", "").replace(" (override)", "").trim().to_owned()).collect()) + Ok(out + .lines() + .map(|l| { + l.replace(" (default)", "") + .replace(" (override)", "") + .trim() + .to_owned() + }) + .collect()) } pub fn available_targets(toolchain: &str, verbose: bool) -> Result { @@ -52,7 +60,11 @@ pub fn available_targets(toolchain: &str, verbose: bool) -> Result Result<()> { From 0d876be4cd64c7169f86ec355c0ab5114b27eb23 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Thu, 18 Nov 2021 22:08:04 +0100 Subject: [PATCH 04/89] fix error --- src/docker.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/docker.rs b/src/docker.rs index a93d65183..5a05c89ab 100644 --- a/src/docker.rs +++ b/src/docker.rs @@ -231,9 +231,9 @@ pub fn image(config: &Config, target: &Target) -> Result { let version = env!("CARGO_PKG_VERSION"); let image = if version.contains("alpha") || version.contains("dev") { - format!("{image}:{}", image = CROSS_IMAGE, triple) + format!("{}:{}", CROSS_IMAGE, triple) } else { - format!("{image}:{}-{}", image = CROSS_IMAGE, triple, version) + format!("{}:{}-{}", CROSS_IMAGE, triple, version) }; Ok(image) From 591081c72dcade6ee7078bd257e1b7a6ed5978b8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Thu, 18 Nov 2021 22:09:22 +0100 Subject: [PATCH 05/89] fix wrong needs req --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d81729382..69618c4e4 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -8,7 +8,7 @@ name: Docker Build jobs: docker-build: - needs: [docker-build] + needs: [docker-builds] runs-on: ${{ matrix.image }} steps: - name: Docker builds done From fbfa339b3f961e28f9118fafb68dcbbee21da612 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Thu, 18 Nov 2021 22:14:43 +0100 Subject: [PATCH 06/89] fix syntax and wrong reference --- .github/bors.toml | 2 +- .github/workflows/docker.yml | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/bors.toml b/.github/bors.toml index 949d7999e..14d6378f7 100644 --- a/.github/bors.toml +++ b/.github/bors.toml @@ -1,5 +1,5 @@ block_labels = ["needs-decision"] delete_merged_branches = true required_approvals = 1 -status = ["docker-build", "CI"] +status = ["Docker Build", "CI"] timeout_sec = 21600 diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 69618c4e4..23fcea61f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -283,8 +283,8 @@ jobs: # TODO: Not sure what package to use for this step. run: echo "TODO"; exit 1 - name: Login to GHCR - if: (env.BRANCH == 'master' || startsWith(env.TAG, 'v') && runner.os == 'Linux' + if: (env.BRANCH == 'master' || startsWith(env.TAG, 'v')) && runner.os == 'Linux' run: echo "${ secrets.GITHUB_TOKEN }" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin - name: Push image to GHCR - if: (env.BRANCH == 'master' || startsWith(env.TAG, 'v') && runner.os == 'Linux' + if: (env.BRANCH == 'master' || startsWith(env.TAG, 'v')) && runner.os == 'Linux' run: ./ci/docker_push.sh From 59ce23382ae4358103d06136f5b90a24bf24df56 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Thu, 18 Nov 2021 22:21:46 +0100 Subject: [PATCH 07/89] fix --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 23fcea61f..b2badfb38 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -9,7 +9,7 @@ name: Docker Build jobs: docker-build: needs: [docker-builds] - runs-on: ${{ matrix.image }} + runs-on: ubuntu-latest steps: - name: Docker builds done run: exit 0 From 21eacb5589e97b9ddc48be90f50df87ae4e9a1c6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Thu, 18 Nov 2021 22:38:20 +0100 Subject: [PATCH 08/89] fix image for windows and uncapitalize macos --- .github/workflows/docker.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index b2badfb38..2b13aca74 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -184,7 +184,7 @@ jobs: dylib: 1 std: 1 run: 1 - image: macOS-latest + image: macos-latest deploy: 1 - target: x86_64-pc-windows-gnu cpp: 1 @@ -234,7 +234,7 @@ jobs: cpp: 1 std: 1 run: 1 - image: vs2017-win2016 + image: windows-latest deploy: 1 steps: From 743204f67178b4319e67059d352dfde4de7c9f2d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Thu, 18 Nov 2021 23:05:00 +0100 Subject: [PATCH 09/89] fix issues with matrix --- .github/workflows/docker.yml | 107 ++++++++++++++++++++++++++++++++--- 1 file changed, 100 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 2b13aca74..d4239710b 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -14,108 +14,140 @@ jobs: - name: Docker builds done run: exit 0 docker-builds: - name: Docker Build - runs-on: ${{ matrix.image }} + name: Docker Build ${{matrix.toolchain}} ${{matrix.os}} ${{ matrix.target }} + runs-on: ${{ matrix.os }} env: CARGO_NET_RETRY: 3 CARGO_HTTP_CHECK_REVOKE: false strategy: fail-fast: false matrix: - toolchain: [1.42.0] - image: [ubuntu-latest] include: - target: aarch64-unknown-linux-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 runners: qemu-user qemu-system - target: arm-unknown-linux-gnueabi + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 - target: arm-unknown-linux-gnueabihf + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 - target: armv7-unknown-linux-gnueabihf + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 runners: qemu-user qemu-system - target: i586-unknown-linux-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 - target: i686-unknown-linux-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 runners: native qemu-user qemu-system - target: mips-unknown-linux-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 runners: qemu-user qemu-system - target: mipsel-unknown-linux-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 runners: qemu-user qemu-system - target: mips64-unknown-linux-gnuabi64 + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 - target: mips64el-unknown-linux-gnuabi64 + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 runners: qemu-user qemu-system - target: powerpc-unknown-linux-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 runners: qemu-user qemu-system - target: powerpc64-unknown-linux-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 runners: qemu-user qemu-system - target: powerpc64le-unknown-linux-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 runners: qemu-user qemu-system - target: riscv64gc-unknown-linux-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: s390x-unknown-linux-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 runners: qemu-system - target: sparc64-unknown-linux-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 runners: qemu-system - target: x86_64-unknown-linux-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 @@ -124,117 +156,178 @@ jobs: deploy: 1 CRATES_IO_PUBLISH: 1 - target: aarch64-unknown-linux-musl + toolchain: 1.42.0 + os: ubuntu-latest std: 1 run: 1 - target: arm-unknown-linux-musleabihf + toolchain: 1.42.0 + os: ubuntu-latest std: 1 run: 1 - target: arm-unknown-linux-musleabi + toolchain: 1.42.0 + os: ubuntu-latest std: 1 run: 1 - target: armv5te-unknown-linux-gnueabi + toolchain: 1.42.0 + os: ubuntu-latest std: 1 run: 1 - target: armv5te-unknown-linux-musleabi + toolchain: 1.42.0 + os: ubuntu-latest std: 1 run: 1 - target: armv7-unknown-linux-musleabihf + toolchain: 1.42.0 + os: ubuntu-latest std: 1 run: 1 - target: i586-unknown-linux-musl + toolchain: 1.42.0 + os: ubuntu-latest std: 1 run: 1 - target: i686-unknown-linux-musl + toolchain: 1.42.0 + os: ubuntu-latest std: 1 run: 1 - target: mips-unknown-linux-musl + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: mipsel-unknown-linux-musl + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: x86_64-unknown-linux-musl + toolchain: 1.42.0 + os: ubuntu-latest std: 1 run: 1 deploy: 1 - target: aarch64-linux-android + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: arm-linux-androideabi + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: armv7-linux-androideabi + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: i686-linux-android + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: x86_64-linux-android + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: x86_64-apple-darwin + toolchain: 1.42.0 + os: macos-latest cpp: 1 dylib: 1 std: 1 run: 1 - image: macos-latest deploy: 1 - target: x86_64-pc-windows-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: i686-pc-windows-gnu + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: x86_64-unknown-dragonfly + toolchain: nightly + os: ubuntu-latest cpp: 1 dylib: 1 - toolchain: nightly - target: i686-unknown-freebsd + toolchain: 1.42.0 + os: ubuntu-latest dylib: 1 std: 1 - target: x86_64-unknown-freebsd + toolchain: 1.42.0 + os: ubuntu-latest dylib: 1 std: 1 - target: x86_64-unknown-netbsd + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 - target: sparcv9-sun-solaris + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 - target: x86_64-sun-solaris + toolchain: 1.42.0 + os: ubuntu-latest cpp: 1 dylib: 1 std: 1 - target: asmjs-unknown-emscripten + toolchain: 1.42.0 + os: ubuntu-latest std: 1 run: 1 # `cargo run` fails with an assertion error (https://github.com/rust-lang/cargo/issues/4689) on `wasm32-unknown-emscripten`. - target: wasm32-unknown-emscripten + toolchain: 1.42.0 + os: ubuntu-latest std: 1 - target: thumbv6m-none-eabi + toolchain: 1.42.0 + os: ubuntu-latest std: 1 - target: thumbv7em-none-eabi + toolchain: 1.42.0 + os: ubuntu-latest std: 1 - target: thumbv7em-none-eabihf + toolchain: 1.42.0 + os: ubuntu-latest std: 1 - target: thumbv7m-none-eabi + toolchain: 1.42.0 + os: ubuntu-latest std: 1 - target: x86_64-pc-windows-msvc + toolchain: 1.42.0 + os: windows-latest cpp: 1 std: 1 run: 1 - image: windows-latest deploy: 1 steps: From d78f3889dd700cf9141e3e394e6b1dbb34036622 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Thu, 18 Nov 2021 23:07:44 +0100 Subject: [PATCH 10/89] change order of name --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d4239710b..df64bfb3d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -14,7 +14,7 @@ jobs: - name: Docker builds done run: exit 0 docker-builds: - name: Docker Build ${{matrix.toolchain}} ${{matrix.os}} ${{ matrix.target }} + name: Docker Build ${{ matrix.target }} ${{matrix.os}} ${{matrix.toolchain}} runs-on: ${{ matrix.os }} env: CARGO_NET_RETRY: 3 From 1395aa4c2f07b1999694da9a17bd09780292411f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Thu, 18 Nov 2021 23:12:05 +0100 Subject: [PATCH 11/89] fix envs --- .github/workflows/docker.yml | 13 ++++++------- 1 file changed, 6 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index df64bfb3d..a806458f3 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -344,6 +344,12 @@ jobs: if: startsWith(github.ref, 'refs/heads/') - run: echo "TAG=${{ runner.os }}" >> $GITHUB_ENV if: startsWith(github.ref, 'refs/tags/') + - run: echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV + - run: echo "CPP=${{ matrix.cpp }}" >> $GITHUB_ENV + - run: echo "DYLIB=${{ matrix.dylib }}" >> $GITHUB_ENV + - run: echo "STD=${{ matrix.std }}" >> $GITHUB_ENV + - run: echo "RUN=${{ matrix.run }}" >> $GITHUB_ENV + - run: echo "RUNNERS=${{ matrix.runners }}" >> $GITHUB_ENV - name: Run unit tests uses: actions-rs/cargo@v1 with: @@ -353,13 +359,6 @@ jobs: - name: Build Docker image if: runner.os == 'Linux' timeout-minutes: 360 - env: - TARGET: ${{ matrix.target }} - CPP: ${{ matrix.cpp }} - DYLIB: ${{ matrix.dylib }} - STD: ${{ matrix.std }} - RUN: ${{ matrix.run }} - RUNNERS: ${{ matrix.runners }} run: ./build-docker-image.sh "${{ matrix.target }}" - name: Test run: ./ci/test.sh From e40c0603d48b32213a34c8108b6278787ae6b594 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Fri, 19 Nov 2021 00:12:40 +0100 Subject: [PATCH 12/89] fix? --- .github/bors.toml | 2 +- build-docker-image.sh | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/bors.toml b/.github/bors.toml index 14d6378f7..949d7999e 100644 --- a/.github/bors.toml +++ b/.github/bors.toml @@ -1,5 +1,5 @@ block_labels = ["needs-decision"] delete_merged_branches = true required_approvals = 1 -status = ["Docker Build", "CI"] +status = ["docker-build", "CI"] timeout_sec = 21600 diff --git a/build-docker-image.sh b/build-docker-image.sh index eb0188457..438107d67 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -9,7 +9,7 @@ cd docker run() { local dockerfile="Dockerfile.${1}" - local image_name="rustembedded/cross:${1}" + local image_name="ghcr.io/rustembedded/cross:${1}" local cache_from_args=() if ! docker image inspect "${image_name}" &>/dev/null; then From 1c431a92df72568570ff46d2e497ae82dbc7369f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Fri, 19 Nov 2021 19:39:17 +0100 Subject: [PATCH 13/89] don't run solaris images --- .github/workflows/docker.yml | 25 +++++++++++++------------ 1 file changed, 13 insertions(+), 12 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a806458f3..c09a63511 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -284,18 +284,19 @@ jobs: cpp: 1 dylib: 1 std: 1 - - target: sparcv9-sun-solaris - toolchain: 1.42.0 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - - target: x86_64-sun-solaris - toolchain: 1.42.0 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 + # Disabled, see #534 + # - target: sparcv9-sun-solaris + # toolchain: 1.42.0 + # os: ubuntu-latest + # cpp: 1 + # dylib: 1 + # std: 1 + # - target: x86_64-sun-solaris + # toolchain: 1.42.0 + # os: ubuntu-latest + # cpp: 1 + # dylib: 1 + # std: 1 - target: asmjs-unknown-emscripten toolchain: 1.42.0 os: ubuntu-latest From 9a821ea9a48ea0c7d9afd0c2df2828eebbc261ae Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Fri, 19 Nov 2021 19:40:11 +0100 Subject: [PATCH 14/89] print seconds run when trying to boot qemu --- docker/linux-runner | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/linux-runner b/docker/linux-runner index f72fcf3b7..4274f0090 100755 --- a/docker/linux-runner +++ b/docker/linux-runner @@ -154,7 +154,7 @@ esac if [ -n "${CROSS_DEBUG}" ]; then echo "Not ready but continuing because CROSS_DEBUG is set" else - echo "Qemu is not ready..." + echo "Qemu is not ready after ${SECONDS} seconds..." echo "Set the environment variable CROSS_DEBUG=1 to debug" exit 1 fi From f3e98ebba1e9426bf34e973623d1137a80004fb2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Fri, 19 Nov 2021 19:51:52 +0100 Subject: [PATCH 15/89] also display qemu log | tail -n10 when failed --- docker/linux-runner | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/linux-runner b/docker/linux-runner index 4274f0090..57e79fdab 100755 --- a/docker/linux-runner +++ b/docker/linux-runner @@ -156,6 +156,8 @@ esac else echo "Qemu is not ready after ${SECONDS} seconds..." echo "Set the environment variable CROSS_DEBUG=1 to debug" + echo "Last 10 lines of qemu output:" + tail "${LOG}" exit 1 fi fi From ace90893d17decfdc7c9e6d7497f0d3ce64691c2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Fri, 19 Nov 2021 19:56:10 +0100 Subject: [PATCH 16/89] disable dragonfly --- .github/workflows/docker.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c09a63511..21df99d47 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -263,11 +263,12 @@ jobs: cpp: 1 std: 1 run: 1 - - target: x86_64-unknown-dragonfly - toolchain: nightly - os: ubuntu-latest - cpp: 1 - dylib: 1 + # Disabled, see #396 + # - target: x86_64-unknown-dragonfly + # toolchain: nightly + # os: ubuntu-latest + # cpp: 1 + # dylib: 1 - target: i686-unknown-freebsd toolchain: 1.42.0 os: ubuntu-latest From 64d3558f3339610cc33a9345dc6084e52c3808ae Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Fri, 30 Oct 2020 10:05:30 -0300 Subject: [PATCH 17/89] Update qemu to 5.1 --- README.md | 44 ++++++++++++++--------------- docker/qemu.sh | 76 +++++++++++++++++++++++--------------------------- 2 files changed, 57 insertions(+), 63 deletions(-) diff --git a/README.md b/README.md index 0214d9d63..f1b05c722 100644 --- a/README.md +++ b/README.md @@ -264,18 +264,18 @@ terminate. |--------------------------------------|-------:|--------:|:---:|------:|:------:| | `*-apple-ios` [1] | N/A | N/A | N/A | N/A | ✓ | | `aarch64-linux-android` [2] | N/A | 4.9 | ✓ | N/A | ✓ | -| `aarch64-unknown-linux-gnu` | 2.19 | 4.8.2 | ✓ | 4.1.0 | ✓ | -| `aarch64-unknown-linux-musl` | 1.1.20 | 6.3.0 | | 4.1.0 | ✓ | +| `aarch64-unknown-linux-gnu` | 2.19 | 4.8.2 | ✓ | 5.1.0 | ✓ | +| `aarch64-unknown-linux-musl` | 1.1.20 | 6.3.0 | | 5.1.0 | ✓ | | `arm-linux-androideabi` [2] | N/A | 4.9 | ✓ | N/A | ✓ | -| `arm-unknown-linux-gnueabi` | 2.19 | 4.8.2 | ✓ | 4.1.0 | ✓ | -| `arm-unknown-linux-gnueabihf` | 2.27 | 7.3.0 | ✓ | 4.1.0 | ✓ | -| `arm-unknown-linux-musleabi` | 1.1.20 | 6.3.0 | | 4.1.0 | ✓ | -| `arm-unknown-linux-musleabihf` | 1.1.20 | 6.3.0 | | 4.1.0 | ✓ | -| `armv5te-unknown-linux-gnueabi` | 2.27 | 7.5.0 | ✓ | 4.2.0 | ✓ | -| `armv5te-unknown-linux-musleabi` | 1.1.20 | 6.3.0 | | 4.1.0 | ✓ | +| `arm-unknown-linux-gnueabi` | 2.19 | 4.8.2 | ✓ | 5.1.0 | ✓ | +| `arm-unknown-linux-gnueabihf` | 2.27 | 7.3.0 | ✓ | 5.1.0 | ✓ | +| `arm-unknown-linux-musleabi` | 1.1.20 | 6.3.0 | | 5.1.0 | ✓ | +| `arm-unknown-linux-musleabihf` | 1.1.20 | 6.3.0 | | 5.1.0 | ✓ | +| `armv5te-unknown-linux-gnueabi` | 2.27 | 7.5.0 | ✓ | 5.1.0 | ✓ | +| `armv5te-unknown-linux-musleabi` | 1.1.20 | 6.3.0 | | 5.1.0 | ✓ | | `armv7-linux-androideabi` [2] | N/A | 4.9 | ✓ | N/A | ✓ | -| `armv7-unknown-linux-gnueabihf` | 2.15 | 4.6.2 | ✓ | 4.1.0 | ✓ | -| `armv7-unknown-linux-musleabihf` | 1.1.20 | 6.3.0 | | 4.1.0 | ✓ | +| `armv7-unknown-linux-gnueabihf` | 2.15 | 4.6.2 | ✓ | 5.1.0 | ✓ | +| `armv7-unknown-linux-musleabihf` | 1.1.20 | 6.3.0 | | 5.1.0 | ✓ | | `i586-unknown-linux-gnu` | 2.23 | 5.3.1 | ✓ | N/A | ✓ | | `i586-unknown-linux-musl` | 1.1.20 | 6.3.0 | | N/A | ✓ | | `i686-unknown-freebsd` [4] | 12.1 | 6.4.0 | | N/A | ✓ | @@ -283,18 +283,18 @@ terminate. | `i686-pc-windows-gnu` | N/A | 7.3.0 | ✓ | N/A | ✓ | | `i686-unknown-linux-gnu` | 2.15 | 4.6.2 | ✓ | N/A | ✓ | | `i686-unknown-linux-musl` | 1.1.20 | 6.3.0 | | N/A | ✓ | -| `mips-unknown-linux-gnu` | 2.23 | 5.3.1 | ✓ | 4.1.0 | ✓ | -| `mips-unknown-linux-musl` | 1.1.20 | 6.3.0 | ✓ | 4.1.0 | ✓ | -| `mips64-unknown-linux-gnuabi64` | 2.23 | 5.3.1 | ✓ | 4.1.0 | ✓ | -| `mips64el-unknown-linux-gnuabi64` | 2.23 | 5.3.1 | ✓ | 4.1.0 | ✓ | -| `mipsel-unknown-linux-gnu` | 2.23 | 5.3.1 | ✓ | 4.1.0 | ✓ | -| `mipsel-unknown-linux-musl` | 1.1.20 | 6.3.0 | ✓ | 4.1.0 | ✓ | -| `powerpc-unknown-linux-gnu` | 2.19 | 4.8.2 | ✓ | 3.0.1 | ✓ | -| `powerpc64-unknown-linux-gnu` | 2.31 | 10.2.0 | ✓ | 3.0.1 | ✓ | -| `powerpc64le-unknown-linux-gnu` | 2.19 | 4.8.2 | ✓ | 3.0.1 | ✓ | -| `riscv64gc-unknown-linux-gnu` | 2.27 | 7.5.0 | ✓ | 4.2.0 | ✓ | -| `s390x-unknown-linux-gnu` | 2.23 | 5.3.1 | ✓ | 4.1.0 | | -| `sparc64-unknown-linux-gnu` | 2.31 | 10.2.0 | ✓ | 4.2.0 | ✓ | +| `mips-unknown-linux-gnu` | 2.23 | 5.3.1 | ✓ | 5.1.0 | ✓ | +| `mips-unknown-linux-musl` | 1.1.20 | 6.3.0 | ✓ | 5.1.0 | ✓ | +| `mips64-unknown-linux-gnuabi64` | 2.23 | 5.3.1 | ✓ | 5.1.0 | ✓ | +| `mips64el-unknown-linux-gnuabi64` | 2.23 | 5.3.1 | ✓ | 5.1.0 | ✓ | +| `mipsel-unknown-linux-gnu` | 2.23 | 5.3.1 | ✓ | 5.1.0 | ✓ | +| `mipsel-unknown-linux-musl` | 1.1.20 | 6.3.0 | ✓ | 5.1.0 | ✓ | +| `powerpc-unknown-linux-gnu` | 2.19 | 4.8.2 | ✓ | 5.1.0 | ✓ | +| `powerpc64-unknown-linux-gnu` | 2.31 | 10.2.0 | ✓ | 5.1.0 | ✓ | +| `powerpc64le-unknown-linux-gnu` | 2.19 | 4.8.2 | ✓ | 5.1.0 | ✓ | +| `riscv64gc-unknown-linux-gnu` | 2.27 | 7.5.0 | ✓ | 5.1.0 | ✓ | +| `s390x-unknown-linux-gnu` | 2.23 | 5.3.1 | ✓ | 5.1.0 | | +| `sparc64-unknown-linux-gnu` | 2.31 | 10.2.0 | ✓ | 5.1.0 | ✓ | | `sparcv9-sun-solaris` [4] | 2.11 | 5.3.0 | ✓ | N/A | | | `thumbv6m-none-eabi` [5] | 2.2.0 | 5.3.1 | | N/A | | | `thumbv7em-none-eabi` [5] | 2.2.0 | 5.3.1 | | N/A | | diff --git a/docker/qemu.sh b/docker/qemu.sh index 94c0a6ab3..24d4fd8f9 100755 --- a/docker/qemu.sh +++ b/docker/qemu.sh @@ -67,16 +67,7 @@ build_static_pixman() { } main() { - local version=4.2.0 - - # Qemu versions 3.1.0 and above break 32-bit float conversions - # on powerpc, powerpc64, and powerpc64le. Last known working version - # is 3.0.1. - # Upstream Issue: - # https://bugs.launchpad.net/qemu/+bug/1821444 - if [[ "${1}" == ppc* ]]; then - version=3.0.1 - fi + local version=5.1.0 local arch="${1}" \ softmmu="${2:-}" @@ -95,17 +86,17 @@ main() { if_centos install_packages \ gcc-c++ \ - glib2-devel \ pkgconfig \ - zlib-devel \ - libcap-devel \ - libattr-devel \ - pixman-devel \ xz \ - libfdt-devel \ - glibc-static \ + glib2-devel \ glib2-static \ + glibc-static \ + libattr-devel \ + libcap-ng-devel \ + libfdt-devel \ pcre-static \ + pixman-devel \ + zlib-devel \ zlib-static # these are not packaged as static libraries in centos; build them manually @@ -115,13 +106,15 @@ main() { if_ubuntu install_packages \ g++ \ - libglib2.0-dev \ pkg-config \ - zlib1g-dev \ - libcap-dev \ + xz-utils \ libattr1-dev \ + libcap-ng-dev \ + libffi-dev \ + libglib2.0-dev \ libpixman-1-dev \ - xz-utils + libselinux1-dev \ + zlib1g-dev local td td="$(mktemp -d)" @@ -131,30 +124,31 @@ main() { curl --retry 3 -sSfL "https://download.qemu.org/qemu-${version}.tar.xz" -O tar --strip-components=1 -xJf "qemu-${version}.tar.xz" - local targets="${arch}-linux-user" - local virtfs="" - case "${softmmu}" in - softmmu) - if [ "${arch}" = "ppc64le" ]; then - targets="${targets},ppc64-softmmu" - else - targets="${targets},${arch}-softmmu" - fi - virtfs="--enable-virtfs" - ;; - "") - true - ;; - *) - echo "Invalid softmmu option: ${softmmu}" - exit 1 - ;; - esac + local targets="${arch}-linux-user" + local virtfs="" + case "${softmmu}" in + softmmu) + if [ "${arch}" = "ppc64le" ]; then + targets="${targets},ppc64-softmmu" + else + targets="${targets},${arch}-softmmu" + fi + virtfs="--enable-virtfs" + ;; + "") + true + ;; + *) + echo "Invalid softmmu option: ${softmmu}" + exit 1 + ;; + esac ./configure \ --disable-kvm \ --disable-vnc \ - --enable-user \ + --disable-guest-agent \ + --enable-linux-user \ --static \ ${virtfs} \ --target-list="${targets}" From c8231a8c1ab69f2fc768b70ac4a0b2690233f717 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Fri, 19 Nov 2021 21:20:19 +0100 Subject: [PATCH 18/89] allow apt-get -d to retry --- docker/linux-image.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/linux-image.sh b/docker/linux-image.sh index 6b439410c..d8add4ab1 100755 --- a/docker/linux-image.sh +++ b/docker/linux-image.sh @@ -130,6 +130,9 @@ main() { rm "${key}" done + # allow apt-get to retry downloads + echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries + apt-get update mkdir -p "/qemu/${arch}" From b4aa1debfb8651e7ccba971be55d35ea51b13fe4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Fri, 19 Nov 2021 21:29:22 +0100 Subject: [PATCH 19/89] always run with bash --- .github/workflows/docker.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 21df99d47..88d5c56ff 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -362,8 +362,10 @@ jobs: if: runner.os == 'Linux' timeout-minutes: 360 run: ./build-docker-image.sh "${{ matrix.target }}" + shell: bash - name: Test run: ./ci/test.sh + shell: bash - name: Publish on crates.io if: startsWith(env.TAG, 'v') && matrix.CRATES_IO_PUBLISH == '1' env: @@ -382,3 +384,4 @@ jobs: - name: Push image to GHCR if: (env.BRANCH == 'master' || startsWith(env.TAG, 'v')) && runner.os == 'Linux' run: ./ci/docker_push.sh + shell: bash From 9a601ee046a685af0b71c5f260e50580f6a9200c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Sat, 20 Nov 2021 00:11:32 +0100 Subject: [PATCH 20/89] libcap-ng static --- docker/qemu.sh | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/docker/qemu.sh b/docker/qemu.sh index 24d4fd8f9..5dfc4a5e3 100755 --- a/docker/qemu.sh +++ b/docker/qemu.sh @@ -30,17 +30,19 @@ build_static_libattr() { } build_static_libcap() { - local version=2.22 + local version=0.7.5 local td td="$(mktemp -d)" pushd "${td}" - curl --retry 3 -sSfL "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-${version}.tar.xz" -O - tar --strip-components=1 -xJf "libcap-${version}.tar.xz" + curl --retry 3 -sSfL "https://github.com/stevegrubb/libcap-ng/archive/refs/tags/v${version}.tar.gz" -O -L + tar --strip-components=1 -xzf "v${version}.tar.gz" + ./autogen.sh + ./configure make "-j$(nproc)" - install -m 644 libcap/libcap.a /usr/lib64/ + install -m 644 src/.libs/libcap-ng.a /usr/lib64/ popd From 6044f0e63b85a30b3738cac8b2e91c0f2a5a001e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Sat, 20 Nov 2021 18:49:06 +0100 Subject: [PATCH 21/89] more fixes --- docker/qemu.sh | 50 +++++++++++++++++++++++++++++++++++++++++++++++++- 1 file changed, 49 insertions(+), 1 deletion(-) diff --git a/docker/qemu.sh b/docker/qemu.sh index 5dfc4a5e3..e40b94d31 100755 --- a/docker/qemu.sh +++ b/docker/qemu.sh @@ -6,6 +6,47 @@ set -euo pipefail # shellcheck disable=SC1091 . lib.sh +build_static_libffi () { + local version=3.0.13 + + local td + td="$(mktemp -d)" + + pushd "${td}" + + + curl --retry 3 -sSfL "https://github.com/libffi/libffi/archive/refs/tags/v${version}.tar.gz" -O -L + tar --strip-components=1 -xzf "v${version}.tar.gz" + ./configure --prefix="$td"/lib --disable-builddir --disable-shared --enable-static + make "-j$(nproc)" + install -m 644 ./.libs/libffi.a /usr/lib64/ + + popd + + rm -rf "${td}" +} + +build_static_libmount () { + local version_spec=2.23.2 + local version=2.23 + local td + td="$(mktemp -d)" + + pushd "${td}" + + + curl --retry 3 -sSfL "https://kernel.org/pub/linux/utils/util-linux/v${version}/util-linux-${version_spec}.tar.xz" -O -L + tar --strip-components=1 -xJf "util-linux-${version_spec}.tar.xz" + ./configure --disable-shared --enable-static --without-ncurses + make "-j$(nproc)" mount + install -m 644 ./.libs/*.a /usr/lib64/ + + popd + + rm -rf "${td}" +} + + build_static_libattr() { local version=2.4.46 @@ -98,10 +139,18 @@ main() { libfdt-devel \ pcre-static \ pixman-devel \ + libselinux-devel \ + libselinux-static \ + libffi \ + libuuid-devel \ + libblkid-devel \ + libmount-devel \ zlib-devel \ zlib-static # these are not packaged as static libraries in centos; build them manually + if_centos build_static_libffi + if_centos build_static_libmount if_centos build_static_libattr if_centos build_static_libcap if_centos build_static_pixman @@ -117,7 +166,6 @@ main() { libpixman-1-dev \ libselinux1-dev \ zlib1g-dev - local td td="$(mktemp -d)" From b24ea1d82cf559deffd77791b10eba526bb3e431 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Tue, 25 Jan 2022 00:01:26 +0100 Subject: [PATCH 22/89] update image name --- README.md | 4 ++-- build-docker-image.sh | 2 +- ci/docker_push.sh | 2 +- src/docker.rs | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index f1b05c722..8cf43eb0f 100644 --- a/README.md +++ b/README.md @@ -109,12 +109,12 @@ the default one. Normal Docker behavior applies, so: - If only `tag` is omitted, then Docker will use the `latest` tag. It's recommended to base your custom image on the default Docker image that -cross uses: `rustembedded/cross:{{TARGET}}-{{VERSION}}` (where `{{VERSION}}` is cross's version). +cross uses: `cross-rs/cross:{{TARGET}}-{{VERSION}}` (where `{{VERSION}}` is cross's version). This way you won't have to figure out how to install a cross C toolchain in your custom image. Example below: ``` Dockerfile -FROM rustembedded/cross:aarch64-unknown-linux-gnu-0.2.1 +FROM cross-rs/cross:aarch64-unknown-linux-gnu-0.2.1 RUN dpkg --add-architecture arm64 && \ apt-get update && \ diff --git a/build-docker-image.sh b/build-docker-image.sh index 438107d67..e441000c3 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -9,7 +9,7 @@ cd docker run() { local dockerfile="Dockerfile.${1}" - local image_name="ghcr.io/rustembedded/cross:${1}" + local image_name="ghcr.io/cross-rs/cross:${1}" local cache_from_args=() if ! docker image inspect "${image_name}" &>/dev/null; then diff --git a/ci/docker_push.sh b/ci/docker_push.sh index 846684eca..1a45b8c06 100755 --- a/ci/docker_push.sh +++ b/ci/docker_push.sh @@ -2,7 +2,7 @@ set -eux -image_name="ghcr.io/rustembedded/cross:${TARGET}" +image_name="ghcr.io/cross-rs/cross:${TARGET}" if [[ "${TAG-}" =~ ^v.* ]] && ! [[ "${TAG}" =~ alpha ]] && ! [[ "${TAG}" =~ dev ]]; then version="${TAG##v}" diff --git a/src/docker.rs b/src/docker.rs index 5a05c89ab..3f222ee5d 100644 --- a/src/docker.rs +++ b/src/docker.rs @@ -13,7 +13,7 @@ use crate::id; use crate::{Config, Target}; const DOCKER_IMAGES: &[&str] = &include!(concat!(env!("OUT_DIR"), "/docker-images.rs")); -const CROSS_IMAGE: &str = "ghcr.io/rustembedded/cross"; +const CROSS_IMAGE: &str = "ghcr.io/cross-rs/cross"; const DOCKER: &str = "docker"; const PODMAN: &str = "podman"; From aff472e435be57c309eb91605b9da125a67d00ba Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Tue, 25 Jan 2022 08:52:35 +0100 Subject: [PATCH 23/89] bump msrv --- .github/workflows/ci.yml | 4 +- .github/workflows/docker.yml | 96 ++++++++++++++++++------------------ README.md | 2 +- 3 files changed, 51 insertions(+), 51 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e194e82c5..e44d2887f 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -23,7 +23,7 @@ jobs: - name: install rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.42.0 + toolchain: 1.58.1 profile: minimal components: clippy - name: Run unit tests @@ -44,7 +44,7 @@ jobs: - name: install rust uses: actions-rs/toolchain@v1 with: - toolchain: 1.42.0 + toolchain: 1.58.1 profile: minimal components: rustfmt - name: rustfmt -- --check diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 88d5c56ff..854cd519a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -24,7 +24,7 @@ jobs: matrix: include: - target: aarch64-unknown-linux-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 @@ -32,21 +32,21 @@ jobs: run: 1 runners: qemu-user qemu-system - target: arm-unknown-linux-gnueabi - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 - target: arm-unknown-linux-gnueabihf - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 - target: armv7-unknown-linux-gnueabihf - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 @@ -54,14 +54,14 @@ jobs: run: 1 runners: qemu-user qemu-system - target: i586-unknown-linux-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 - target: i686-unknown-linux-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 @@ -69,7 +69,7 @@ jobs: run: 1 runners: native qemu-user qemu-system - target: mips-unknown-linux-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 @@ -77,7 +77,7 @@ jobs: run: 1 runners: qemu-user qemu-system - target: mipsel-unknown-linux-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 @@ -85,14 +85,14 @@ jobs: run: 1 runners: qemu-user qemu-system - target: mips64-unknown-linux-gnuabi64 - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 std: 1 run: 1 - target: mips64el-unknown-linux-gnuabi64 - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 @@ -100,7 +100,7 @@ jobs: run: 1 runners: qemu-user qemu-system - target: powerpc-unknown-linux-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 @@ -108,7 +108,7 @@ jobs: run: 1 runners: qemu-user qemu-system - target: powerpc64-unknown-linux-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 @@ -116,7 +116,7 @@ jobs: run: 1 runners: qemu-user qemu-system - target: powerpc64le-unknown-linux-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 @@ -124,13 +124,13 @@ jobs: run: 1 runners: qemu-user qemu-system - target: riscv64gc-unknown-linux-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: s390x-unknown-linux-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 @@ -138,7 +138,7 @@ jobs: run: 1 runners: qemu-system - target: sparc64-unknown-linux-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 @@ -146,7 +146,7 @@ jobs: run: 1 runners: qemu-system - target: x86_64-unknown-linux-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 @@ -156,95 +156,95 @@ jobs: deploy: 1 CRATES_IO_PUBLISH: 1 - target: aarch64-unknown-linux-musl - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 run: 1 - target: arm-unknown-linux-musleabihf - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 run: 1 - target: arm-unknown-linux-musleabi - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 run: 1 - target: armv5te-unknown-linux-gnueabi - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 run: 1 - target: armv5te-unknown-linux-musleabi - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 run: 1 - target: armv7-unknown-linux-musleabihf - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 run: 1 - target: i586-unknown-linux-musl - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 run: 1 - target: i686-unknown-linux-musl - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 run: 1 - target: mips-unknown-linux-musl - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: mipsel-unknown-linux-musl - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: x86_64-unknown-linux-musl - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 run: 1 deploy: 1 - target: aarch64-linux-android - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: arm-linux-androideabi - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: armv7-linux-androideabi - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: i686-linux-android - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: x86_64-linux-android - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: x86_64-apple-darwin - toolchain: 1.42.0 + toolchain: 1.58.1 os: macos-latest cpp: 1 dylib: 1 @@ -252,13 +252,13 @@ jobs: run: 1 deploy: 1 - target: x86_64-pc-windows-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 std: 1 run: 1 - target: i686-pc-windows-gnu - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 std: 1 @@ -270,62 +270,62 @@ jobs: # cpp: 1 # dylib: 1 - target: i686-unknown-freebsd - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest dylib: 1 std: 1 - target: x86_64-unknown-freebsd - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest dylib: 1 std: 1 - target: x86_64-unknown-netbsd - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest cpp: 1 dylib: 1 std: 1 # Disabled, see #534 # - target: sparcv9-sun-solaris - # toolchain: 1.42.0 + # toolchain: 1.58.1 # os: ubuntu-latest # cpp: 1 # dylib: 1 # std: 1 # - target: x86_64-sun-solaris - # toolchain: 1.42.0 + # toolchain: 1.58.1 # os: ubuntu-latest # cpp: 1 # dylib: 1 # std: 1 - target: asmjs-unknown-emscripten - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 run: 1 # `cargo run` fails with an assertion error (https://github.com/rust-lang/cargo/issues/4689) on `wasm32-unknown-emscripten`. - target: wasm32-unknown-emscripten - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 - target: thumbv6m-none-eabi - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 - target: thumbv7em-none-eabi - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 - target: thumbv7em-none-eabihf - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 - target: thumbv7m-none-eabi - toolchain: 1.42.0 + toolchain: 1.58.1 os: ubuntu-latest std: 1 - target: x86_64-pc-windows-msvc - toolchain: 1.42.0 + toolchain: 1.58.1 os: windows-latest cpp: 1 std: 1 diff --git a/README.md b/README.md index 8cf43eb0f..89e647ad6 100644 --- a/README.md +++ b/README.md @@ -357,7 +357,7 @@ $ QEMU_STRACE=1 cross run --target aarch64-unknown-linux-gnu ## Minimum Supported Rust Version (MSRV) -This crate is guaranteed to compile on stable Rust 1.42.0 and up. It *might* +This crate is guaranteed to compile on stable Rust 1.58.1 and up. It *might* compile with older versions but that may change in any new patch release. Some cross-compilation targets require a later Rust version, and using Xargo From 2a1a5e1d56340397e13f255bba9f47582e6d8c0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Sun, 6 Feb 2022 18:46:46 +0100 Subject: [PATCH 24/89] apply cargo fmt --- src/main.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main.rs b/src/main.rs index f8d06360f..487c16cdd 100644 --- a/src/main.rs +++ b/src/main.rs @@ -552,7 +552,7 @@ impl Toml { fn toml(root: &Root) -> Result> { let path = match env::var("CROSS_CONFIG") { Ok(var) => PathBuf::from(var), - Err(_) => root.path().join("Cross.toml") + Err(_) => root.path().join("Cross.toml"), }; if path.exists() { From 83061d5860d8d02de6b4c8243757d4ccd0af19a1 Mon Sep 17 00:00:00 2001 From: Jesse Szwedko Date: Tue, 28 Dec 2021 16:11:44 -0800 Subject: [PATCH 25/89] freebsd: Include libdevstat in build image Similar to https://github.com/rust-embedded/cross/pull/613 include libdevstat seems to be required now too. Probably due to https://github.com/rust-lang/libc/commit/ac6e16b90fd36775341724cf0c6b00b4c8d33d60 Signed-off-by: Jesse Szwedko --- docker/freebsd.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/freebsd.sh b/docker/freebsd.sh index 06832c0fe..4393ddd06 100755 --- a/docker/freebsd.sh +++ b/docker/freebsd.sh @@ -74,6 +74,7 @@ main() { cp "${td}/freebsd/lib/libthr.so.3" "${destdir}/lib" cp "${td}/freebsd/lib/libutil.so.9" "${destdir}/lib" cp "${td}/freebsd/lib/libssp.so.0" "${destdir}/lib" + cp "${td}/freebsd/lib/libdevstat.so.7" "${destdir}/lib" cp "${td}/freebsd/usr/lib/libc++.so.1" "${destdir}/lib" cp "${td}/freebsd/usr/lib/libc++.a" "${destdir}/lib" cp "${td}/freebsd/usr/lib"/lib{c,util,m,ssp,ssp_nonshared}.a "${destdir}/lib" @@ -89,6 +90,7 @@ main() { ln -s libutil.so.9 "${destdir}/lib/libutil.so" ln -s libthr.so.3 "${destdir}/lib/libpthread.so" ln -s libssp.so.0 "${destdir}/lib/libssp.so" + ln -s libdevstat.so.7 "${destdir}/lib/libdevstat.so" cd gcc-build ../gcc/configure \ From 70e6eff09ed43c374f6bbe840615b50e003e7474 Mon Sep 17 00:00:00 2001 From: Will Date: Tue, 23 Nov 2021 12:46:12 +0900 Subject: [PATCH 26/89] freebsd: include libkvm in build image --- docker/freebsd.sh | 3 +++ 1 file changed, 3 insertions(+) diff --git a/docker/freebsd.sh b/docker/freebsd.sh index 4393ddd06..cc5ac8d21 100755 --- a/docker/freebsd.sh +++ b/docker/freebsd.sh @@ -71,6 +71,7 @@ main() { cp -r "${td}/freebsd/usr/include" "${destdir}" cp "${td}/freebsd/lib/libc.so.7" "${destdir}/lib" cp "${td}/freebsd/lib/libm.so.5" "${destdir}/lib" + cp "${td}/freebsd/lib/libkvm.so.7" "${destdir}/lib" cp "${td}/freebsd/lib/libthr.so.3" "${destdir}/lib" cp "${td}/freebsd/lib/libutil.so.9" "${destdir}/lib" cp "${td}/freebsd/lib/libssp.so.0" "${destdir}/lib" @@ -80,6 +81,7 @@ main() { cp "${td}/freebsd/usr/lib"/lib{c,util,m,ssp,ssp_nonshared}.a "${destdir}/lib" cp "${td}/freebsd/usr/lib"/lib{rt,execinfo,procstat}.so.1 "${destdir}/lib" cp "${td}/freebsd/usr/lib"/{crt1,Scrt1,crti,crtn}.o "${destdir}/lib" + cp "${td}/freebsd/usr/lib"/libkvm.a "${destdir}/lib" ln -s libc.so.7 "${destdir}/lib/libc.so" ln -s libc++.so.1 "${destdir}/lib/libc++.so" @@ -91,6 +93,7 @@ main() { ln -s libthr.so.3 "${destdir}/lib/libpthread.so" ln -s libssp.so.0 "${destdir}/lib/libssp.so" ln -s libdevstat.so.7 "${destdir}/lib/libdevstat.so" + ln -s libkvm.so.7 "${destdir}/lib/libkvm.so" cd gcc-build ../gcc/configure \ From 0a5ba9208620fd3f16d7790c8c449e4784281b18 Mon Sep 17 00:00:00 2001 From: Sven-Hendrik Haase Date: Sun, 6 Feb 2022 09:23:16 +0100 Subject: [PATCH 27/89] Fix FreeBSD versions of sqlite and openssl --- docker/freebsd-extras.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/freebsd-extras.sh b/docker/freebsd-extras.sh index 3fca81c8c..b3ea2e55a 100755 --- a/docker/freebsd-extras.sh +++ b/docker/freebsd-extras.sh @@ -6,8 +6,8 @@ set -euo pipefail main() { local arch="${1}" - local sqlite_ver=3.35.5_3,1 \ - openssl_ver=1.1.1l,1 \ + local sqlite_ver=3.35.5_4,1 \ + openssl_ver=1.1.1m_1,1 \ target="${arch}-unknown-freebsd12" local td From 33728319877eea966a5f23770acbda6de4a0c2a3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Sun, 6 Feb 2022 19:23:52 +0100 Subject: [PATCH 28/89] disabled asmjs-unknown-emscripten, see #634 --- .github/workflows/docker.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 854cd519a..d2f90769f 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -298,11 +298,12 @@ jobs: # cpp: 1 # dylib: 1 # std: 1 - - target: asmjs-unknown-emscripten - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 + # Disabled, see #634 + #- target: asmjs-unknown-emscripten + # toolchain: 1.58.1 + # os: ubuntu-latest + # std: 1 + # run: 1 # `cargo run` fails with an assertion error (https://github.com/rust-lang/cargo/issues/4689) on `wasm32-unknown-emscripten`. - target: wasm32-unknown-emscripten toolchain: 1.58.1 From 1fb3a5b6af7206c930a52cf42922ba7229942458 Mon Sep 17 00:00:00 2001 From: Joe Richey Date: Tue, 5 Jan 2021 02:07:32 -0800 Subject: [PATCH 29/89] Update emscripten version Emscripten and rustc have to use compatible versions of LLVM to avoid linker error. With the update to LLVM 11, emscripten also requires an update, see https://github.com/rust-lang/rust/pull/75716. Also, now the emscripten is updated, the fix for https://github.com/kripken/emscripten/issues/4542 is now avalibe, which means we can delete the node-wasm workaround. Signed-off-by: Joe Richey --- docker/Dockerfile.asmjs-unknown-emscripten | 2 +- docker/Dockerfile.wasm32-unknown-emscripten | 5 +-- docker/node-wasm | 48 --------------------- 3 files changed, 3 insertions(+), 52 deletions(-) delete mode 100755 docker/node-wasm diff --git a/docker/Dockerfile.asmjs-unknown-emscripten b/docker/Dockerfile.asmjs-unknown-emscripten index 179954a3f..d91664604 100644 --- a/docker/Dockerfile.asmjs-unknown-emscripten +++ b/docker/Dockerfile.asmjs-unknown-emscripten @@ -9,7 +9,7 @@ RUN /cmake.sh COPY xargo.sh / RUN /xargo.sh -COPY --from=trzeci/emscripten:1.38.46-upstream /emsdk_portable /emsdk_portable +COPY --from=trzeci/emscripten:1.39.20-upstream /emsdk_portable /emsdk_portable ENV EMSDK /emsdk_portable ENV EMSCRIPTEN=${EMSDK}/emscripten/sdk diff --git a/docker/Dockerfile.wasm32-unknown-emscripten b/docker/Dockerfile.wasm32-unknown-emscripten index 7b0340faf..8aec8da97 100644 --- a/docker/Dockerfile.wasm32-unknown-emscripten +++ b/docker/Dockerfile.wasm32-unknown-emscripten @@ -9,7 +9,7 @@ RUN /cmake.sh COPY xargo.sh / RUN /xargo.sh -COPY --from=trzeci/emscripten:1.38.46-upstream /emsdk_portable /emsdk_portable +COPY --from=trzeci/emscripten:1.39.20-upstream /emsdk_portable /emsdk_portable ENV EMSDK /emsdk_portable ENV EMSCRIPTEN=${EMSDK}/emscripten/sdk @@ -27,5 +27,4 @@ RUN apt-get update && apt-get install --assume-yes --no-install-recommends \ libxml2 \ python -COPY node-wasm /usr/local/bin/ -ENV CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node-wasm +ENV CARGO_TARGET_WASM32_UNKNOWN_EMSCRIPTEN_RUNNER=node diff --git a/docker/node-wasm b/docker/node-wasm deleted file mode 100755 index 14ea7928e..000000000 --- a/docker/node-wasm +++ /dev/null @@ -1,48 +0,0 @@ -#!/usr/bin/env bash - -set -e - -# Workaround for -# https://github.com/kripken/emscripten/issues/4542 - -# Consider a project with this structure: -# -# ├── src -# │   ├── bin -# │   │   └── prog.rs -# │   └── lib.rs -# ├── benches -# │   └── b.rs -# ├── examples -# │   └── a.rs -# └── tests -#     └── t.rs -# -# We expect that the artifacts will be generated in -# -# `target/wasm32-unknown-emscripten/{debug,release}/deps/` -# (for tests and benches) -# -# `target/wasm32-unknown-emscripten/{debug,release}/examples/` -# for examples -# -# `target/wasm32-unknown-emscripten/{debug,release}/` -# for main programs (`main.rs` and `bin/*.rs`) -# -# Because of https://github.com/kripken/emscripten/issues/4542 -# the script must be executed from where the dependencies are. - -path="$(dirname "${1}")" -file="$(basename "${1}")" -base="$(basename "${path}")" - -if [[ "${base}" != "deps" ]] && [[ "${base}" != "examples" ]]; then - # main programs requeries the artifacts in `${path}/deps` - cd "${path}/deps" - exec node "../${file}" -else - # all deps of tests, benches and examples are in `${path}` dir - cd "${path}" - exec node "${file}" -fi - From 86f0da4d93f606aaf3590fa94bfd807c92248326 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 10 Mar 2022 17:55:16 +0100 Subject: [PATCH 30/89] Add missing Debian key. --- docker/linux-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/linux-image.sh b/docker/linux-image.sh index d8add4ab1..a1a652853 100755 --- a/docker/linux-image.sh +++ b/docker/linux-image.sh @@ -123,7 +123,7 @@ main() { curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{7.0,8,9,10}.asc' -O curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/archive-key-{8,9,10}-security.asc' -O curl --retry 3 -sSfL 'https://ftp-master.debian.org/keys/release-{7,8,9,10}.asc' -O - curl --retry 3 -sSfL 'https://www.ports.debian.org/archive_{2020,2021}.key' -O + curl --retry 3 -sSfL 'https://www.ports.debian.org/archive_{2020,2021,2022}.key' -O for key in *.asc *.key; do apt-key add "${key}" From 56ae9642a59ab415e0a39af7935efb474b20959b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 10 Mar 2022 18:25:00 +0100 Subject: [PATCH 31/89] Update kernel version. --- docker/linux-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/linux-image.sh b/docker/linux-image.sh index a1a652853..2abc7b2ff 100755 --- a/docker/linux-image.sh +++ b/docker/linux-image.sh @@ -6,7 +6,7 @@ set -euo pipefail main() { # arch in the rust target local arch="${1}" \ - kversion=4.19.0-14 + kversion=4.19.0-19 local debsource="deb http://http.debian.net/debian/ buster main" debsource="${debsource}\ndeb http://security.debian.org/ buster/updates main" From 46e6dfd1864f970f5a51a06888952b964a0d05b1 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 10 Mar 2022 18:27:37 +0100 Subject: [PATCH 32/89] Use slightly older kernel version. --- docker/linux-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/linux-image.sh b/docker/linux-image.sh index 2abc7b2ff..ec36c3cc5 100755 --- a/docker/linux-image.sh +++ b/docker/linux-image.sh @@ -6,7 +6,7 @@ set -euo pipefail main() { # arch in the rust target local arch="${1}" \ - kversion=4.19.0-19 + kversion=4.19.0-17 local debsource="deb http://http.debian.net/debian/ buster main" debsource="${debsource}\ndeb http://security.debian.org/ buster/updates main" From 5d9760f532b8d66dfb9b4e38133e8569cce2f90c Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 10 Mar 2022 19:15:43 +0100 Subject: [PATCH 33/89] Don't run unit tests on host for every Docker build. --- .github/workflows/docker.yml | 6 ------ 1 file changed, 6 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index d2f90769f..3d9a7bf88 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -353,12 +353,6 @@ jobs: - run: echo "STD=${{ matrix.std }}" >> $GITHUB_ENV - run: echo "RUN=${{ matrix.run }}" >> $GITHUB_ENV - run: echo "RUNNERS=${{ matrix.runners }}" >> $GITHUB_ENV - - name: Run unit tests - uses: actions-rs/cargo@v1 - with: - command: test - args: --locked - timeout-minutes: 5 - name: Build Docker image if: runner.os == 'Linux' timeout-minutes: 360 From f1d6d71430f8833ba01c3ba0197bc36516b664a8 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 10 Mar 2022 19:18:04 +0100 Subject: [PATCH 34/89] Run unit tests on host OSs. --- .github/workflows/ci.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index e44d2887f..5be348b57 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -17,7 +17,13 @@ jobs: - name: ShellCheck uses: azohra/shell-linter@v0.3.0 test: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - macos-latest + - ubuntu-latest + - windows-latest steps: - uses: actions/checkout@v2 - name: install rust @@ -51,4 +57,4 @@ jobs: uses: actions-rs/cargo@v1 with: command: fmt - args: -- --check \ No newline at end of file + args: -- --check From c7776712ad7e6fb5ebe76472a67edd7bd4132cdd Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 10 Mar 2022 20:02:19 +0100 Subject: [PATCH 35/89] Fix environment variables. --- .github/workflows/docker.yml | 19 +++++++++++-------- 1 file changed, 11 insertions(+), 8 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 3d9a7bf88..74fa4f892 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -345,21 +345,24 @@ jobs: - run: echo "OS=${{ runner.os }}" >> $GITHUB_ENV - run: echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV if: startsWith(github.ref, 'refs/heads/') - - run: echo "TAG=${{ runner.os }}" >> $GITHUB_ENV + - run: echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV if: startsWith(github.ref, 'refs/tags/') - - run: echo "TARGET=${{ matrix.target }}" >> $GITHUB_ENV - - run: echo "CPP=${{ matrix.cpp }}" >> $GITHUB_ENV - - run: echo "DYLIB=${{ matrix.dylib }}" >> $GITHUB_ENV - - run: echo "STD=${{ matrix.std }}" >> $GITHUB_ENV - - run: echo "RUN=${{ matrix.run }}" >> $GITHUB_ENV - - run: echo "RUNNERS=${{ matrix.runners }}" >> $GITHUB_ENV - name: Build Docker image if: runner.os == 'Linux' timeout-minutes: 360 - run: ./build-docker-image.sh "${{ matrix.target }}" + run: ./build-docker-image.sh "${TARGET}" + env: + TARGET: ${{ matrix.target }} shell: bash - name: Test run: ./ci/test.sh + env: + TARGET: ${{ matrix.target }} + CPP: ${{ matrix.cpp }} + DYLIB: ${{ matrix.dylib }} + STD: ${{ matrix.std }} + RUN: ${{ matrix.run }} + RUNNERS: ${{ matrix.runners }} shell: bash - name: Publish on crates.io if: startsWith(env.TAG, 'v') && matrix.CRATES_IO_PUBLISH == '1' From eef1ed8ce7c4971c0520794f33828f5ec08a4a6b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 10 Mar 2022 20:33:49 +0100 Subject: [PATCH 36/89] Set `CROSS_DEBUG`. --- .github/workflows/docker.yml | 3 +++ 1 file changed, 3 insertions(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 74fa4f892..66d1f7534 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -6,6 +6,9 @@ on: name: Docker Build +env: + CROSS_DEBUG: '1' + jobs: docker-build: needs: [docker-builds] From 7e43a6c88b6e5babe323bce254b93dedaae349a2 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Thu, 10 Mar 2022 21:53:58 +0100 Subject: [PATCH 37/89] Build static `libblkid`. --- docker/qemu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/qemu.sh b/docker/qemu.sh index e40b94d31..eaa22ab3e 100755 --- a/docker/qemu.sh +++ b/docker/qemu.sh @@ -38,7 +38,7 @@ build_static_libmount () { curl --retry 3 -sSfL "https://kernel.org/pub/linux/utils/util-linux/v${version}/util-linux-${version_spec}.tar.xz" -O -L tar --strip-components=1 -xJf "util-linux-${version_spec}.tar.xz" ./configure --disable-shared --enable-static --without-ncurses - make "-j$(nproc)" mount + make "-j$(nproc)" mount blkid install -m 644 ./.libs/*.a /usr/lib64/ popd From e1097a8446ce524d4b7eda785f610679569c79f7 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 11 Mar 2022 00:00:44 +0100 Subject: [PATCH 38/89] Add verbose flag for copying modules. --- docker/linux-image.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docker/linux-image.sh b/docker/linux-image.sh index ec36c3cc5..0cbac94ff 100755 --- a/docker/linux-image.sh +++ b/docker/linux-image.sh @@ -132,7 +132,7 @@ main() { # allow apt-get to retry downloads echo 'APT::Acquire::Retries "3";' > /etc/apt/apt.conf.d/80-retries - + apt-get update mkdir -p "/qemu/${arch}" @@ -165,7 +165,7 @@ main() { # initrd mkdir -p "${root}/modules" - cp \ + cp -v \ "${root}/lib/modules"/*/kernel/drivers/net/net_failover.ko \ "${root}/lib/modules"/*/kernel/drivers/net/virtio_net.ko \ "${root}/lib/modules"/*/kernel/drivers/virtio/* \ From 91d81cc0eaac0415300242817f5eeff36a22af8c Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 11 Mar 2022 01:08:40 +0100 Subject: [PATCH 39/89] Use older `qemu` version for `centos:7`. --- docker/qemu.sh | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/docker/qemu.sh b/docker/qemu.sh index eaa22ab3e..b106a70d4 100755 --- a/docker/qemu.sh +++ b/docker/qemu.sh @@ -34,7 +34,6 @@ build_static_libmount () { pushd "${td}" - curl --retry 3 -sSfL "https://kernel.org/pub/linux/utils/util-linux/v${version}/util-linux-${version_spec}.tar.xz" -O -L tar --strip-components=1 -xJf "util-linux-${version_spec}.tar.xz" ./configure --disable-shared --enable-static --without-ncurses @@ -112,6 +111,8 @@ build_static_pixman() { main() { local version=5.1.0 + if_centos version=4.2.1 + local arch="${1}" \ softmmu="${2:-}" From 39d9af323cd88c9637a34166fd4bc300c576bf7f Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 11 Mar 2022 03:23:35 +0100 Subject: [PATCH 40/89] Revert to `libcap2`. --- docker/qemu.sh | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/docker/qemu.sh b/docker/qemu.sh index b106a70d4..6346c9364 100755 --- a/docker/qemu.sh +++ b/docker/qemu.sh @@ -70,19 +70,17 @@ build_static_libattr() { } build_static_libcap() { - local version=0.7.5 + local version=2.22 local td td="$(mktemp -d)" pushd "${td}" - curl --retry 3 -sSfL "https://github.com/stevegrubb/libcap-ng/archive/refs/tags/v${version}.tar.gz" -O -L - tar --strip-components=1 -xzf "v${version}.tar.gz" - ./autogen.sh - ./configure + curl --retry 3 -sSfL "https://www.kernel.org/pub/linux/libs/security/linux-privs/libcap2/libcap-${version}.tar.xz" -O + tar --strip-components=1 -xJf "libcap-${version}.tar.xz" make "-j$(nproc)" - install -m 644 src/.libs/libcap-ng.a /usr/lib64/ + install -m 644 libcap/libcap.a /usr/lib64/ popd From 848543e0ae4dc986badddd2b71a8f67b0a97b479 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 11 Mar 2022 18:04:31 +0100 Subject: [PATCH 41/89] Revert to `libcap-devel`. --- docker/qemu.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/qemu.sh b/docker/qemu.sh index 6346c9364..d35bf520b 100755 --- a/docker/qemu.sh +++ b/docker/qemu.sh @@ -134,7 +134,7 @@ main() { glib2-static \ glibc-static \ libattr-devel \ - libcap-ng-devel \ + libcap-devel \ libfdt-devel \ pcre-static \ pixman-devel \ From 805c6a316d1f77f0c16ac80b15e0015ff3cc9b4f Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 11 Mar 2022 18:20:18 +0100 Subject: [PATCH 42/89] Use fixed kernel version for `powerpc64`. --- docker/linux-image.sh | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/docker/linux-image.sh b/docker/linux-image.sh index 0cbac94ff..87d0773c1 100755 --- a/docker/linux-image.sh +++ b/docker/linux-image.sh @@ -40,7 +40,8 @@ main() { powerpc) # there is no buster powerpc port, so we use jessie # use a more recent kernel from backports - kernel=4.9.0-0.bpo.6-powerpc + kversion='4.9.0-0.bpo.6' + kernel="${kversion}-powerpc" debsource="deb http://archive.debian.org/debian jessie main" debsource="${debsource}\ndeb http://archive.debian.org/debian jessie-backports main" debsource="${debsource}\ndeb http://ftp.ports.debian.org/debian-ports unstable main" @@ -57,7 +58,8 @@ main() { # there is no stable port arch=ppc64 # https://packages.debian.org/en/sid/linux-image-powerpc64 - kernel='*-powerpc64' + kversion='5.15.0-2' + kernel="${kversion}-powerpc64" libgcc="libgcc-s1" debsource="deb http://ftp.ports.debian.org/debian-ports unstable main" debsource="${debsource}\ndeb http://ftp.ports.debian.org/debian-ports unreleased main" From a80e2248441b310c6f29f7c2d377a0e3c20267b2 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 11 Mar 2022 23:28:44 +0100 Subject: [PATCH 43/89] Add `netfs` module. --- docker/linux-image.sh | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docker/linux-image.sh b/docker/linux-image.sh index 87d0773c1..b428688a5 100755 --- a/docker/linux-image.sh +++ b/docker/linux-image.sh @@ -171,6 +171,7 @@ main() { "${root}/lib/modules"/*/kernel/drivers/net/net_failover.ko \ "${root}/lib/modules"/*/kernel/drivers/net/virtio_net.ko \ "${root}/lib/modules"/*/kernel/drivers/virtio/* \ + "${root}/lib/modules"/*/kernel/fs/netfs/netfs.ko \ "${root}/lib/modules"/*/kernel/fs/9p/9p.ko \ "${root}/lib/modules"/*/kernel/fs/fscache/fscache.ko \ "${root}/lib/modules"/*/kernel/net/9p/9pnet.ko \ @@ -240,6 +241,7 @@ insmod /modules/virtio_ring.ko || true insmod /modules/virtio_mmio.ko || true insmod /modules/virtio_pci.ko || true insmod /modules/virtio_net.ko || true +insmod /modules/netfs.ko insmod /modules/fscache.ko insmod /modules/9pnet.ko insmod /modules/9pnet_virtio.ko || true From 2a8bf2c762493fff53ea78dbcec6d23eb47880c3 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 11 Mar 2022 23:33:27 +0100 Subject: [PATCH 44/89] Add `virtio_pci_modern_dev` module. --- docker/linux-image.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/linux-image.sh b/docker/linux-image.sh index b428688a5..8cd6c322d 100755 --- a/docker/linux-image.sh +++ b/docker/linux-image.sh @@ -239,6 +239,7 @@ insmod /modules/net_failover.ko || true insmod /modules/virtio.ko || true insmod /modules/virtio_ring.ko || true insmod /modules/virtio_mmio.ko || true +insmod /modules/virtio_pci_modern_dev.ko || true insmod /modules/virtio_pci.ko || true insmod /modules/virtio_net.ko || true insmod /modules/netfs.ko From 1c4fdbcf7e62909431613ecc16c9fbc7c78de9d0 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 11 Mar 2022 23:58:51 +0100 Subject: [PATCH 45/89] Remove need for `BRANCH` and `TAG` variables. --- .github/workflows/docker.yml | 28 ++++++++++++++-------------- ci/test.sh | 4 ---- 2 files changed, 14 insertions(+), 18 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 66d1f7534..074de1c11 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -17,7 +17,7 @@ jobs: - name: Docker builds done run: exit 0 docker-builds: - name: Docker Build ${{ matrix.target }} ${{matrix.os}} ${{matrix.toolchain}} + name: Docker Build ${{ matrix.target }} ${{matrix.os}} ${{matrix.toolchain}} runs-on: ${{ matrix.os }} env: CARGO_NET_RETRY: 3 @@ -345,11 +345,6 @@ jobs: target: ${{ matrix.target }} default: true profile: minimal - - run: echo "OS=${{ runner.os }}" >> $GITHUB_ENV - - run: echo "BRANCH=${{ github.ref_name }}" >> $GITHUB_ENV - if: startsWith(github.ref, 'refs/heads/') - - run: echo "TAG=${{ github.ref_name }}" >> $GITHUB_ENV - if: startsWith(github.ref, 'refs/tags/') - name: Build Docker image if: runner.os == 'Linux' timeout-minutes: 360 @@ -358,6 +353,7 @@ jobs: TARGET: ${{ matrix.target }} shell: bash - name: Test + if: contains(['refs/heads/staging', 'refs/heads/trying'], github.ref) run: ./ci/test.sh env: TARGET: ${{ matrix.target }} @@ -368,21 +364,25 @@ jobs: RUNNERS: ${{ matrix.runners }} shell: bash - name: Publish on crates.io - if: startsWith(env.TAG, 'v') && matrix.CRATES_IO_PUBLISH == '1' + if: matrix.CRATES_IO_PUBLISH == '1' env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} uses: actions-rs/cargo@v1 with: command: publish - args: --dry-run + args: ${{ (!startsWith(github.ref, 'refs/tags/v') && '--dry-run') || '' }} - name: Create GitHub Release - if: startsWith(env.TAG, 'v') && env.DEPLOY == '1' + if: startsWith(github.ref, 'refs/tags/v') && env.DEPLOY == '1' # TODO: Not sure what package to use for this step. run: echo "TODO"; exit 1 - - name: Login to GHCR - if: (env.BRANCH == 'master' || startsWith(env.TAG, 'v')) && runner.os == 'Linux' - run: echo "${ secrets.GITHUB_TOKEN }" | docker login ghcr.io -u "${{ github.actor }}" --password-stdin + - name: Login to GitHub Container Registry + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Push image to GHCR - if: (env.BRANCH == 'master' || startsWith(env.TAG, 'v')) && runner.os == 'Linux' + if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') run: ./ci/docker_push.sh - shell: bash + env: + TAG: ${{ github.ref_name }} diff --git a/ci/test.sh b/ci/test.sh index a3575a5fd..a7fa98e93 100755 --- a/ci/test.sh +++ b/ci/test.sh @@ -28,10 +28,6 @@ function retry { main() { local td= - if [[ "${BRANCH-}" = master ]] || [[ "${TAG-}" =~ ^v.* ]]; then - return - fi - retry cargo fetch cargo install --force --path . From dba648e9d7a101aa04388e90fd850956b4d3ed7e Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Fri, 11 Mar 2022 23:59:51 +0100 Subject: [PATCH 46/89] Ignore missing `netfs` module. --- docker/linux-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/linux-image.sh b/docker/linux-image.sh index 8cd6c322d..b9b13bbb5 100755 --- a/docker/linux-image.sh +++ b/docker/linux-image.sh @@ -242,7 +242,7 @@ insmod /modules/virtio_mmio.ko || true insmod /modules/virtio_pci_modern_dev.ko || true insmod /modules/virtio_pci.ko || true insmod /modules/virtio_net.ko || true -insmod /modules/netfs.ko +insmod /modules/netfs.ko || true insmod /modules/fscache.ko insmod /modules/9pnet.ko insmod /modules/9pnet_virtio.ko || true From f0cf464491a2521c60d7e717265f5a16e0adafa5 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 00:06:34 +0100 Subject: [PATCH 47/89] Add `virtio_pci_legacy_dev` module. --- docker/linux-image.sh | 1 + 1 file changed, 1 insertion(+) diff --git a/docker/linux-image.sh b/docker/linux-image.sh index b9b13bbb5..9c94f1663 100755 --- a/docker/linux-image.sh +++ b/docker/linux-image.sh @@ -239,6 +239,7 @@ insmod /modules/net_failover.ko || true insmod /modules/virtio.ko || true insmod /modules/virtio_ring.ko || true insmod /modules/virtio_mmio.ko || true +insmod /modules/virtio_pci_legacy_dev.ko || true insmod /modules/virtio_pci_modern_dev.ko || true insmod /modules/virtio_pci.ko || true insmod /modules/virtio_net.ko || true From e077459ca001df322154fd8f0fa6f15961d3fe19 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 00:12:18 +0100 Subject: [PATCH 48/89] Fix wrong syntax. --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 074de1c11..fa9ad4d0e 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -353,7 +353,7 @@ jobs: TARGET: ${{ matrix.target }} shell: bash - name: Test - if: contains(['refs/heads/staging', 'refs/heads/trying'], github.ref) + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/trying' run: ./ci/test.sh env: TARGET: ${{ matrix.target }} From 38949df274314ebe76edde70d3881658e070b47c Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 00:59:58 +0100 Subject: [PATCH 49/89] Fix Docker login. --- .github/workflows/docker.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index fa9ad4d0e..26e604536 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -376,6 +376,7 @@ jobs: # TODO: Not sure what package to use for this step. run: echo "TODO"; exit 1 - name: Login to GitHub Container Registry + if: runner.os == 'Linux' uses: docker/login-action@v1 with: registry: ghcr.io From cb1c0aa66ed81dec35b3b15c9afb1b51c8784740 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 01:41:25 +0100 Subject: [PATCH 50/89] Disable `wasm32-unknown-emscripten`. --- .github/workflows/docker.yml | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 26e604536..0eb31a5fb 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -308,10 +308,10 @@ jobs: # std: 1 # run: 1 # `cargo run` fails with an assertion error (https://github.com/rust-lang/cargo/issues/4689) on `wasm32-unknown-emscripten`. - - target: wasm32-unknown-emscripten - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 + # - target: wasm32-unknown-emscripten + # toolchain: 1.58.1 + # os: ubuntu-latest + # std: 1 - target: thumbv6m-none-eabi toolchain: 1.58.1 os: ubuntu-latest From 20cd45b966ee9835815c480e8c7a7900cc2a6243 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 03:30:14 +0100 Subject: [PATCH 51/89] Use Docker Buildx and GitHub Actions cache. --- .github/workflows/docker.yml | 13 +++--- build-docker-image.sh | 82 +++++++++++++++++++++++++++--------- ci/docker_push.sh | 14 ------ 3 files changed, 71 insertions(+), 38 deletions(-) delete mode 100755 ci/docker_push.sh diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 0eb31a5fb..40a0f714c 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -345,9 +345,12 @@ jobs: target: ${{ matrix.target }} default: true profile: minimal + - name: Set up Docker Buildx + if: runner.os == 'Linux' + uses: docker/setup-buildx-action@v1 - name: Build Docker image if: runner.os == 'Linux' - timeout-minutes: 360 + timeout-minutes: 60 run: ./build-docker-image.sh "${TARGET}" env: TARGET: ${{ matrix.target }} @@ -382,8 +385,8 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - - name: Push image to GHCR - if: github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v') - run: ./ci/docker_push.sh + - name: Push image to GitHub Container Registry + if: runner.os == 'Linux' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) + run: ./build-docker-image.sh --push "${TARGET}" env: - TAG: ${{ github.ref_name }} + TARGET: ${{ matrix.target }} diff --git a/build-docker-image.sh b/build-docker-image.sh index e441000c3..23b63d40d 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -3,35 +3,79 @@ set -x set -euo pipefail -version="$(cargo metadata --format-version 1 | jq --raw-output '.packages[] | select(.name == "cross") | .version')" +version="$(cargo metadata --format-version 1 --no-deps | jq --raw-output '.packages[0].version')" +images=() +push=false -cd docker +for arg in "${@}"; do + if [[ "${arg}" == --push ]]; then + push=true + else + images+=("${arg}") + fi +done + +pushd docker run() { - local dockerfile="Dockerfile.${1}" - local image_name="ghcr.io/cross-rs/cross:${1}" - local cache_from_args=() - - if ! docker image inspect "${image_name}" &>/dev/null; then - if docker pull "${image_name}"; then - cache_from_args=(--cache-from "${image_name}") - fi + local push="${1}" + local build_args=() + + if "${push}"; then + build_args+=(--push) fi - docker build ${cache_from_args[@]+"${cache_from_args[@]}"} --pull -t "${image_name}" -f "${dockerfile}" . + local dockerfile="Dockerfile.${2}" + local image_name="ghcr.io/cross-rs/${2}" - if ! [[ "${version}" =~ alpha ]] && ! [[ "${version}" =~ dev ]]; then - local versioned_image_name="${image_name}-${version}" - docker tag "${image_name}" "${versioned_image_name}" - fi + local tags=() + + case "${GITHUB_REF_TYPE-}:${GITHUB_REF_NAME-}" in + tag:v*) + local tag_version="${GITHUB_REF_NAME##v}" + + if [[ "${tag_version}" == "${version}" ]]; then + echo "Git tag does not match package version." >&2 + exit 1 + fi + + tags+=("${image_name}:${tag_version}") + + # Tag stable versions as latest. + if ! [[ "${tag_version}" =~ alpha ]] && ! [[ "${tag_version}" =~ dev ]]; then + tags+=("${image_name}:latest") + fi + ;; + branch:*) + tags+=("${image_name}:${GITHUB_REF_NAME}") + ;; + *) + if "${push}"; then + echo "Refusing to push without tag or branch." >&2 + exit 1 + fi + + # Local development. + tags+=("${image_name}:local") + build_args+=(--load) + ;; + esac + + build_args+=(--pull --cache-from type=gha --cache-to type=gha,mode=max) + + for tag in "${tags[@]}"; do + build_args+=(--tag "${tag}") + done + + docker buildx build "${build_args[@]}" "${cache_args[@]}" -f "${dockerfile}" --progress plain . } -if [[ -z "${*}" ]]; then +if [[ "${#images[@]}" -eq 0 ]]; then for t in Dockerfile.*; do - run "${t##Dockerfile.}" + run "${push}" "${t##Dockerfile.}" done else - for image in "${@}"; do - run "${image}" + for image in "${images[@]}"; do + run "${push}" "${image}" done fi diff --git a/ci/docker_push.sh b/ci/docker_push.sh deleted file mode 100755 index 1a45b8c06..000000000 --- a/ci/docker_push.sh +++ /dev/null @@ -1,14 +0,0 @@ -#!/usr/bin/env bash - -set -eux - -image_name="ghcr.io/cross-rs/cross:${TARGET}" - -if [[ "${TAG-}" =~ ^v.* ]] && ! [[ "${TAG}" =~ alpha ]] && ! [[ "${TAG}" =~ dev ]]; then - version="${TAG##v}" - versioned_image_name="${image_name}-${version}" - docker tag "${image_name}" "${versioned_image_name}" - docker push "${versioned_image_name}" -fi - -docker push "${image_name}" From b2cc52ccdc0ed791c9431ce2d2b8432be93863e6 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 03:30:26 +0100 Subject: [PATCH 52/89] Refactor deploy/publish variables. --- .github/workflows/docker.yml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 40a0f714c..c6ae95a9a 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -156,8 +156,8 @@ jobs: std: 1 run: 1 runners: native qemu-user qemu-system - deploy: 1 - CRATES_IO_PUBLISH: 1 + deploy: true + cargo-publish: 1 - target: aarch64-unknown-linux-musl toolchain: 1.58.1 os: ubuntu-latest @@ -215,7 +215,7 @@ jobs: os: ubuntu-latest std: 1 run: 1 - deploy: 1 + deploy: true - target: aarch64-linux-android toolchain: 1.58.1 os: ubuntu-latest @@ -253,7 +253,7 @@ jobs: dylib: 1 std: 1 run: 1 - deploy: 1 + deploy: true - target: x86_64-pc-windows-gnu toolchain: 1.58.1 os: ubuntu-latest @@ -334,7 +334,7 @@ jobs: cpp: 1 std: 1 run: 1 - deploy: 1 + deploy: true steps: - uses: actions/checkout@v2 @@ -367,7 +367,7 @@ jobs: RUNNERS: ${{ matrix.runners }} shell: bash - name: Publish on crates.io - if: matrix.CRATES_IO_PUBLISH == '1' + if: matrix.cargo-publish env: CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} uses: actions-rs/cargo@v1 @@ -375,7 +375,7 @@ jobs: command: publish args: ${{ (!startsWith(github.ref, 'refs/tags/v') && '--dry-run') || '' }} - name: Create GitHub Release - if: startsWith(github.ref, 'refs/tags/v') && env.DEPLOY == '1' + if: matrix.deploy && startsWith(github.ref, 'refs/tags/v') # TODO: Not sure what package to use for this step. run: echo "TODO"; exit 1 - name: Login to GitHub Container Registry From 30a93d8d8f439731dc8ed130bcdd663a25a76df4 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 03:32:26 +0100 Subject: [PATCH 53/89] Remove undefined `cache_args` variable. --- build-docker-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-docker-image.sh b/build-docker-image.sh index 23b63d40d..a2fe80b7f 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -67,7 +67,7 @@ run() { build_args+=(--tag "${tag}") done - docker buildx build "${build_args[@]}" "${cache_args[@]}" -f "${dockerfile}" --progress plain . + docker buildx build "${build_args[@]}" -f "${dockerfile}" --progress plain . } if [[ "${#images[@]}" -eq 0 ]]; then From b8f35c611fb526fdb7386312e3d18558aa2ca04e Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 03:36:05 +0100 Subject: [PATCH 54/89] Fix `shellcheck` warning. --- build-docker-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build-docker-image.sh b/build-docker-image.sh index a2fe80b7f..387a60cd0 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -61,7 +61,7 @@ run() { ;; esac - build_args+=(--pull --cache-from type=gha --cache-to type=gha,mode=max) + build_args+=(--pull --cache-from 'type=gha' --cache-to 'type=gha,mode=max') for tag in "${tags[@]}"; do build_args+=(--tag "${tag}") From 40506f0068d1263094b6ac85d7842b5850488b47 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 04:33:10 +0100 Subject: [PATCH 55/89] Fix image name. --- src/docker.rs | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/src/docker.rs b/src/docker.rs index 3f222ee5d..eeafc24df 100644 --- a/src/docker.rs +++ b/src/docker.rs @@ -13,7 +13,7 @@ use crate::id; use crate::{Config, Target}; const DOCKER_IMAGES: &[&str] = &include!(concat!(env!("OUT_DIR"), "/docker-images.rs")); -const CROSS_IMAGE: &str = "ghcr.io/cross-rs/cross"; +const CROSS_IMAGE: &str = "ghcr.io/cross-rs"; const DOCKER: &str = "docker"; const PODMAN: &str = "podman"; @@ -229,14 +229,7 @@ pub fn image(config: &Config, target: &Target) -> Result { } let version = env!("CARGO_PKG_VERSION"); - - let image = if version.contains("alpha") || version.contains("dev") { - format!("{}:{}", CROSS_IMAGE, triple) - } else { - format!("{}:{}-{}", CROSS_IMAGE, triple, version) - }; - - Ok(image) + Ok(format!("{}/{}:{}", CROSS_IMAGE, triple, version)) } fn docker_read_mount_paths() -> Result> { From 07e953719babee36227b75167bebe59b38549930 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 05:41:58 +0100 Subject: [PATCH 56/89] Use correct image for test. --- .github/workflows/docker.yml | 11 +++++++++++ build-docker-image.sh | 19 ++++++++++++------- 2 files changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index c6ae95a9a..a88d3e4b4 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -349,12 +349,22 @@ jobs: if: runner.os == 'Linux' uses: docker/setup-buildx-action@v1 - name: Build Docker image + id: build-docker-image if: runner.os == 'Linux' timeout-minutes: 60 run: ./build-docker-image.sh "${TARGET}" env: TARGET: ${{ matrix.target }} shell: bash + - name: Set Docker image for test + if: steps.build-docker-image.outputs.image + run: | + TARGET_VAR="cross_target_${TARGET//-/_}_image" + echo "${TARGET_VAR^^}=${IMAGE}" | tee -a "${GITHUB_ENV}" + env: + TARGET: ${{ matrix.target }} + IMAGE: ${{ steps.build-docker-image.outputs.image }} + shell: bash - name: Test if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/trying' run: ./ci/test.sh @@ -390,3 +400,4 @@ jobs: run: ./build-docker-image.sh --push "${TARGET}" env: TARGET: ${{ matrix.target }} + shell: bash diff --git a/build-docker-image.sh b/build-docker-image.sh index 387a60cd0..8613ea07d 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -4,14 +4,14 @@ set -x set -euo pipefail version="$(cargo metadata --format-version 1 --no-deps | jq --raw-output '.packages[0].version')" -images=() +targets=() push=false for arg in "${@}"; do if [[ "${arg}" == --push ]]; then push=true else - images+=("${arg}") + targets+=("${arg}") fi done @@ -68,14 +68,19 @@ run() { done docker buildx build "${build_args[@]}" -f "${dockerfile}" --progress plain . + + if [[ -n "${GITHUB_ACTIONS-}" ]]; then + echo "::set-output name=image::${tags[0]}" + fi } -if [[ "${#images[@]}" -eq 0 ]]; then - for t in Dockerfile.*; do - run "${push}" "${t##Dockerfile.}" +if [[ "${#targets[@]}" -eq 0 ]]; then + for dockerfile in Dockerfile.*; do + target="${dockerfile##Dockerfile.}" + run "${push}" "${target}" done else - for image in "${images[@]}"; do - run "${push}" "${image}" + for target in "${targets[@]}"; do + run "${push}" "${target}" done fi From e371605f1324bcf82b6a8c6bd32ad2865471ac3b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 06:10:12 +0100 Subject: [PATCH 57/89] Always load image. --- build-docker-image.sh | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/build-docker-image.sh b/build-docker-image.sh index 8613ea07d..af7f283ed 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -57,11 +57,10 @@ run() { # Local development. tags+=("${image_name}:local") - build_args+=(--load) ;; esac - build_args+=(--pull --cache-from 'type=gha' --cache-to 'type=gha,mode=max') + build_args+=(--pull --load --cache-from 'type=gha' --cache-to 'type=gha,mode=max') for tag in "${tags[@]}"; do build_args+=(--tag "${tag}") From 06842b52753fc5fad5731ab27eb5d637c43d23a2 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 06:28:16 +0100 Subject: [PATCH 58/89] Show CI result. --- .github/workflows/ci.yml | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5be348b57..91abae2ee 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,9 +7,12 @@ jobs: name: CI needs: [shellcheck, test, fmt] runs-on: ubuntu-latest - steps: - - name: I Complete - run: exit 0 + steps: + - name: Result + run: | + jq -C <<< "${needs}" + env: + needs: ${{ toJson(needs) }} shellcheck: runs-on: ubuntu-latest steps: From 5674ddc5e0339fae73311b1f50f7ba4c13bfdd1b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 06:32:37 +0100 Subject: [PATCH 59/89] Disable `CROSS_DEBUG` and show more log lines by default. --- .github/workflows/docker.yml | 3 --- docker/linux-runner | 4 ++-- 2 files changed, 2 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index a88d3e4b4..85cd13499 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -6,9 +6,6 @@ on: name: Docker Build -env: - CROSS_DEBUG: '1' - jobs: docker-build: needs: [docker-builds] diff --git a/docker/linux-runner b/docker/linux-runner index 57e79fdab..2ef0efc67 100755 --- a/docker/linux-runner +++ b/docker/linux-runner @@ -156,8 +156,8 @@ esac else echo "Qemu is not ready after ${SECONDS} seconds..." echo "Set the environment variable CROSS_DEBUG=1 to debug" - echo "Last 10 lines of qemu output:" - tail "${LOG}" + echo "Last 100 lines of qemu output:" + tail -n 100 "${LOG}" exit 1 fi fi From eeba99b03f6913e0f0cbd9bfbb89761fe6e76668 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 06:41:38 +0100 Subject: [PATCH 60/89] Add cache args only on GitHub Actions. --- build-docker-image.sh | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/build-docker-image.sh b/build-docker-image.sh index af7f283ed..5372ddd52 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -60,7 +60,14 @@ run() { ;; esac - build_args+=(--pull --load --cache-from 'type=gha' --cache-to 'type=gha,mode=max') + build_args+=(--pull --load) + + if [[ -n "${GITHUB_ACTIONS-}" ]]; then + build_args+=( + --cache-from 'type=gha' + --cache-to 'type=gha,mode=max' + ) + fi for tag in "${tags[@]}"; do build_args+=(--tag "${tag}") From d02c97c2d562e1e21e4664e1d7c41868cbc42a56 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 07:01:09 +0100 Subject: [PATCH 61/89] Pass actions URL to Buildkit. --- .github/workflows/docker.yml | 4 +++- build-docker-image.sh | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 85cd13499..1063eb0fa 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -345,7 +345,9 @@ jobs: - name: Set up Docker Buildx if: runner.os == 'Linux' uses: docker/setup-buildx-action@v1 - - name: Build Docker image + - name: Expose GitHub runtime + uses: crazy-max/ghaction-github-runtime@v1.0.0 + - name: Build and push Docker image id: build-docker-image if: runner.os == 'Linux' timeout-minutes: 60 diff --git a/build-docker-image.sh b/build-docker-image.sh index 5372ddd52..368f42160 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -64,8 +64,8 @@ run() { if [[ -n "${GITHUB_ACTIONS-}" ]]; then build_args+=( - --cache-from 'type=gha' - --cache-to 'type=gha,mode=max' + --cache-from "type=gha,url=${ACTIONS_CACHE_URL},token=${ACTIONS_RUNTIME_TOKEN}" + --cache-to "type=gha,mode=max,url=${ACTIONS_CACHE_URL},token=${ACTIONS_RUNTIME_TOKEN}" ) fi From a633d558ca721e1cc141d751f489dbbd2b2fe22e Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 08:07:32 +0100 Subject: [PATCH 62/89] Use shorter job name. --- .github/workflows/docker.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1063eb0fa..9d728fc1d 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -14,7 +14,7 @@ jobs: - name: Docker builds done run: exit 0 docker-builds: - name: Docker Build ${{ matrix.target }} ${{matrix.os}} ${{matrix.toolchain}} + name: ${{ matrix.target }} runs-on: ${{ matrix.os }} env: CARGO_NET_RETRY: 3 From 26bb6d696a8af0fceb4c03b9baea263da29f91b8 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 08:08:16 +0100 Subject: [PATCH 63/89] Add skippable job to `ci` workflow. --- .github/workflows/ci.yml | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 91abae2ee..a5cd5d449 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -3,16 +3,6 @@ on: [pull_request, push] name: CI jobs: - ci: - name: CI - needs: [shellcheck, test, fmt] - runs-on: ubuntu-latest - steps: - - name: Result - run: | - jq -C <<< "${needs}" - env: - needs: ${{ toJson(needs) }} shellcheck: runs-on: ubuntu-latest steps: @@ -61,3 +51,21 @@ jobs: with: command: fmt args: -- --check + docker-test: + runs-on: ubuntu-latest + if: github.event_name != 'pull_request' + steps: + - run: 'true' + ci: + name: CI + needs: [shellcheck, test, fmt, docker-test] + if: always() + runs-on: ubuntu-latest + steps: + - name: Result + run: | + jq -C <<< "${needs}" + + "$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")" + env: + needs: ${{ toJson(needs) }} From b36916fa67c4bcf4b63f373e7deb98e8d986f25a Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 08:34:51 +0100 Subject: [PATCH 64/89] Add Rust cache action. --- .github/workflows/ci.yml | 52 +++++++++++++++++++++++++--------------- 1 file changed, 33 insertions(+), 19 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a5cd5d449..478660b1c 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -6,9 +6,31 @@ jobs: shellcheck: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: ShellCheck + - uses: actions/checkout@v3 + + - name: Run ShellCheck uses: azohra/shell-linter@v0.3.0 + + fmt: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.58.1 + profile: minimal + components: rustfmt + + - uses: Swatinem/rust-cache@v1.3.0 + + - name: rustfmt -- --check + uses: actions-rs/cargo@v1 + with: + command: fmt + args: -- --check + test: runs-on: ${{ matrix.os }} strategy: @@ -18,44 +40,36 @@ jobs: - ubuntu-latest - windows-latest steps: - - uses: actions/checkout@v2 - - name: install rust + - uses: actions/checkout@v3 + + - name: Install Rust uses: actions-rs/toolchain@v1 with: toolchain: 1.58.1 profile: minimal components: clippy + + - uses: Swatinem/rust-cache@v1.3.0 + - name: Run unit tests uses: actions-rs/cargo@v1 with: command: test args: --locked timeout-minutes: 5 + - name: Run clippy uses: actions-rs/cargo@v1 with: command: clippy args: --locked - fmt: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - name: install rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.58.1 - profile: minimal - components: rustfmt - - name: rustfmt -- --check - uses: actions-rs/cargo@v1 - with: - command: fmt - args: -- --check + docker-test: runs-on: ubuntu-latest if: github.event_name != 'pull_request' steps: - run: 'true' + ci: name: CI needs: [shellcheck, test, fmt, docker-test] From 02dc2db0a98b095df0975db7d4f3ad0be1e3eb75 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 08:37:59 +0100 Subject: [PATCH 65/89] Split `clippy` into separate job. --- .github/workflows/ci.yml | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 478660b1c..123d74490 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -31,8 +31,29 @@ jobs: command: fmt args: -- --check + clippy: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: 1.58.1 + profile: minimal + components: rustfmt + + - uses: Swatinem/rust-cache@v1.3.0 + + - name: Run clippy + uses: actions-rs/cargo@v1 + with: + command: clippy + args: --locked + test: runs-on: ${{ matrix.os }} + needs: [fmt, clippy] strategy: matrix: os: @@ -58,21 +79,16 @@ jobs: args: --locked timeout-minutes: 5 - - name: Run clippy - uses: actions-rs/cargo@v1 - with: - command: clippy - args: --locked - docker-test: runs-on: ubuntu-latest + needs: [shellcheck] if: github.event_name != 'pull_request' steps: - run: 'true' ci: name: CI - needs: [shellcheck, test, fmt, docker-test] + needs: [test, docker-test] if: always() runs-on: ubuntu-latest steps: From d1959de44b2dec5cfdaf48f4fc84230af4a6ceb2 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 08:52:37 +0100 Subject: [PATCH 66/89] Merge `docker` workflow into `ci` workflow. --- .github/bors.toml | 2 +- .github/workflows/ci.yml | 413 ++++++++++++++++++++++++++++++++++- .github/workflows/docker.yml | 402 ---------------------------------- 3 files changed, 405 insertions(+), 412 deletions(-) delete mode 100644 .github/workflows/docker.yml diff --git a/.github/bors.toml b/.github/bors.toml index 949d7999e..fc2073541 100644 --- a/.github/bors.toml +++ b/.github/bors.toml @@ -1,5 +1,5 @@ block_labels = ["needs-decision"] delete_merged_branches = true required_approvals = 1 -status = ["docker-build", "CI"] +status = ["conclusion"] timeout_sec = 21600 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 123d74490..56438e87d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,16 @@ -on: [pull_request, push] +on: + pull_request: + push: + branches: [master, staging, trying] + tags: + - "v*.*.*" name: CI +env: + CARGO_NET_RETRY: 3 + CARGO_HTTP_CHECK_REVOKE: false + jobs: shellcheck: runs-on: ubuntu-latest @@ -32,7 +41,13 @@ jobs: args: -- --check clippy: - runs-on: ubuntu-latest + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: + - macos-latest + - ubuntu-latest + - windows-latest steps: - uses: actions/checkout@v3 @@ -79,16 +94,395 @@ jobs: args: --locked timeout-minutes: 5 - docker-test: - runs-on: ubuntu-latest + docker-image: + name: ${{ matrix.target }} + runs-on: ${{ matrix.os }} needs: [shellcheck] - if: github.event_name != 'pull_request' + if: github.event_name == 'push' + strategy: + fail-fast: false + matrix: + include: + - target: aarch64-unknown-linux-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: arm-unknown-linux-gnueabi + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + - target: arm-unknown-linux-gnueabihf + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + - target: armv7-unknown-linux-gnueabihf + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: i586-unknown-linux-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + - target: i686-unknown-linux-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: native qemu-user qemu-system + - target: mips-unknown-linux-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: mipsel-unknown-linux-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: mips64-unknown-linux-gnuabi64 + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + - target: mips64el-unknown-linux-gnuabi64 + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: powerpc-unknown-linux-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: powerpc64-unknown-linux-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: powerpc64le-unknown-linux-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-user qemu-system + - target: riscv64gc-unknown-linux-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + std: 1 + run: 1 + - target: s390x-unknown-linux-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-system + - target: sparc64-unknown-linux-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: qemu-system + - target: x86_64-unknown-linux-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + runners: native qemu-user qemu-system + deploy: true + cargo-publish: 1 + - target: aarch64-unknown-linux-musl + toolchain: 1.58.1 + os: ubuntu-latest + std: 1 + run: 1 + - target: arm-unknown-linux-musleabihf + toolchain: 1.58.1 + os: ubuntu-latest + std: 1 + run: 1 + - target: arm-unknown-linux-musleabi + toolchain: 1.58.1 + os: ubuntu-latest + std: 1 + run: 1 + - target: armv5te-unknown-linux-gnueabi + toolchain: 1.58.1 + os: ubuntu-latest + std: 1 + run: 1 + - target: armv5te-unknown-linux-musleabi + toolchain: 1.58.1 + os: ubuntu-latest + std: 1 + run: 1 + - target: armv7-unknown-linux-musleabihf + toolchain: 1.58.1 + os: ubuntu-latest + std: 1 + run: 1 + - target: i586-unknown-linux-musl + toolchain: 1.58.1 + os: ubuntu-latest + std: 1 + run: 1 + - target: i686-unknown-linux-musl + toolchain: 1.58.1 + os: ubuntu-latest + std: 1 + run: 1 + - target: mips-unknown-linux-musl + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + std: 1 + run: 1 + - target: mipsel-unknown-linux-musl + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + std: 1 + run: 1 + - target: x86_64-unknown-linux-musl + toolchain: 1.58.1 + os: ubuntu-latest + std: 1 + run: 1 + deploy: true + - target: aarch64-linux-android + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + std: 1 + run: 1 + - target: arm-linux-androideabi + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + std: 1 + run: 1 + - target: armv7-linux-androideabi + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + std: 1 + run: 1 + - target: i686-linux-android + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + std: 1 + run: 1 + - target: x86_64-linux-android + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + std: 1 + run: 1 + - target: x86_64-apple-darwin + toolchain: 1.58.1 + os: macos-latest + cpp: 1 + dylib: 1 + std: 1 + run: 1 + deploy: true + - target: x86_64-pc-windows-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + std: 1 + run: 1 + - target: i686-pc-windows-gnu + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + std: 1 + run: 1 + # Disabled, see #396 + # - target: x86_64-unknown-dragonfly + # toolchain: nightly + # os: ubuntu-latest + # cpp: 1 + # dylib: 1 + - target: i686-unknown-freebsd + toolchain: 1.58.1 + os: ubuntu-latest + dylib: 1 + std: 1 + - target: x86_64-unknown-freebsd + toolchain: 1.58.1 + os: ubuntu-latest + dylib: 1 + std: 1 + - target: x86_64-unknown-netbsd + toolchain: 1.58.1 + os: ubuntu-latest + cpp: 1 + dylib: 1 + std: 1 + # Disabled, see #534 + # - target: sparcv9-sun-solaris + # toolchain: 1.58.1 + # os: ubuntu-latest + # cpp: 1 + # dylib: 1 + # std: 1 + # - target: x86_64-sun-solaris + # toolchain: 1.58.1 + # os: ubuntu-latest + # cpp: 1 + # dylib: 1 + # std: 1 + # Disabled, see #634 + #- target: asmjs-unknown-emscripten + # toolchain: 1.58.1 + # os: ubuntu-latest + # std: 1 + # run: 1 + # `cargo run` fails with an assertion error (https://github.com/rust-lang/cargo/issues/4689) on `wasm32-unknown-emscripten`. + # - target: wasm32-unknown-emscripten + # toolchain: 1.58.1 + # os: ubuntu-latest + # std: 1 + - target: thumbv6m-none-eabi + toolchain: 1.58.1 + os: ubuntu-latest + std: 1 + - target: thumbv7em-none-eabi + toolchain: 1.58.1 + os: ubuntu-latest + std: 1 + - target: thumbv7em-none-eabihf + toolchain: 1.58.1 + os: ubuntu-latest + std: 1 + - target: thumbv7m-none-eabi + toolchain: 1.58.1 + os: ubuntu-latest + std: 1 + - target: x86_64-pc-windows-msvc + toolchain: 1.58.1 + os: windows-latest + cpp: 1 + std: 1 + run: 1 + deploy: true + steps: - - run: 'true' + - uses: actions/checkout@v2 + - name: install rust + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.toolchain }} + target: ${{ matrix.target }} + default: true + profile: minimal + - name: Set up Docker Buildx + if: runner.os == 'Linux' + uses: docker/setup-buildx-action@v1 + - name: Expose GitHub runtime + uses: crazy-max/ghaction-github-runtime@v1.0.0 + - name: Build and push Docker image + id: build-docker-image + if: runner.os == 'Linux' + timeout-minutes: 60 + run: ./build-docker-image.sh "${TARGET}" + env: + TARGET: ${{ matrix.target }} + shell: bash + - name: Set Docker image for test + if: steps.build-docker-image.outputs.image + run: | + TARGET_VAR="cross_target_${TARGET//-/_}_image" + echo "${TARGET_VAR^^}=${IMAGE}" | tee -a "${GITHUB_ENV}" + env: + TARGET: ${{ matrix.target }} + IMAGE: ${{ steps.build-docker-image.outputs.image }} + shell: bash + - name: Test + if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/trying' + run: ./ci/test.sh + env: + TARGET: ${{ matrix.target }} + CPP: ${{ matrix.cpp }} + DYLIB: ${{ matrix.dylib }} + STD: ${{ matrix.std }} + RUN: ${{ matrix.run }} + RUNNERS: ${{ matrix.runners }} + shell: bash + - name: Publish on crates.io + if: matrix.cargo-publish + env: + CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + uses: actions-rs/cargo@v1 + with: + command: publish + args: ${{ (!startsWith(github.ref, 'refs/tags/v') && '--dry-run') || '' }} + - name: Create GitHub Release + if: matrix.deploy && startsWith(github.ref, 'refs/tags/v') + # TODO: Not sure what package to use for this step. + run: echo "TODO"; exit 1 + - name: Login to GitHub Container Registry + if: runner.os == 'Linux' + uses: docker/login-action@v1 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + - name: Push image to GitHub Container Registry + if: runner.os == 'Linux' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) + run: ./build-docker-image.sh --push "${TARGET}" + env: + TARGET: ${{ matrix.target }} + shell: bash - ci: - name: CI - needs: [test, docker-test] + conclusion: + needs: [shellcheck, fmt, clippy, test, docker-image] if: always() runs-on: ubuntu-latest steps: @@ -96,6 +490,7 @@ jobs: run: | jq -C <<< "${needs}" + # Check if all needs were successfull or skipped. "$(jq -r 'all(.result as $result | (["success", "skipped"] | contains([$result])))' <<< "${needs}")" env: needs: ${{ toJson(needs) }} diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml deleted file mode 100644 index 9d728fc1d..000000000 --- a/.github/workflows/docker.yml +++ /dev/null @@ -1,402 +0,0 @@ -on: - push: - branches: [master, staging, trying] - tags: - - "v*.*.*" - -name: Docker Build - -jobs: - docker-build: - needs: [docker-builds] - runs-on: ubuntu-latest - steps: - - name: Docker builds done - run: exit 0 - docker-builds: - name: ${{ matrix.target }} - runs-on: ${{ matrix.os }} - env: - CARGO_NET_RETRY: 3 - CARGO_HTTP_CHECK_REVOKE: false - strategy: - fail-fast: false - matrix: - include: - - target: aarch64-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: arm-unknown-linux-gnueabi - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - - target: arm-unknown-linux-gnueabihf - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - - target: armv7-unknown-linux-gnueabihf - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: i586-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - - target: i686-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: native qemu-user qemu-system - - target: mips-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: mipsel-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: mips64-unknown-linux-gnuabi64 - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - - target: mips64el-unknown-linux-gnuabi64 - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: powerpc-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: powerpc64-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: powerpc64le-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: riscv64gc-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: s390x-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-system - - target: sparc64-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-system - - target: x86_64-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: native qemu-user qemu-system - deploy: true - cargo-publish: 1 - - target: aarch64-unknown-linux-musl - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: arm-unknown-linux-musleabihf - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: arm-unknown-linux-musleabi - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: armv5te-unknown-linux-gnueabi - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: armv5te-unknown-linux-musleabi - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: armv7-unknown-linux-musleabihf - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: i586-unknown-linux-musl - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: i686-unknown-linux-musl - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: mips-unknown-linux-musl - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: mipsel-unknown-linux-musl - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: x86_64-unknown-linux-musl - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - deploy: true - - target: aarch64-linux-android - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: arm-linux-androideabi - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: armv7-linux-androideabi - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: i686-linux-android - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: x86_64-linux-android - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: x86_64-apple-darwin - toolchain: 1.58.1 - os: macos-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - deploy: true - - target: x86_64-pc-windows-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: i686-pc-windows-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - # Disabled, see #396 - # - target: x86_64-unknown-dragonfly - # toolchain: nightly - # os: ubuntu-latest - # cpp: 1 - # dylib: 1 - - target: i686-unknown-freebsd - toolchain: 1.58.1 - os: ubuntu-latest - dylib: 1 - std: 1 - - target: x86_64-unknown-freebsd - toolchain: 1.58.1 - os: ubuntu-latest - dylib: 1 - std: 1 - - target: x86_64-unknown-netbsd - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - # Disabled, see #534 - # - target: sparcv9-sun-solaris - # toolchain: 1.58.1 - # os: ubuntu-latest - # cpp: 1 - # dylib: 1 - # std: 1 - # - target: x86_64-sun-solaris - # toolchain: 1.58.1 - # os: ubuntu-latest - # cpp: 1 - # dylib: 1 - # std: 1 - # Disabled, see #634 - #- target: asmjs-unknown-emscripten - # toolchain: 1.58.1 - # os: ubuntu-latest - # std: 1 - # run: 1 - # `cargo run` fails with an assertion error (https://github.com/rust-lang/cargo/issues/4689) on `wasm32-unknown-emscripten`. - # - target: wasm32-unknown-emscripten - # toolchain: 1.58.1 - # os: ubuntu-latest - # std: 1 - - target: thumbv6m-none-eabi - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - - target: thumbv7em-none-eabi - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - - target: thumbv7em-none-eabihf - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - - target: thumbv7m-none-eabi - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - - target: x86_64-pc-windows-msvc - toolchain: 1.58.1 - os: windows-latest - cpp: 1 - std: 1 - run: 1 - deploy: true - - steps: - - uses: actions/checkout@v2 - - name: install rust - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - target: ${{ matrix.target }} - default: true - profile: minimal - - name: Set up Docker Buildx - if: runner.os == 'Linux' - uses: docker/setup-buildx-action@v1 - - name: Expose GitHub runtime - uses: crazy-max/ghaction-github-runtime@v1.0.0 - - name: Build and push Docker image - id: build-docker-image - if: runner.os == 'Linux' - timeout-minutes: 60 - run: ./build-docker-image.sh "${TARGET}" - env: - TARGET: ${{ matrix.target }} - shell: bash - - name: Set Docker image for test - if: steps.build-docker-image.outputs.image - run: | - TARGET_VAR="cross_target_${TARGET//-/_}_image" - echo "${TARGET_VAR^^}=${IMAGE}" | tee -a "${GITHUB_ENV}" - env: - TARGET: ${{ matrix.target }} - IMAGE: ${{ steps.build-docker-image.outputs.image }} - shell: bash - - name: Test - if: github.ref == 'refs/heads/staging' || github.ref == 'refs/heads/trying' - run: ./ci/test.sh - env: - TARGET: ${{ matrix.target }} - CPP: ${{ matrix.cpp }} - DYLIB: ${{ matrix.dylib }} - STD: ${{ matrix.std }} - RUN: ${{ matrix.run }} - RUNNERS: ${{ matrix.runners }} - shell: bash - - name: Publish on crates.io - if: matrix.cargo-publish - env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} - uses: actions-rs/cargo@v1 - with: - command: publish - args: ${{ (!startsWith(github.ref, 'refs/tags/v') && '--dry-run') || '' }} - - name: Create GitHub Release - if: matrix.deploy && startsWith(github.ref, 'refs/tags/v') - # TODO: Not sure what package to use for this step. - run: echo "TODO"; exit 1 - - name: Login to GitHub Container Registry - if: runner.os == 'Linux' - uses: docker/login-action@v1 - with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} - - name: Push image to GitHub Container Registry - if: runner.os == 'Linux' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) - run: ./build-docker-image.sh --push "${TARGET}" - env: - TARGET: ${{ matrix.target }} - shell: bash From 24379f7a022823e6c823d7040aa28558dfbfff98 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 09:04:58 +0100 Subject: [PATCH 67/89] Fix `clippy` installation. --- .github/workflows/ci.yml | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 56438e87d..c6c90763d 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -56,7 +56,7 @@ jobs: with: toolchain: 1.58.1 profile: minimal - components: rustfmt + components: clippy - uses: Swatinem/rust-cache@v1.3.0 @@ -83,7 +83,6 @@ jobs: with: toolchain: 1.58.1 profile: minimal - components: clippy - uses: Swatinem/rust-cache@v1.3.0 @@ -95,7 +94,7 @@ jobs: timeout-minutes: 5 docker-image: - name: ${{ matrix.target }} + name: docker-image (${{ matrix.target }}) runs-on: ${{ matrix.os }} needs: [shellcheck] if: github.event_name == 'push' From ae0bf3198b91e7fa17faf53c7500c414294afb57 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 09:26:54 +0100 Subject: [PATCH 68/89] Add action for setting up Rust. --- .github/actions/setup-rust/action.yml | 25 +++++++++++++++++++ .github/workflows/ci.yml | 36 ++++++--------------------- 2 files changed, 33 insertions(+), 28 deletions(-) create mode 100644 .github/actions/setup-rust/action.yml diff --git a/.github/actions/setup-rust/action.yml b/.github/actions/setup-rust/action.yml new file mode 100644 index 000000000..841eadaef --- /dev/null +++ b/.github/actions/setup-rust/action.yml @@ -0,0 +1,25 @@ +inputs: + toolchain: + description: 'Toolchain' + default: 1.58.1 + type: string + target: + description: 'Target' + type: string + components: + description: 'Components' + type: string + +runs: + using: composite + steps: + - name: Install Rust toolchain + uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ inputs.toolchain }} + target: ${{ inputs.target }} + default: true + components: ${{ inputs.components }} + profile: minimal + + - uses: Swatinem/rust-cache@v1.3.0 diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c6c90763d..7172cc2ef 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -25,16 +25,11 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install Rust - uses: actions-rs/toolchain@v1 + - uses: ./.github/actions/setup-rust with: - toolchain: 1.58.1 - profile: minimal components: rustfmt - - uses: Swatinem/rust-cache@v1.3.0 - - - name: rustfmt -- --check + - name: Run rustfmt uses: actions-rs/cargo@v1 with: command: fmt @@ -51,15 +46,10 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install Rust - uses: actions-rs/toolchain@v1 + - uses: ./.github/actions/setup-rust with: - toolchain: 1.58.1 - profile: minimal components: clippy - - uses: Swatinem/rust-cache@v1.3.0 - - name: Run clippy uses: actions-rs/cargo@v1 with: @@ -78,13 +68,7 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Install Rust - uses: actions-rs/toolchain@v1 - with: - toolchain: 1.58.1 - profile: minimal - - - uses: Swatinem/rust-cache@v1.3.0 + - uses: ./.github/actions/setup-rust - name: Run unit tests uses: actions-rs/cargo@v1 @@ -413,14 +397,10 @@ jobs: deploy: true steps: - - uses: actions/checkout@v2 - - name: install rust - uses: actions-rs/toolchain@v1 - with: - toolchain: ${{ matrix.toolchain }} - target: ${{ matrix.target }} - default: true - profile: minimal + - uses: actions/checkout@v3 + + - uses: ./.github/actions/setup-rust + - name: Set up Docker Buildx if: runner.os == 'Linux' uses: docker/setup-buildx-action@v1 From 746131dd1a7a7de79f31b848a11a7c9d0b12e3b4 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 09:56:41 +0100 Subject: [PATCH 69/89] Docker job needs test. --- .github/workflows/ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7172cc2ef..9816fed93 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -80,7 +80,7 @@ jobs: docker-image: name: docker-image (${{ matrix.target }}) runs-on: ${{ matrix.os }} - needs: [shellcheck] + needs: [shellcheck, test] if: github.event_name == 'push' strategy: fail-fast: false From 52331f52ae62a8b647ee3cb7006973b92c9b6e41 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 11:20:35 +0100 Subject: [PATCH 70/89] Add `publish` workflow. --- .github/actions/cargo-publish/action.yml | 40 ++++++++++++++++ .../actions/upload-rust-artifacts/action.yml | 47 +++++++++++++++++++ .github/workflows/ci.yml | 43 ++++++++++++----- 3 files changed, 118 insertions(+), 12 deletions(-) create mode 100644 .github/actions/cargo-publish/action.yml create mode 100644 .github/actions/upload-rust-artifacts/action.yml diff --git a/.github/actions/cargo-publish/action.yml b/.github/actions/cargo-publish/action.yml new file mode 100644 index 000000000..0b112b15b --- /dev/null +++ b/.github/actions/cargo-publish/action.yml @@ -0,0 +1,40 @@ +inputs: + cratesio-token: + description: 'API token for crates.io' + type: string + +runs: + using: composite + steps: + - name: Download artifacts + id: download-artifacts + if: needs.build.outputs.artifact + uses: actions/download-artifact@v3 + with: + path: + ${{ runner.temp }}/artifacts + + - name: Log into crates.io + if: steps.cargo-toml-publish.outputs.value != 'false' && github.event_name != 'pull_request' + uses: actions-rs/cargo@v1 + with: + command: login + args: -- ${{ inputs.cratesio-token }} + + - name: Upload GitHub release artifacts + if: > + needs.build.outputs.artifact != '' && github.event_name == 'push' && ( + github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || + startsWith(github.ref, 'refs/tags/v') + ) + uses: softprops/action-gh-release@v1 + with: + draft: ${{ !startsWith(github.ref, 'refs/tags/v') }} + files: | + ${{ steps.download-artifacts.outputs.download-path }}/*/* + + - name: Publish crate + uses: actions-rs/cargo@v1 + with: + command: publish + args: ${{ !startsWith(github.ref, 'refs/tags/v') && '--dry-run' || '' }} diff --git a/.github/actions/upload-rust-artifacts/action.yml b/.github/actions/upload-rust-artifacts/action.yml new file mode 100644 index 000000000..eb99f7f9e --- /dev/null +++ b/.github/actions/upload-rust-artifacts/action.yml @@ -0,0 +1,47 @@ +inputs: + target: + description: 'Target' + type: string + +runs: + using: composite + steps: + - name: Archive artifacts + id: artifact + run: | + set -x + + target_dir="target/${target}/release/" + + metadata="$(cargo metadata --format-version 1 --no-deps)" + package_name="$(jq -r '.packages[0].name' <<< "${metadata}")" + files="$(jq "[.packages[0].targets[] | select(.kind[] | contains(\"bin\")) | .name]" <<< "${metadata}")" + + if [[ $(jq -r 'length' <<< "${files}") -eq 0 ]]; then + exit + fi + + artifact_name="${package_name}-${target}" + artifacts_dir="artifacts" + artifact_path="${artifacts_dir}/${artifact_name}.tar.gz" + + mkdir "${artifacts_dir}" + + jq -r '.[]' <<< "${files}" | \ + tar -cvzf "${artifact_path}" -C "${target_dir}" -T - + + tar -tf "${artifact_path}" + ls -al "${artifact_path}" + + echo "::set-output name=name::${artifact_name}" + echo "::set-output name=path::${artifact_path}" + env: + target: ${{ inputs.target }} + + - name: Upload artifacts + if: ${{ steps.artifact.outputs.path }} + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.artifact.outputs.name }} + path: ${{ steps.artifact.outputs.path }} + if-no-files-found: error diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9816fed93..7f2d6327e 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -217,7 +217,6 @@ jobs: run: 1 runners: native qemu-user qemu-system deploy: true - cargo-publish: 1 - target: aarch64-unknown-linux-musl toolchain: 1.58.1 os: ubuntu-latest @@ -434,18 +433,28 @@ jobs: RUN: ${{ matrix.run }} RUNNERS: ${{ matrix.runners }} shell: bash - - name: Publish on crates.io - if: matrix.cargo-publish - env: - CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }} + + - name: Install cross + if: matrix.deploy + run: cargo install --path . --force + + - name: Build with all features + if: matrix.deploy uses: actions-rs/cargo@v1 with: - command: publish - args: ${{ (!startsWith(github.ref, 'refs/tags/v') && '--dry-run') || '' }} - - name: Create GitHub Release - if: matrix.deploy && startsWith(github.ref, 'refs/tags/v') - # TODO: Not sure what package to use for this step. - run: echo "TODO"; exit 1 + command: build + args: > + --release + --target ${{ matrix.target }} + --all-features + use-cross: true + + - uses: ./.github/actions/upload-rust-artifacts + if: matrix.deploy + with: + target: ${{ matrix.target }} + + - name: Login to GitHub Container Registry if: runner.os == 'Linux' uses: docker/login-action@v1 @@ -453,6 +462,7 @@ jobs: registry: ghcr.io username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} + - name: Push image to GitHub Container Registry if: runner.os == 'Linux' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) run: ./build-docker-image.sh --push "${TARGET}" @@ -460,8 +470,17 @@ jobs: TARGET: ${{ matrix.target }} shell: bash + publish: + needs: [docker-image] + steps: + - uses: actions/checkout@v3 + - uses: ./.github/actions/setup-rust + - uses: ./.github/actions/cargo-publish + with: + cratesio-token: ${{ secrets.CRATESIO_TOKEN }} + conclusion: - needs: [shellcheck, fmt, clippy, test, docker-image] + needs: [shellcheck, fmt, clippy, test, docker-image, publish] if: always() runs-on: ubuntu-latest steps: From bcced71461a600e3d00af726988740fbab86a4e8 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 11:38:50 +0100 Subject: [PATCH 71/89] Read changelog for release notes. --- .github/actions/cargo-publish/action.yml | 14 +++++++++++++- .github/workflows/ci.yml | 1 + 2 files changed, 14 insertions(+), 1 deletion(-) diff --git a/.github/actions/cargo-publish/action.yml b/.github/actions/cargo-publish/action.yml index 0b112b15b..b55275f0f 100644 --- a/.github/actions/cargo-publish/action.yml +++ b/.github/actions/cargo-publish/action.yml @@ -6,6 +6,14 @@ inputs: runs: using: composite steps: + - name: Read changelog + id: changelog-reader + uses: mindsers/changelog-reader-action@v2.0.0 + with: + validation_depth: 10 + version: ${{ (github.ref_type == 'tag' && github.ref_name) || 'Unreleased' }} + path: ./CHANGELOG.md + - name: Download artifacts id: download-artifacts if: needs.build.outputs.artifact @@ -29,7 +37,11 @@ runs: ) uses: softprops/action-gh-release@v1 with: - draft: ${{ !startsWith(github.ref, 'refs/tags/v') }} + tag: ${{ steps.changelog-reader.outputs.version }} + name: ${{ steps.changelog-reader.outputs.version }} + body: ${{ steps.changelog-reader.outputs.changes }} + prerelease: ${{ steps.changelog-reader.outputs.status == 'prereleased' }} + draft: ${{ steps.changelog-reader.outputs.status == 'unreleased' }} files: | ${{ steps.download-artifacts.outputs.download-path }}/*/* diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 7f2d6327e..cdbecf165 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -472,6 +472,7 @@ jobs: publish: needs: [docker-image] + runs-on: ubuntu-latest steps: - uses: actions/checkout@v3 - uses: ./.github/actions/setup-rust From 3bf7a05d6e514bff6c6a04be8a3e940d447db78b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 12:25:38 +0100 Subject: [PATCH 72/89] Reorder and minify build matrix. --- .github/workflows/ci.yml | 354 ++++++--------------------------------- 1 file changed, 50 insertions(+), 304 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index cdbecf165..c1650b142 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,314 +86,60 @@ jobs: fail-fast: false matrix: include: - - target: aarch64-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: arm-unknown-linux-gnueabi - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - - target: arm-unknown-linux-gnueabihf - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - - target: armv7-unknown-linux-gnueabihf - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: i586-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - - target: i686-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: native qemu-user qemu-system - - target: mips-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: mipsel-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: mips64-unknown-linux-gnuabi64 - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - - target: mips64el-unknown-linux-gnuabi64 - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: powerpc-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: powerpc64-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: powerpc64le-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-user qemu-system - - target: riscv64gc-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: s390x-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-system - - target: sparc64-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: qemu-system - - target: x86_64-unknown-linux-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - runners: native qemu-user qemu-system - deploy: true - - target: aarch64-unknown-linux-musl - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: arm-unknown-linux-musleabihf - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: arm-unknown-linux-musleabi - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: armv5te-unknown-linux-gnueabi - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: armv5te-unknown-linux-musleabi - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: armv7-unknown-linux-musleabihf - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: i586-unknown-linux-musl - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: i686-unknown-linux-musl - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - - target: mips-unknown-linux-musl - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: mipsel-unknown-linux-musl - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: x86_64-unknown-linux-musl - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - run: 1 - deploy: true - - target: aarch64-linux-android - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: arm-linux-androideabi - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: armv7-linux-androideabi - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: i686-linux-android - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: x86_64-linux-android - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: x86_64-apple-darwin - toolchain: 1.58.1 - os: macos-latest - cpp: 1 - dylib: 1 - std: 1 - run: 1 - deploy: true - - target: x86_64-pc-windows-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 - - target: i686-pc-windows-gnu - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - std: 1 - run: 1 + - { target: x86_64-apple-darwin, toolchain: 1.58.1, os: macos-latest, cpp: 1, dylib: 1, std: 1, run: 1, deploy: true } + - { target: x86_64-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: native qemu-user qemu-system, deploy: true } + - { target: x86_64-unknown-linux-musl, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1, deploy: true } + - { target: x86_64-pc-windows-msvc, toolchain: 1.58.1, os: windows-latest, cpp: 1, std: 1, run: 1, deploy: true } + + - { target: aarch64-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: arm-unknown-linux-gnueabi, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 } + - { target: arm-unknown-linux-gnueabihf, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 } + - { target: armv7-unknown-linux-gnueabihf, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: i586-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 } + - { target: i686-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: native qemu-user qemu-system } + - { target: mips-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: mipsel-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: mips64-unknown-linux-gnuabi64, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 } + - { target: mips64el-unknown-linux-gnuabi64, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: powerpc-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: powerpc64-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: powerpc64le-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: riscv64gc-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: s390x-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-system } + - { target: sparc64-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-system } + - { target: aarch64-unknown-linux-musl, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } + - { target: arm-unknown-linux-musleabihf, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } + - { target: arm-unknown-linux-musleabi, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } + - { target: armv5te-unknown-linux-gnueabi, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } + - { target: armv5te-unknown-linux-musleabi, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } + - { target: armv7-unknown-linux-musleabihf, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } + - { target: i586-unknown-linux-musl, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } + - { target: i686-unknown-linux-musl, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } + - { target: mips-unknown-linux-musl, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: mipsel-unknown-linux-musl, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: aarch64-linux-android, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: arm-linux-androideabi, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: armv7-linux-androideabi, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: i686-linux-android, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: x86_64-linux-android, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: x86_64-pc-windows-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: i686-pc-windows-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } # Disabled, see #396 - # - target: x86_64-unknown-dragonfly - # toolchain: nightly - # os: ubuntu-latest - # cpp: 1 - # dylib: 1 - - target: i686-unknown-freebsd - toolchain: 1.58.1 - os: ubuntu-latest - dylib: 1 - std: 1 - - target: x86_64-unknown-freebsd - toolchain: 1.58.1 - os: ubuntu-latest - dylib: 1 - std: 1 - - target: x86_64-unknown-netbsd - toolchain: 1.58.1 - os: ubuntu-latest - cpp: 1 - dylib: 1 - std: 1 + #-{ target: x86_64-unknown-dragonfly, toolchain: nightly, os: ubuntu-latest, cpp: 1, dylib: 1 } + - { target: i686-unknown-freebsd, toolchain: 1.58.1, os: ubuntu-latest, dylib: 1, std: 1 } + - { target: x86_64-unknown-freebsd, toolchain: 1.58.1, os: ubuntu-latest, dylib: 1, std: 1 } + - { target: x86_64-unknown-netbsd, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1 } # Disabled, see #534 - # - target: sparcv9-sun-solaris - # toolchain: 1.58.1 - # os: ubuntu-latest - # cpp: 1 - # dylib: 1 - # std: 1 - # - target: x86_64-sun-solaris - # toolchain: 1.58.1 - # os: ubuntu-latest - # cpp: 1 - # dylib: 1 - # std: 1 + #-{ target: sparcv9-sun-solaris, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1 } + #-{ target: x86_64-sun-solaris, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1 } # Disabled, see #634 - #- target: asmjs-unknown-emscripten - # toolchain: 1.58.1 - # os: ubuntu-latest - # std: 1 - # run: 1 + #-{ target: asmjs-unknown-emscripten, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } # `cargo run` fails with an assertion error (https://github.com/rust-lang/cargo/issues/4689) on `wasm32-unknown-emscripten`. - # - target: wasm32-unknown-emscripten - # toolchain: 1.58.1 - # os: ubuntu-latest - # std: 1 - - target: thumbv6m-none-eabi - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - - target: thumbv7em-none-eabi - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - - target: thumbv7em-none-eabihf - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - - target: thumbv7m-none-eabi - toolchain: 1.58.1 - os: ubuntu-latest - std: 1 - - target: x86_64-pc-windows-msvc - toolchain: 1.58.1 - os: windows-latest - cpp: 1 - std: 1 - run: 1 - deploy: true + #-{ target: wasm32-unknown-emscripten, toolchain: 1.58.1, os: ubuntu-latest, std: 1 } + - { target: thumbv6m-none-eabi, toolchain: 1.58.1, os: ubuntu-latest, std: 1 } + - { target: thumbv7em-none-eabi, toolchain: 1.58.1, os: ubuntu-latest, std: 1 } + - { target: thumbv7em-none-eabihf, toolchain: 1.58.1, os: ubuntu-latest, std: 1 } + - { target: thumbv7m-none-eabi, toolchain: 1.58.1, os: ubuntu-latest, std: 1 } steps: - uses: actions/checkout@v3 From 4ed0f12f3e88c0fef28ddf11f4b1d2652eb4dae3 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 12:26:56 +0100 Subject: [PATCH 73/89] Add missing `shell`. --- .github/actions/upload-rust-artifacts/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/upload-rust-artifacts/action.yml b/.github/actions/upload-rust-artifacts/action.yml index eb99f7f9e..acf26515c 100644 --- a/.github/actions/upload-rust-artifacts/action.yml +++ b/.github/actions/upload-rust-artifacts/action.yml @@ -37,6 +37,7 @@ runs: echo "::set-output name=path::${artifact_path}" env: target: ${{ inputs.target }} + shell: bash - name: Upload artifacts if: ${{ steps.artifact.outputs.path }} From 9dbe91afa7a9914051b44ce430a580c86bc10f74 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 14:03:11 +0100 Subject: [PATCH 74/89] Fix upload of `.exe` binaries. --- .../cargo-install-upload-artifacts/action.yml | 66 +++++++++++++++++++ .../actions/upload-rust-artifacts/action.yml | 48 -------------- .github/workflows/ci.yml | 14 +--- 3 files changed, 67 insertions(+), 61 deletions(-) create mode 100644 .github/actions/cargo-install-upload-artifacts/action.yml delete mode 100644 .github/actions/upload-rust-artifacts/action.yml diff --git a/.github/actions/cargo-install-upload-artifacts/action.yml b/.github/actions/cargo-install-upload-artifacts/action.yml new file mode 100644 index 000000000..6f66e83b7 --- /dev/null +++ b/.github/actions/cargo-install-upload-artifacts/action.yml @@ -0,0 +1,66 @@ +inputs: + target: + description: 'Target' + type: string + +runs: + using: composite + steps: + - name: Check if crate has binaries + id: metadata + run: | + metadata="$(cargo metadata --format-version 1 --no-deps)" + + package_name="$(jq -r '.packages[0].name' <<< "${metadata}")" + has_binaries="$(jq '.packages[0].targets | any(.kind | contains(["bin"]))' <<< "${metadata}")" + echo "::set-output name=package-name::${package_name}" + echo "::set-output name=has-binaries::${has_binaries}" + echo "::set-output name=out-dir::$(mktemp -d)" + echo "::set-output name=artifacts-dir::$(mktemp -d)" + + - name: Build with all features + if: ${{ fromJson(steps.metadata.outputs.has-binaries) }} + uses: actions-rs/cargo@v1 + with: + command: install + args: > + --locked + --path . + --target ${{ inputs.target }} + --all-features + --root ${{ steps.metadata.outputs.out-dir }} + --bins + use-cross: true + + - name: Archive artifacts + if: ${{ fromJson(steps.metadata.outputs.has-binaries) }} + id: archive + run: | + set -x + + artifact_name="${package_name}-${target}" + artifact_path="${artifacts_dir}/${artifact_name}.tar.gz" + + pushd "${out_dir}" + tar -cvzf "${artifact_path}" * + popd + + tar -tf "${artifact_path}" + ls -al "${artifact_path}" + + echo "::set-output name=name::${artifact_name}" + echo "::set-output name=path::${artifact_path}" + env: + package_name: ${{ steps.metadata.outputs.package-name }} + out_dir: ${{ steps.metadata.outputs.out-dir }} + artifacts_dir: ${{ steps.metadata.outputs.artifacts-dir }} + target: ${{ inputs.target }} + shell: bash + + - name: Upload artifacts + if: ${{ steps.artifact.outputs.path }} + uses: actions/upload-artifact@v3 + with: + name: ${{ steps.archive.outputs.name }} + path: ${{ steps.archive.outputs.path }} + if-no-files-found: error diff --git a/.github/actions/upload-rust-artifacts/action.yml b/.github/actions/upload-rust-artifacts/action.yml deleted file mode 100644 index acf26515c..000000000 --- a/.github/actions/upload-rust-artifacts/action.yml +++ /dev/null @@ -1,48 +0,0 @@ -inputs: - target: - description: 'Target' - type: string - -runs: - using: composite - steps: - - name: Archive artifacts - id: artifact - run: | - set -x - - target_dir="target/${target}/release/" - - metadata="$(cargo metadata --format-version 1 --no-deps)" - package_name="$(jq -r '.packages[0].name' <<< "${metadata}")" - files="$(jq "[.packages[0].targets[] | select(.kind[] | contains(\"bin\")) | .name]" <<< "${metadata}")" - - if [[ $(jq -r 'length' <<< "${files}") -eq 0 ]]; then - exit - fi - - artifact_name="${package_name}-${target}" - artifacts_dir="artifacts" - artifact_path="${artifacts_dir}/${artifact_name}.tar.gz" - - mkdir "${artifacts_dir}" - - jq -r '.[]' <<< "${files}" | \ - tar -cvzf "${artifact_path}" -C "${target_dir}" -T - - - tar -tf "${artifact_path}" - ls -al "${artifact_path}" - - echo "::set-output name=name::${artifact_name}" - echo "::set-output name=path::${artifact_path}" - env: - target: ${{ inputs.target }} - shell: bash - - - name: Upload artifacts - if: ${{ steps.artifact.outputs.path }} - uses: actions/upload-artifact@v3 - with: - name: ${{ steps.artifact.outputs.name }} - path: ${{ steps.artifact.outputs.path }} - if-no-files-found: error diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1650b142..fbd61ec18 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -184,23 +184,11 @@ jobs: if: matrix.deploy run: cargo install --path . --force - - name: Build with all features - if: matrix.deploy - uses: actions-rs/cargo@v1 - with: - command: build - args: > - --release - --target ${{ matrix.target }} - --all-features - use-cross: true - - - uses: ./.github/actions/upload-rust-artifacts + - uses: ./.github/actions/cargo-install-upload-artifacts if: matrix.deploy with: target: ${{ matrix.target }} - - name: Login to GitHub Container Registry if: runner.os == 'Linux' uses: docker/login-action@v1 From cbf520a4deab93199037c867ae072d8b2d58a7bb Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 15:36:31 +0100 Subject: [PATCH 75/89] Add missing `shell`. --- .github/actions/cargo-install-upload-artifacts/action.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/actions/cargo-install-upload-artifacts/action.yml b/.github/actions/cargo-install-upload-artifacts/action.yml index 6f66e83b7..93b2c4f9b 100644 --- a/.github/actions/cargo-install-upload-artifacts/action.yml +++ b/.github/actions/cargo-install-upload-artifacts/action.yml @@ -17,6 +17,7 @@ runs: echo "::set-output name=has-binaries::${has_binaries}" echo "::set-output name=out-dir::$(mktemp -d)" echo "::set-output name=artifacts-dir::$(mktemp -d)" + shell: bash - name: Build with all features if: ${{ fromJson(steps.metadata.outputs.has-binaries) }} From be751d51862408bd0a51a5e92c94ddff5859a37b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sat, 12 Mar 2022 16:07:22 +0100 Subject: [PATCH 76/89] Fix archive path. --- .github/actions/cargo-install-upload-artifacts/action.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/actions/cargo-install-upload-artifacts/action.yml b/.github/actions/cargo-install-upload-artifacts/action.yml index 93b2c4f9b..714a1b4c4 100644 --- a/.github/actions/cargo-install-upload-artifacts/action.yml +++ b/.github/actions/cargo-install-upload-artifacts/action.yml @@ -42,7 +42,7 @@ runs: artifact_name="${package_name}-${target}" artifact_path="${artifacts_dir}/${artifact_name}.tar.gz" - pushd "${out_dir}" + pushd "${out_dir}/bin" tar -cvzf "${artifact_path}" * popd @@ -59,7 +59,7 @@ runs: shell: bash - name: Upload artifacts - if: ${{ steps.artifact.outputs.path }} + if: ${{ steps.archive.outputs.path }} uses: actions/upload-artifact@v3 with: name: ${{ steps.archive.outputs.name }} From db71032ddf76d54003715650aebece665016a571 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 13 Mar 2022 08:09:13 +0100 Subject: [PATCH 77/89] Update powerpc64 kernel version. --- docker/linux-image.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docker/linux-image.sh b/docker/linux-image.sh index 9c94f1663..01b595015 100755 --- a/docker/linux-image.sh +++ b/docker/linux-image.sh @@ -58,7 +58,7 @@ main() { # there is no stable port arch=ppc64 # https://packages.debian.org/en/sid/linux-image-powerpc64 - kversion='5.15.0-2' + kversion='5.16.0-4' kernel="${kversion}-powerpc64" libgcc="libgcc-s1" debsource="deb http://ftp.ports.debian.org/debian-ports unstable main" From 4852430cd46170349f5586582a0b37d87b99cdb0 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 13 Mar 2022 06:06:28 +0100 Subject: [PATCH 78/89] Fix `bin` directory on Windows. --- .../cargo-install-upload-artifacts/action.yml | 22 +++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/.github/actions/cargo-install-upload-artifacts/action.yml b/.github/actions/cargo-install-upload-artifacts/action.yml index 714a1b4c4..a7a3fc89a 100644 --- a/.github/actions/cargo-install-upload-artifacts/action.yml +++ b/.github/actions/cargo-install-upload-artifacts/action.yml @@ -15,8 +15,17 @@ runs: has_binaries="$(jq '.packages[0].targets | any(.kind | contains(["bin"]))' <<< "${metadata}")" echo "::set-output name=package-name::${package_name}" echo "::set-output name=has-binaries::${has_binaries}" - echo "::set-output name=out-dir::$(mktemp -d)" - echo "::set-output name=artifacts-dir::$(mktemp -d)" + + out_dir="$(mktemp -d)" + artifacts_dir="$(mktemp -d)" + + if which cygpath; then + out_dir="$(cygpath -w "${out_dir}")" + artifacts_dir="$(cygpath -w "${artifacts_dir}")" + fi + + echo "::set-output name=out-dir::${out_dir}" + echo "::set-output name=artifacts-dir::${artifacts_dir}" shell: bash - name: Build with all features @@ -39,6 +48,11 @@ runs: run: | set -x + if which cygpath; then + out_dir="$(cygpath -u "${out_dir}")" + artifacts_dir="$(cygpath -u "${artifacts_dir}")" + fi + artifact_name="${package_name}-${target}" artifact_path="${artifacts_dir}/${artifact_name}.tar.gz" @@ -49,6 +63,10 @@ runs: tar -tf "${artifact_path}" ls -al "${artifact_path}" + if which cygpath; then + artifact_path="$(cygpath -w "${artifact_path}")" + fi + echo "::set-output name=name::${artifact_name}" echo "::set-output name=path::${artifact_path}" env: From 4b0aedf6807b99c8f236f3c5722caf459002503b Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 13 Mar 2022 09:58:02 +0100 Subject: [PATCH 79/89] Fix publish action. --- .github/actions/cargo-publish/action.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/cargo-publish/action.yml b/.github/actions/cargo-publish/action.yml index b55275f0f..42c0146b6 100644 --- a/.github/actions/cargo-publish/action.yml +++ b/.github/actions/cargo-publish/action.yml @@ -16,7 +16,6 @@ runs: - name: Download artifacts id: download-artifacts - if: needs.build.outputs.artifact uses: actions/download-artifact@v3 with: path: @@ -28,10 +27,11 @@ runs: with: command: login args: -- ${{ inputs.cratesio-token }} + timeout-minutes: 1 - - name: Upload GitHub release artifacts + - name: Create GitHub release if: > - needs.build.outputs.artifact != '' && github.event_name == 'push' && ( + github.event_name == 'push' && ( github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || startsWith(github.ref, 'refs/tags/v') ) From d600e7ab2c43de8ed9ec8856c45f378256502c34 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 13 Mar 2022 10:25:28 +0100 Subject: [PATCH 80/89] Change secret name. --- .github/actions/cargo-publish/action.yml | 4 ++-- .github/workflows/ci.yml | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/actions/cargo-publish/action.yml b/.github/actions/cargo-publish/action.yml index 42c0146b6..43c9fbb4c 100644 --- a/.github/actions/cargo-publish/action.yml +++ b/.github/actions/cargo-publish/action.yml @@ -1,5 +1,5 @@ inputs: - cratesio-token: + cargo-registry-token: description: 'API token for crates.io' type: string @@ -26,7 +26,7 @@ runs: uses: actions-rs/cargo@v1 with: command: login - args: -- ${{ inputs.cratesio-token }} + args: -- ${{ inputs.cargo-registry-token }} timeout-minutes: 1 - name: Create GitHub release diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fbd61ec18..81910e090 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -212,7 +212,7 @@ jobs: - uses: ./.github/actions/setup-rust - uses: ./.github/actions/cargo-publish with: - cratesio-token: ${{ secrets.CRATESIO_TOKEN }} + cargo-registry-token: ${{ secrets.CARGO_REGISTRY_TOKEN }} conclusion: needs: [shellcheck, fmt, clippy, test, docker-image, publish] From c50d403e4ce1a6e93104947725179d6161ade332 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 13 Mar 2022 10:53:50 +0100 Subject: [PATCH 81/89] Increase login timeout. --- .github/actions/cargo-publish/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/cargo-publish/action.yml b/.github/actions/cargo-publish/action.yml index 43c9fbb4c..b72c51453 100644 --- a/.github/actions/cargo-publish/action.yml +++ b/.github/actions/cargo-publish/action.yml @@ -27,7 +27,7 @@ runs: with: command: login args: -- ${{ inputs.cargo-registry-token }} - timeout-minutes: 1 + timeout-minutes: 5 - name: Create GitHub release if: > From 77e9a136c1fed7ef2af93664031120cc70afc7e7 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 13 Mar 2022 11:52:16 +0100 Subject: [PATCH 82/89] Composite action does not support timeout. --- .github/actions/cargo-publish/action.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/actions/cargo-publish/action.yml b/.github/actions/cargo-publish/action.yml index b72c51453..b154df77e 100644 --- a/.github/actions/cargo-publish/action.yml +++ b/.github/actions/cargo-publish/action.yml @@ -27,7 +27,6 @@ runs: with: command: login args: -- ${{ inputs.cargo-registry-token }} - timeout-minutes: 5 - name: Create GitHub release if: > From 89ac3e217d5f13db5c34af7df35388b8eb44fd86 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 13 Mar 2022 12:50:51 +0100 Subject: [PATCH 83/89] Remove redundant `matrix.toolchain`. --- .github/workflows/ci.yml | 100 +++++++++++++++++++-------------------- 1 file changed, 50 insertions(+), 50 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 81910e090..5b9694cd3 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -86,60 +86,60 @@ jobs: fail-fast: false matrix: include: - - { target: x86_64-apple-darwin, toolchain: 1.58.1, os: macos-latest, cpp: 1, dylib: 1, std: 1, run: 1, deploy: true } - - { target: x86_64-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: native qemu-user qemu-system, deploy: true } - - { target: x86_64-unknown-linux-musl, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1, deploy: true } - - { target: x86_64-pc-windows-msvc, toolchain: 1.58.1, os: windows-latest, cpp: 1, std: 1, run: 1, deploy: true } - - - { target: aarch64-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } - - { target: arm-unknown-linux-gnueabi, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 } - - { target: arm-unknown-linux-gnueabihf, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 } - - { target: armv7-unknown-linux-gnueabihf, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } - - { target: i586-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 } - - { target: i686-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: native qemu-user qemu-system } - - { target: mips-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } - - { target: mipsel-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } - - { target: mips64-unknown-linux-gnuabi64, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 } - - { target: mips64el-unknown-linux-gnuabi64, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } - - { target: powerpc-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } - - { target: powerpc64-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } - - { target: powerpc64le-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } - - { target: riscv64gc-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } - - { target: s390x-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-system } - - { target: sparc64-unknown-linux-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-system } - - { target: aarch64-unknown-linux-musl, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } - - { target: arm-unknown-linux-musleabihf, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } - - { target: arm-unknown-linux-musleabi, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } - - { target: armv5te-unknown-linux-gnueabi, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } - - { target: armv5te-unknown-linux-musleabi, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } - - { target: armv7-unknown-linux-musleabihf, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } - - { target: i586-unknown-linux-musl, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } - - { target: i686-unknown-linux-musl, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } - - { target: mips-unknown-linux-musl, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } - - { target: mipsel-unknown-linux-musl, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } - - { target: aarch64-linux-android, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } - - { target: arm-linux-androideabi, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } - - { target: armv7-linux-androideabi, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } - - { target: i686-linux-android, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } - - { target: x86_64-linux-android, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } - - { target: x86_64-pc-windows-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } - - { target: i686-pc-windows-gnu, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: x86_64-apple-darwin, os: macos-latest, cpp: 1, dylib: 1, std: 1, run: 1, deploy: true } + - { target: x86_64-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: native qemu-user qemu-system, deploy: true } + - { target: x86_64-unknown-linux-musl, os: ubuntu-latest, std: 1, run: 1, deploy: true } + - { target: x86_64-pc-windows-msvc, os: windows-latest, cpp: 1, std: 1, run: 1, deploy: true } + + - { target: aarch64-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: arm-unknown-linux-gnueabi, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 } + - { target: arm-unknown-linux-gnueabihf, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 } + - { target: armv7-unknown-linux-gnueabihf, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: i586-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 } + - { target: i686-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: native qemu-user qemu-system } + - { target: mips-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: mipsel-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: mips64-unknown-linux-gnuabi64, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1 } + - { target: mips64el-unknown-linux-gnuabi64, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: powerpc-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: powerpc64-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: powerpc64le-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-user qemu-system } + - { target: riscv64gc-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: s390x-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-system } + - { target: sparc64-unknown-linux-gnu, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1, run: 1, runners: qemu-system } + - { target: aarch64-unknown-linux-musl, os: ubuntu-latest, std: 1, run: 1 } + - { target: arm-unknown-linux-musleabihf, os: ubuntu-latest, std: 1, run: 1 } + - { target: arm-unknown-linux-musleabi, os: ubuntu-latest, std: 1, run: 1 } + - { target: armv5te-unknown-linux-gnueabi, os: ubuntu-latest, std: 1, run: 1 } + - { target: armv5te-unknown-linux-musleabi, os: ubuntu-latest, std: 1, run: 1 } + - { target: armv7-unknown-linux-musleabihf, os: ubuntu-latest, std: 1, run: 1 } + - { target: i586-unknown-linux-musl, os: ubuntu-latest, std: 1, run: 1 } + - { target: i686-unknown-linux-musl, os: ubuntu-latest, std: 1, run: 1 } + - { target: mips-unknown-linux-musl, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: mipsel-unknown-linux-musl, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: aarch64-linux-android, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: arm-linux-androideabi, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: armv7-linux-androideabi, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: i686-linux-android, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: x86_64-linux-android, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: x86_64-pc-windows-gnu, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } + - { target: i686-pc-windows-gnu, os: ubuntu-latest, cpp: 1, std: 1, run: 1 } # Disabled, see #396 - #-{ target: x86_64-unknown-dragonfly, toolchain: nightly, os: ubuntu-latest, cpp: 1, dylib: 1 } - - { target: i686-unknown-freebsd, toolchain: 1.58.1, os: ubuntu-latest, dylib: 1, std: 1 } - - { target: x86_64-unknown-freebsd, toolchain: 1.58.1, os: ubuntu-latest, dylib: 1, std: 1 } - - { target: x86_64-unknown-netbsd, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1 } + #-{ target: x86_64-unknown-dragonfly, os: ubuntu-latest, cpp: 1, dylib: 1 } + - { target: i686-unknown-freebsd, os: ubuntu-latest, dylib: 1, std: 1 } + - { target: x86_64-unknown-freebsd, os: ubuntu-latest, dylib: 1, std: 1 } + - { target: x86_64-unknown-netbsd, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1 } # Disabled, see #534 - #-{ target: sparcv9-sun-solaris, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1 } - #-{ target: x86_64-sun-solaris, toolchain: 1.58.1, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1 } + #-{ target: sparcv9-sun-solaris, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1 } + #-{ target: x86_64-sun-solaris, os: ubuntu-latest, cpp: 1, dylib: 1, std: 1 } # Disabled, see #634 - #-{ target: asmjs-unknown-emscripten, toolchain: 1.58.1, os: ubuntu-latest, std: 1, run: 1 } + #-{ target: asmjs-unknown-emscripten, os: ubuntu-latest, std: 1, run: 1 } # `cargo run` fails with an assertion error (https://github.com/rust-lang/cargo/issues/4689) on `wasm32-unknown-emscripten`. - #-{ target: wasm32-unknown-emscripten, toolchain: 1.58.1, os: ubuntu-latest, std: 1 } - - { target: thumbv6m-none-eabi, toolchain: 1.58.1, os: ubuntu-latest, std: 1 } - - { target: thumbv7em-none-eabi, toolchain: 1.58.1, os: ubuntu-latest, std: 1 } - - { target: thumbv7em-none-eabihf, toolchain: 1.58.1, os: ubuntu-latest, std: 1 } - - { target: thumbv7m-none-eabi, toolchain: 1.58.1, os: ubuntu-latest, std: 1 } + #-{ target: wasm32-unknown-emscripten, os: ubuntu-latest, std: 1 } + - { target: thumbv6m-none-eabi, os: ubuntu-latest, std: 1 } + - { target: thumbv7em-none-eabi, os: ubuntu-latest, std: 1 } + - { target: thumbv7em-none-eabihf, os: ubuntu-latest, std: 1 } + - { target: thumbv7m-none-eabi, os: ubuntu-latest, std: 1 } steps: - uses: actions/checkout@v3 From 57cce26504a7dcdca914905b0f3d3068c3570765 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 13 Mar 2022 15:35:23 +0100 Subject: [PATCH 84/89] Update default branch name. --- .github/workflows/ci.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 5b9694cd3..63ecedcfd 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -1,7 +1,7 @@ on: pull_request: push: - branches: [master, staging, trying] + branches: [main, staging, trying] tags: - "v*.*.*" @@ -198,7 +198,11 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} - name: Push image to GitHub Container Registry - if: runner.os == 'Linux' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/v')) + if: > + runner.os == 'Linux' && ( + github.ref == format('refs/heads/{0}', github.event.repository.default_branch) || + startsWith(github.ref, 'refs/tags/v') + ) run: ./build-docker-image.sh --push "${TARGET}" env: TARGET: ${{ matrix.target }} From 23581aa09a0d29bcf184596bd83cd5d40326506f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Sun, 13 Mar 2022 21:06:18 +0100 Subject: [PATCH 85/89] tag active branch as edge as well Also do not tag pre-releases as latest, previously only `*alpha` and `*dev` suffixes were checked, now we check for any version with a `-` --- build-docker-image.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/build-docker-image.sh b/build-docker-image.sh index 368f42160..021b31856 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -42,12 +42,16 @@ run() { tags+=("${image_name}:${tag_version}") # Tag stable versions as latest. - if ! [[ "${tag_version}" =~ alpha ]] && ! [[ "${tag_version}" =~ dev ]]; then + if ! [[ "${tag_version}" =~ -* ]]; then tags+=("${image_name}:latest") fi ;; branch:*) + # Tag active branch as edge. tags+=("${image_name}:${GITHUB_REF_NAME}") + if ! [[ "${GITHUB_REF_NAME-}" =~ staging ]] && ! [[ "${GITHUB_REF_NAME-}" =~ trying ]]; then + tags+=("${image_name}:edge") + fi ;; *) if "${push}"; then From 1899b8ae8dc44bd7fde130649501edfc1f541060 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Sun, 13 Mar 2022 21:06:30 +0100 Subject: [PATCH 86/89] document new image name --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 89e647ad6..687248b2e 100644 --- a/README.md +++ b/README.md @@ -109,12 +109,12 @@ the default one. Normal Docker behavior applies, so: - If only `tag` is omitted, then Docker will use the `latest` tag. It's recommended to base your custom image on the default Docker image that -cross uses: `cross-rs/cross:{{TARGET}}-{{VERSION}}` (where `{{VERSION}}` is cross's version). +cross uses: `ghcr.io/cross-rs/{{TARGET}}:{{VERSION}}` (where `{{VERSION}}` is cross's version). This way you won't have to figure out how to install a cross C toolchain in your custom image. Example below: ``` Dockerfile -FROM cross-rs/cross:aarch64-unknown-linux-gnu-0.2.1 +FROM ghcr.io/cross-rs/aarch64-unknown-linux-gnu:latest RUN dpkg --add-architecture arm64 && \ apt-get update && \ From c06858b0b7f465422d0e4dc55ba3445f3c45dac8 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Sun, 13 Mar 2022 21:17:06 +0100 Subject: [PATCH 87/89] remove stale file --- cross_test/Cargo.toml | 10 ---------- 1 file changed, 10 deletions(-) delete mode 100644 cross_test/Cargo.toml diff --git a/cross_test/Cargo.toml b/cross_test/Cargo.toml deleted file mode 100644 index 5b0f962e6..000000000 --- a/cross_test/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -build = "build.rs" -description = "Zero setup cross compilation and cross testing" -documentation = "https://github.com/rust-embedded/cross" -keywords = ["cross", "compilation", "testing", "tool"] -license = "MIT OR Apache-2.0" -name = "cross" -repository = "https://github.com/rust-embedded/cross" -version = "0.2.1" -edition = "2018" From 5631d16a2c2ac4852a6d355f6dd86da1a747066b Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Emil=20Gardstr=C3=B6m?= Date: Sun, 13 Mar 2022 21:25:06 +0100 Subject: [PATCH 88/89] apply shellsheck fixes --- build-docker-image.sh | 2 +- docker/lib.sh | 6 ++++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/build-docker-image.sh b/build-docker-image.sh index 021b31856..179854cb3 100755 --- a/build-docker-image.sh +++ b/build-docker-image.sh @@ -42,7 +42,7 @@ run() { tags+=("${image_name}:${tag_version}") # Tag stable versions as latest. - if ! [[ "${tag_version}" =~ -* ]]; then + if ! [[ "${tag_version}" =~ -.* ]]; then tags+=("${image_name}:latest") fi ;; diff --git a/docker/lib.sh b/docker/lib.sh index 0d299b8a6..5e74c2655 100644 --- a/docker/lib.sh +++ b/docker/lib.sh @@ -1,3 +1,5 @@ +#!/usr/bin/env bash + purge_list=() install_packages() { @@ -34,12 +36,12 @@ purge_packages() { if_centos() { if grep -q -i centos /etc/os-release; then - eval "${@}" + "${@}" fi } if_ubuntu() { if grep -q -i ubuntu /etc/os-release; then - eval "${@}" + "${@}" fi } From fbbe7fb5034669ba1f44dc076667c83ee50088a4 Mon Sep 17 00:00:00 2001 From: Markus Reiter Date: Sun, 13 Mar 2022 23:00:52 +0100 Subject: [PATCH 89/89] Revert shellcheck fixes. --- docker/lib.sh | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/docker/lib.sh b/docker/lib.sh index 5e74c2655..0d299b8a6 100644 --- a/docker/lib.sh +++ b/docker/lib.sh @@ -1,5 +1,3 @@ -#!/usr/bin/env bash - purge_list=() install_packages() { @@ -36,12 +34,12 @@ purge_packages() { if_centos() { if grep -q -i centos /etc/os-release; then - "${@}" + eval "${@}" fi } if_ubuntu() { if grep -q -i ubuntu /etc/os-release; then - "${@}" + eval "${@}" fi }