-
Notifications
You must be signed in to change notification settings - Fork 0
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
0 parents
commit 1f64f3e
Showing
9 changed files
with
1,266 additions
and
0 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 |
---|---|---|
@@ -0,0 +1,117 @@ | ||
# Configuration largely copied from https://github.com/BurntSushi/ripgrep/blob/ffd4c9ccba0ffc74270a8d3ae75f11a7ba7a1a64/.github/workflows/release.yml | ||
name: Create Release | ||
|
||
on: | ||
push: | ||
tags: | ||
- 'v*' | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
create-release: | ||
name: create-release | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Create artifacts directory | ||
run: mkdir artifacts | ||
|
||
- name: Get the release version from the tag | ||
run: | | ||
# See: https://github.community/t5/GitHub-Actions/How-to-get-just-the-tag-name/m-p/32167/highlight/true#M1027 | ||
echo "::set-env name=APP_VERSION::${GITHUB_REF#refs/tags/v}" | ||
- name: Create GitHub release | ||
id: release | ||
uses: actions/create-release@v1 | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
tag_name: v${{ env.APP_VERSION }} | ||
release_name: ${{ env.APP_VERSION }} | ||
|
||
- name: Save release upload URL to artifact | ||
run: echo "${{ steps.release.outputs.upload_url }}" > artifacts/release-upload-url | ||
|
||
- name: Save version number to artifact | ||
run: echo "${{ env.APP_VERSION }}" > artifacts/release-version | ||
|
||
- name: Upload artifacts | ||
uses: actions/upload-artifact@v1 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
||
build-release: | ||
needs: ['create-release'] | ||
strategy: | ||
fail-fast: false | ||
matrix: | ||
build: [linux, macos, win-msvc] | ||
include: | ||
- build: linux | ||
os: ubuntu-latest | ||
target: x86_64-unknown-linux-musl | ||
- build: macos | ||
os: macos-latest | ||
target: x86_64-apple-darwin | ||
- build: win-msvc | ||
os: windows-latest | ||
target: x86_64-windows-msvc | ||
runs-on: ${{ matrix.os }} | ||
steps: | ||
- uses: actions/checkout@v2 | ||
|
||
- name: Get release download URL | ||
uses: actions/download-artifact@v1 | ||
with: | ||
name: artifacts | ||
path: artifacts | ||
|
||
- name: Set release upload URL and release version | ||
shell: bash | ||
run: | | ||
release_upload_url="$(cat artifacts/release-upload-url)" | ||
echo "::set-env name=RELEASE_UPLOAD_URL::$release_upload_url" | ||
echo "release upload url: $RELEASE_UPLOAD_URL" | ||
release_version="$(cat artifacts/release-version)" | ||
echo "::set-env name=RELEASE_VERSION::$release_version" | ||
echo "release version: $RELEASE_VERSION" | ||
- name: Build release binary | ||
run: cargo build --verbose --release | ||
|
||
- name: Strip release binary (linux and macos) | ||
if: matrix.build == 'linux' || matrix.build == 'macos' | ||
run: strip "target/release/https-cert-info" | ||
|
||
- name: Build release archive | ||
shell: bash | ||
run: | | ||
staging="https-cert-info-${{ env.RELEASE_VERSION }}-${{ matrix.target }}" | ||
mkdir -p "$staging"/complete | ||
outdir="$(find target/release -name https-cert-info-stamp -print0 \ | ||
| xargs -0 ls -t | head -n1 | xargs dirname)" | ||
cp {README.md,COPYING,LICENSE-MIT,LICENSE-APACHE,CHANGELOG.md} "$staging/" | ||
cp "$outdir"/{https-cert-info.bash,https-cert-info.fish,_https-cert-info,_https-cert-info.ps1} "$staging/complete/" | ||
if [ "${{ matrix.os }}" = "windows-latest" ]; then | ||
cp "target/release/https-cert-info.exe" "$staging/" | ||
7z a "$staging.zip" "$staging" | ||
echo "::set-env name=ASSET::$staging.zip" | ||
else | ||
cp "target/release/https-cert-info" "$staging/" | ||
tar czf "$staging.tar.gz" "$staging" | ||
echo "::set-env name=ASSET::$staging.tar.gz" | ||
fi | ||
- name: Upload release archive | ||
uses: actions/[email protected] | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
with: | ||
upload_url: ${{ env.RELEASE_UPLOAD_URL }} | ||
asset_path: ${{ env.ASSET }} | ||
asset_name: ${{ env.ASSET }} | ||
asset_content_type: application/octet-stream |
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 |
---|---|---|
@@ -0,0 +1,38 @@ | ||
name: Test | ||
|
||
on: | ||
push: | ||
branches: [ main ] | ||
pull_request: | ||
branches: [ main ] | ||
|
||
env: | ||
CARGO_TERM_COLOR: always | ||
|
||
jobs: | ||
build-ubuntu: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Install Ubuntu dependencies | ||
run: sudo apt-get install -y libdbus-1-dev | ||
- uses: actions/checkout@v2 | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Run tests | ||
run: cargo test --verbose | ||
build-macos: | ||
runs-on: macos-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Run tests | ||
run: cargo test --verbose | ||
build-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v2 | ||
- name: Build | ||
run: cargo build --verbose | ||
- name: Run tests | ||
run: cargo test --verbose |
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 |
---|---|---|
@@ -0,0 +1 @@ | ||
/target |
Oops, something went wrong.