diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 48a4369..5262571 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -13,7 +13,7 @@ permissions: contents: read jobs: - test: + registry: name: Rust ${{ matrix.rust }} using ${{ matrix.registry }} runs-on: ubuntu-latest strategy: @@ -43,3 +43,34 @@ jobs: - run: cargo init . --bin --name ci - run: cargo add logging --registry ${{ matrix.registry }} - run: cargo check + + linker: + name: Rust ${{ matrix.rust }} with mold linker + runs-on: ubuntu-latest + strategy: + fail-fast: false + matrix: + rust: + - stable + - beta + - nightly + steps: + - uses: actions/checkout@v4 + + - name: Set registry name + run: sed -i "s/REGISTRY/wafflehacks/g" .cargo/config.toml + + - name: TheHackerApp/setup-rust@main + uses: ./ + with: + ssh-private-key: ${{ secrets.SHIPYARD_SSH_KEY }} + token: ${{ secrets.SHIPYARD_TOKEN }} + toolchain: ${{ matrix.rust }} + with-mold: true + + - run: cargo init . --bin --name ci + - run: cargo add rand + - run: cargo check + env: + CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_LINKER: clang + CARGO_TARGET_X86_64_UNKNOWN_LINUX_GNU_RUSTFLAGS: -C link-args=-fuse-ld=mold diff --git a/action.yml b/action.yml index 2832d21..cda34be 100644 --- a/action.yml +++ b/action.yml @@ -23,6 +23,14 @@ inputs: components: description: Comma-separated list of components to be additionally installed required: false + with-mold: + description: Whether to install the mold linker + required: false + default: true + mold-version: + description: Version of the mold linker to install + required: false + default: "2.31.0" runs: using: composite @@ -52,3 +60,16 @@ runs: run: | echo "CARGO_NET_GIT_FETCH_WITH_CLI=true" >> $GITHUB_ENV echo "CARGO_REGISTRY_GLOBAL_CREDENTIAL_PROVIDERS=cargo:token" >> $GITHUB_ENV + + - name: Install mold linker + shell: bash + if: inputs.with-mold == 'true' + run: | + wget -qO /tmp/mold.tar.gz https://github.com/rui314/mold/releases/download/v${{ inputs.mold-version }}/mold-${{ inputs.mold-version }}-x86_64-linux.tar.gz; \ + sudo tar -xf /tmp/mold.tar.gz -C /usr/local --strip-components 1; \ + rm /tmp/mold.tar.gz + + - name: Install clang + shell: bash + if: inputs.with-mold == 'true' + run: sudo apt-get install -y clang libclang-dev