aboutsummaryrefslogtreecommitdiffstats
path: root/.github
diff options
context:
space:
mode:
authorSven-Hendrik Haase <svenstaro@gmail.com>2020-07-20 23:26:37 +0000
committerGitHub <noreply@github.com>2020-07-20 23:26:37 +0000
commit6d95b7b6405fb2bfa9e585e2b8c00d5faae9fb23 (patch)
tree9353255839844567d736011f4c44ec26e771e8cd /.github
parentMerge pull request #346 from svenstaro/show-full-usage-in-readme (diff)
downloadminiserve-6d95b7b6405fb2bfa9e585e2b8c00d5faae9fb23.tar.gz
miniserve-6d95b7b6405fb2bfa9e585e2b8c00d5faae9fb23.zip
Switch to GitHub Actions (#344)
* Switch to GitHub Actions * Switch CI badge to GitHub Actions flow * Only run on nightly for now
Diffstat (limited to '.github')
-rw-r--r--.github/workflows/ci.yml46
-rw-r--r--.github/workflows/publish.yml74
2 files changed, 120 insertions, 0 deletions
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
new file mode 100644
index 0000000..219e187
--- /dev/null
+++ b/.github/workflows/ci.yml
@@ -0,0 +1,46 @@
+name: CI
+
+on: [push, pull_request]
+
+jobs:
+ ci:
+ name: CI with ${{ matrix.rust }} on ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ubuntu-latest, windows-latest, macos-latest]
+ rust: [nightly]
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Setup Rust toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ profile: minimal
+ toolchain: ${{ matrix.rust }}
+ override: true
+ components: rustfmt, clippy
+
+ - name: cargo build
+ uses: actions-rs/cargo@v1
+ with:
+ command: build
+
+ - name: cargo test
+ uses: actions-rs/cargo@v1
+ with:
+ command: test
+
+ - name: cargo fmt
+ uses: actions-rs/cargo@v1
+ with:
+ command: fmt
+ args: --all -- --check
+
+ - name: cargo clippy
+ uses: actions-rs/cargo@v1
+ with:
+ command: clippy
+ args: -- -D warnings
diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml
new file mode 100644
index 0000000..b2a1503
--- /dev/null
+++ b/.github/workflows/publish.yml
@@ -0,0 +1,74 @@
+name: Publish
+
+on:
+ push:
+ tags:
+ - 'v*'
+
+jobs:
+ publish:
+ name: Publish for ${{ matrix.os }}
+ runs-on: ${{ matrix.os }}
+ strategy:
+ matrix:
+ os: [ubuntu-latest, windows-latest, macos-latest]
+ include:
+ - os: ubuntu-latest
+ artifact_name: target/x86_64-unknown-linux-musl/release/miniserve
+ release_name: linux-x86_64
+ target: x86_64-unknown-linux-musl
+ - os: windows-latest
+ artifact_name: target/x86_64-pc-windows-msvc/release/miniserve.exe
+ release_name: windows-x86_64.exe
+ target: x86_64-pc-windows-msvc
+ - os: macos-latest
+ artifact_name: target/x86_64-apple-darwin/release/miniserve
+ release_name: macos-x86_64
+ target: x86_64-apple-darwin
+
+ steps:
+ - name: Checkout code
+ uses: actions/checkout@v2
+
+ - name: Setup Rust toolchain
+ uses: actions-rs/toolchain@v1
+ with:
+ toolchain: nightly
+ target: ${{ matrix.target }}
+
+ - run: sudo apt install musl-tools
+ if: matrix.os == 'ubuntu-latest'
+
+ - name: cargo build
+ uses: actions-rs/cargo@v1
+ with:
+ command: build
+ args: --release --locked --target=${{ matrix.target }}
+
+ - name: Compress binaries
+ uses: svenstaro/upx-action@v2
+ with:
+ file: ${{ matrix.artifact_name }}
+ args: --better --lzma
+
+ - name: Get tag name
+ id: tag_name
+ run: |
+ echo ::set-output name=current_version::${GITHUB_REF#refs/tags/v}
+ shell: bash
+
+ - name: Get CHANGELOG.md entry
+ id: changelog_reader
+ uses: mindsers/changelog-reader-action@v1
+ with:
+ version: ${{ steps.tag.outputs.current_version }}
+ path: ./CHANGELOG.md
+
+ - name: Release
+ uses: svenstaro/upload-release-action@v2
+ with:
+ repo_token: ${{ secrets.GITHUB_TOKEN }}
+ file: ${{ matrix.artifact_name }}
+ tag: ${{ github.ref }}
+ asset_name: miniserve-$tag-${{ matrix.release_name }}
+ body: ${{ steps.changelog_reader.outputs.log_entry }}