diff options
author | CosmicHorror <CosmicHorrorDev@pm.me> | 2023-10-20 18:02:45 -0600 |
---|---|---|
committer | GitHub <noreply@github.com> | 2023-10-20 19:02:45 -0500 |
commit | 639d16fa3ce3a76eef3e41342e5ca535af826020 (patch) | |
tree | 303b9988fde047f02b3731bdff396dbb35e45029 | |
parent | d0fd7f6ac393768e780438f947f373dc8cb214c7 (diff) |
Switch CI from `actions-rs` to `dtolnay/rust-toolchain (#249)
-rw-r--r-- | .github/workflows/publish.yml | 38 | ||||
-rw-r--r-- | .github/workflows/test.yml | 30 |
2 files changed, 39 insertions, 29 deletions
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index cc2b629..22fd023 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -55,29 +55,39 @@ jobs: fetch-depth: 1 - name: Set the version - id: version - run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} + shell: bash + if: env.SD_VERSION == '' + run: | + echo "SD_VERSION=$GITHUB_REF_NAME" >> $GITHUB_ENV + echo "version is: ${{ env.SD_VERSION }}" - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - profile: minimal - override: true - target: ${{ matrix.target }} - + targets: ${{ matrix.target }} + + - name: Install Cross + if: ${{ matrix.use-cross == true }} + shell: bash + run: | + dir="$RUNNER_TEMP/cross-download" + mkdir "$dir" + echo "$dir" >> $GITHUB_PATH + cd "$dir" + curl -LO "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz" + tar xf cross-x86_64-unknown-linux-musl.tar.gz + echo "CARGO=cross" >> $GITHUB_ENV + echo "RUSTFLAGS='--cfg sd_cross_compile'" + echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV - name: Build - uses: actions-rs/cargo@v1 - with: - use-cross: ${{ matrix.use-cross }} - command: build - args: --target ${{ matrix.target }} --release --locked + run: | + cargo build --release --locked - name: Upload binaries to release uses: svenstaro/upload-release-action@2.7.0 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: target/${{ matrix.target }}/release/sd - asset_name: sd-${{ steps.version.outputs.VERSION }}-${{ matrix.target }} + asset_name: sd-${{ env.SD_VERSION }}-${{ matrix.target }} tag: ${{ github.ref }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 3d0248c..8c4cc96 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -56,25 +56,25 @@ jobs: fetch-depth: 1 - name: Install Rust - uses: actions-rs/toolchain@v1 + uses: dtolnay/rust-toolchain@stable with: - toolchain: stable - profile: minimal - override: true - target: ${{ matrix.target }} + targets: ${{ matrix.target }} - - name: Create .cargo/config.toml + - name: Install Cross if: ${{ matrix.use-cross == true }} shell: bash run: | - cat > .cargo/config.toml <<EOF - [target.${{ matrix.target }}] - rustflags = ["--cfg", "sd_cross_compile"] - EOF + dir="$RUNNER_TEMP/cross-download" + mkdir "$dir" + echo "$dir" >> $GITHUB_PATH + cd "$dir" + curl -LO "https://github.com/cross-rs/cross/releases/download/v0.2.5/cross-x86_64-unknown-linux-musl.tar.gz" + tar xf cross-x86_64-unknown-linux-musl.tar.gz + echo "CARGO=cross" >> $GITHUB_ENV + echo "RUSTFLAGS='--cfg sd_cross_compile'" + echo "TARGET_FLAGS=--target ${{ matrix.target }}" >> $GITHUB_ENV + echo "TARGET_DIR=./target/${{ matrix.target }}" >> $GITHUB_ENV - name: Test - uses: actions-rs/cargo@v1 - with: - use-cross: ${{ matrix.use-cross }} - command: test - args: --target ${{ matrix.target }} + run: | + cargo test |