-
-
Notifications
You must be signed in to change notification settings - Fork 84
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
175 additions
and
128 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,7 +12,6 @@ jobs: | |
steps: | ||
- name: Create artifacts directory | ||
run: mkdir artifacts | ||
|
||
- name: Get the release version from the tag | ||
if: env.VERSION == '' | ||
run: | | ||
|
@@ -22,16 +21,12 @@ jobs: | |
else | ||
echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV | ||
fi | ||
- name: Validate version environment variable | ||
run: | | ||
echo "Version being built against is version ${{ env.VERSION }}"! | ||
run: echo "Version being built against is version ${{ env.VERSION }}"! | ||
- name: Save version number to artifact | ||
run: echo "${{ env.VERSION }}" > artifacts/release-version | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v1 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
@@ -45,56 +40,63 @@ jobs: | |
strategy: | ||
fail-fast: false | ||
matrix: | ||
# prettier-ignore | ||
job: | ||
# prettier-ignore | ||
- { name: "macOS-arm64", os: "macOS-latest", target: "aarch64-apple-darwin", artifact_prefix: "macos-arm64", use-cross: true } | ||
- { name: "macOS-amd64", os: "macOS-latest", target: "x86_64-apple-darwin", artifact_prefix: "macos" } | ||
- { name: "windows-amd64", os: "windows-latest", target: "x86_64-pc-windows-msvc", artifact_prefix: "windows" } | ||
- { name: "windows-aarch64", os: "windows-latest", target: "aarch64-pc-windows-msvc", artifact_prefix: "windows-aarch64", use-cross: true } | ||
- { name: "linux-gnu", os: "ubuntu-latest", target: "x86_64-unknown-linux-gnu", artifact_prefix: "linux" } | ||
- { name: "linux-musl", os: "ubuntu-latest", target: "x86_64-unknown-linux-musl", artifact_prefix: "linux-musl", use-cross: true, } | ||
- { name: "aarch64-gnu", os: "ubuntu-latest", target: "aarch64-unknown-linux-gnu", artifact_prefix: "aarch64-gnu", use-cross: true, test-bin: "--bin kdash" } | ||
- { name: "aarch64-musl", os: "ubuntu-latest", target: "aarch64-unknown-linux-musl", artifact_prefix: "aarch64-musl", use-cross: true, test-bin: "--bin kdash" } | ||
- { name: "arm-gnu", os: "ubuntu-latest", target: "arm-unknown-linux-gnueabihf", artifact_prefix: "armv6-gnu", use-cross: true, test-bin: "--bin kdash" } | ||
- { name: "arm-musl", os: "ubuntu-latest", target: "arm-unknown-linux-musleabihf", artifact_prefix: "armv6-musl", use-cross: true, test-bin: "--bin kdash" } | ||
- { name: "armv7-gnu", os: "ubuntu-latest", target: "armv7-unknown-linux-gnueabihf", artifact_prefix: "armv7-gnu", use-cross: true, test-bin: "--bin kdash" } | ||
- { name: "armv7-musl", os: "ubuntu-latest", target: "armv7-unknown-linux-musleabihf", artifact_prefix: "armv7-musl", use-cross: true, test-bin: "--bin kdash" } | ||
- { name: "macOS-arm64", os: "macOS-latest", target: "aarch64-apple-darwin", artifact_prefix: "macos-arm64", use-cross: true } | ||
- { name: "macOS-amd64", os: "macOS-latest", target: "x86_64-apple-darwin", artifact_prefix: "macos" } | ||
- { name: "windows-amd64", os: "windows-latest", target: "x86_64-pc-windows-msvc", artifact_prefix: "windows" } | ||
- { name: "windows-aarch64", os: "windows-latest", target: "aarch64-pc-windows-msvc", artifact_prefix: "windows-aarch64", use-cross: true } | ||
- { name: "linux-gnu", os: "ubuntu-latest", target: "x86_64-unknown-linux-gnu", artifact_prefix: "linux" } | ||
- { name: "linux-musl", os: "ubuntu-latest", target: "x86_64-unknown-linux-musl", artifact_prefix: "linux-musl", use-cross: true, } | ||
- { name: "linux-aarch64-gnu", os: "ubuntu-latest", target: "aarch64-unknown-linux-gnu", artifact_prefix: "aarch64-gnu", use-cross: true, test-bin: "--bin kdash" } | ||
- { name: "linux-aarch64-musl", os: "ubuntu-latest", target: "aarch64-unknown-linux-musl", artifact_prefix: "aarch64-musl", use-cross: true, test-bin: "--bin kdash" } | ||
- { name: "linux-arm-gnu", os: "ubuntu-latest", target: "arm-unknown-linux-gnueabihf", artifact_prefix: "armv6-gnu", use-cross: true, test-bin: "--bin kdash" } | ||
- { name: "linux-arm-musl", os: "ubuntu-latest", target: "arm-unknown-linux-musleabihf", artifact_prefix: "armv6-musl", use-cross: true, test-bin: "--bin kdash" } | ||
- { name: "linux-armv7-gnu", os: "ubuntu-latest", target: "armv7-unknown-linux-gnueabihf", artifact_prefix: "armv7-gnu", use-cross: true, test-bin: "--bin kdash" } | ||
- { name: "linux-armv7-musl", os: "ubuntu-latest", target: "armv7-unknown-linux-musleabihf", artifact_prefix: "armv7-musl", use-cross: true, test-bin: "--bin kdash" } | ||
rust: [stable] | ||
|
||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- uses: actions/cache@v3 | ||
name: Cache Cargo registry | ||
with: | ||
path: ~/.cargo/registry | ||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} | ||
- uses: actions/cache@v3 | ||
if: startsWith(matrix.job.name, 'linux-') | ||
with: | ||
path: ~/.cargo/bin | ||
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('.github/workflows/cd.yml') }} | ||
- name: Get shared artifacts | ||
uses: actions/download-artifact@v2 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
||
- name: Set release version | ||
shell: bash | ||
run: | | ||
release_version="$(cat ./artifacts/release-version)" | ||
echo "RELEASE_VERSION=$release_version" >> $GITHUB_ENV | ||
- name: Validate release environment variables | ||
run: | | ||
echo "Release version: ${{ env.RELEASE_VERSION }}" | ||
- name: Install toolchain | ||
uses: actions-rs/toolchain@v1 | ||
- uses: dtolnay/rust-toolchain@stable | ||
name: Set Rust toolchain | ||
with: | ||
targets: ${{ matrix.job.target }} | ||
- uses: taiki-e/setup-cross-toolchain-action@v1 | ||
with: | ||
toolchain: ${{ matrix.rust }} | ||
override: true | ||
# NB: sets CARGO_BUILD_TARGET evar - do not need --target flag in build | ||
target: ${{ matrix.job.target }} | ||
profile: minimal # minimal component installation (ie, no documentation) | ||
|
||
- uses: taiki-e/install-action@cross | ||
if: ${{ matrix.job.cross }} | ||
- name: Installing needed macOS dependencies | ||
if: matrix.job.os == 'macos-latest' | ||
run: brew install [email protected] | ||
|
||
- name: Installing needed Ubuntu dependencies | ||
if: matrix.job.os == 'ubuntu-latest' | ||
shell: bash | ||
|
@@ -107,26 +109,14 @@ jobs: | |
esac | ||
- name: Build | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: ${{ matrix.job.use-cross }} | ||
command: build | ||
args: --release --verbose --target=${{ matrix.job.target }} | ||
toolchain: ${{ matrix.rust }} | ||
|
||
run: cargo build --release --verbose --target=${{ matrix.job.target }} --locked | ||
- name: Verify file | ||
shell: bash | ||
run: | | ||
file target/${{ matrix.job.target }}/release/kdash | ||
ldd target/${{ matrix.job.target }}/release/kdash | ||
- name: Test | ||
if: matrix.job.target != 'aarch64-apple-darwin' | ||
uses: actions-rs/cargo@v1 | ||
with: | ||
use-cross: ${{ matrix.job.use-cross }} | ||
command: test | ||
args: --target=${{ matrix.job.target }} ${{ matrix.job.test-bin }} | ||
run: cargo test --release --verbose --target=${{ matrix.job.target }} ${{ matrix.job.test-bin }} | ||
|
||
- name: Packaging final binary (Windows) | ||
if: matrix.job.os == 'windows-latest' | ||
|
@@ -149,7 +139,7 @@ jobs: | |
# set the right strip executable | ||
STRIP="strip"; | ||
case ${{ matrix.job.target }} in | ||
arm-*-linux-*) STRIP="arm-linux-gnueabihf-strip" ;; | ||
arm*-linux-*) STRIP="arm-linux-gnueabihf-strip" ;; | ||
aarch64-*-linux-*) STRIP="aarch64-linux-gnu-strip" ;; | ||
esac; | ||
cd target/${{ matrix.job.target }}/release | ||
|
@@ -176,7 +166,7 @@ jobs: | |
cp target/${{ matrix.job.target }}/release/${{ env.RELEASE_NAME }}.sha256 artifacts/ | ||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v1 | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
@@ -187,12 +177,12 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Get release artifacts | ||
uses: actions/download-artifact@v2 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
@@ -238,12 +228,12 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: Checkout repository | ||
uses: actions/checkout@v2 | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 1 | ||
|
||
- name: Get release artifacts | ||
uses: actions/download-artifact@v2 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
@@ -302,7 +292,7 @@ jobs: | |
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get release artifacts | ||
uses: actions/download-artifact@v2 | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
@@ -332,16 +322,18 @@ jobs: | |
needs: [build-release-artifacts] | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- uses: actions-rs/toolchain@v1 | ||
- uses: actions/checkout@v4 | ||
- uses: actions/cache@v3 | ||
name: Cache Cargo registry | ||
with: | ||
toolchain: stable | ||
override: true | ||
profile: minimal # minimal component installation (ie, no documentation) | ||
path: ~/.cargo/registry | ||
key: ${{ runner.os }}-cargo-registry-${{ hashFiles('Cargo.lock') }} | ||
- uses: actions/cache@v3 | ||
with: | ||
path: ~/.cargo/bin | ||
key: ${{ runner.os }}-cargo-bin-${{ hashFiles('.github/workflows/cd.yml') }} | ||
- uses: dtolnay/rust-toolchain@stable | ||
- run: | | ||
sudo apt-get update | ||
sudo apt-get install -y -qq pkg-config libssl-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev | ||
- uses: actions-rs/cargo@v1 | ||
with: | ||
command: publish | ||
args: --token ${{ secrets.CARGO_API_KEY }} --allow-dirty | ||
- run: cargo publish --token ${{ secrets.CARGO_API_KEY }} --allow-dirty |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.