diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..3328233 --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,32 @@ +name: Build + +on: + push: + branches: + - master + pull_request: + branches: + - master + +jobs: + test: + runs-on: ${{ matrix.os }} + strategy: + matrix: + rust: [stable] + os: [ubuntu-latest, macOS-latest, windows-latest] + steps: + - name: Setup Rust + uses: hecrj/setup-rust-action@master + with: + rust-version: ${{ matrix.rust }} + components: rustfmt, clippy + - name: Checkout + uses: actions/checkout@v2 + - name: Run cargo fmt + run: cargo fmt --all -- --check + - name: Run cargo clippy + run: cargo clippy --all -- -D clippy::pedantic -D clippy::nursery -D warnings + - name: Run tests + run: | + cargo test --verbose diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..ab67d1f --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,66 @@ +name: Release + +on: + push: + tags: + - "v*.*.*" + +jobs: + release: + runs-on: ${{ matrix.os }} + strategy: + matrix: + rust: [stable] + os: [ubuntu-latest, macOS-latest, windows-latest] + include: + - os: ubuntu-latest + rust: stable + artifact_name: microserver + asset_name: microserver_linux.gz + - os: macOS-latest + rust: stable + artifact_name: microserver + asset_name: microserver_osx.gz + - os: windows-latest + rust: stable + artifact_name: microserver.exe + asset_name: microserver_windows.gz + steps: + - name: Setup Rust + uses: hecrj/setup-rust-action@master + with: + rust-version: stable + - name: Checkout + uses: actions/checkout@v2 + - name: Build artifacts + shell: bash + run: | + echo "Building the project" + cargo build --release + echo "Preparing the artifact" + chmod +x "target/release/${{ matrix.artifact_name }}" + gzip -k -f "target/release/${{ matrix.artifact_name }}" + echo "moving target/release/${{ matrix.artifact_name }}.gz to ${{ matrix.asset_name }}" + mv "target/release/${{ matrix.artifact_name }}.gz" "${{ matrix.asset_name }}" + - name: Publishing to GitHub release + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ matrix.asset_name }} + asset_name: ${{ matrix.asset_name }} + tag: ${{ github.ref }} + + crates: + runs-on: ubuntu-latest + needs: [release] + steps: + - name: Setup Rust + uses: hecrj/setup-rust-action@master + with: + rust-version: stable + - name: Checkout + uses: actions/checkout@v2 + - name: Publish to crates.io + run: | + cargo login ${{secrets.crates_key}} + cargo publish diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index 4c4b2f0..0000000 --- a/.travis.yml +++ /dev/null @@ -1,40 +0,0 @@ -language: rust -rust: - - stable - # - beta - # - nightly -os: - - linux - - osx - - windows -matrix: - # - rust: stable - # - rust: beta - allow_failures: - - os: windows - fast_finish: true -before_script: - - rustup component add rustfmt-preview - - rustup component add clippy-preview -script: - - cargo fmt --all -- --check - - if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then cargo clippy --all -- -D clippy::pedantic ; fi - - cargo build --release - - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then chmod +x target/release/microserver.exe ; fi - - if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then chmod +x target/release/microserver ; fi - - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then gzip -k -f target/release/microserver.exe ; fi - - if [[ "$TRAVIS_OS_NAME" != "windows" ]]; then gzip -k -f target/release/microserver ; fi - - if [[ "$TRAVIS_OS_NAME" == "linux" ]]; then mv target/release/microserver.gz microserver_linux.gz ; fi - - if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then mv target/release/microserver.gz microserver_osx.gz ; fi - - if [[ "$TRAVIS_OS_NAME" == "windows" ]]; then mv target/release/microserver.exe.gz microserver_windows.gz ; fi -deploy: - # if: tag IS present - provider: releases - api_key: $gh_key - file: - - microserver_linux.gz - - microserver_osx.gz - - microserver_windows.gz - skip_cleanup: true - on: - tags: true diff --git a/Cargo.lock b/Cargo.lock index 4d76b7b..4a25f3b 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -493,7 +493,7 @@ dependencies = [ [[package]] name = "microserver" -version = "0.1.5" +version = "0.1.6" dependencies = [ "clap 2.33.0 (registry+https://github.com/rust-lang/crates.io-index)", "console 0.9.1 (registry+https://github.com/rust-lang/crates.io-index)", diff --git a/Cargo.toml b/Cargo.toml index a2500e3..d520f10 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,7 +1,7 @@ [package] name = "microserver" description = "Simple ad-hoc server with SPA support based on Warp!. Excellent for testing React, Angular, Vue apps and the like." -version = "0.1.5" +version = "0.1.6" authors = ["Roberto Huertas "] edition = "2018" license = "MIT" diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index 2f4f967..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,132 +0,0 @@ -# Starter pipeline -# Start with a minimal pipeline that you can customize to build and deploy your code. -# Add steps that build, run tests, deploy, and more: -# https://aka.ms/yaml - -jobs: - - job: Linux - displayName: Linux build - pool: - vmImage: 'Ubuntu 16.04' # other options: 'macOS 10.13', 'VS2017-Win2016' - - steps: - - script: curl https://sh.rustup.rs -sSf | sh -s -- -y - displayName: 'Install rust' - -# - script: | -# export PATH=$HOME/.cargo/bin:$PATH -# rustup install nightly -# rustup default nightly -# displayName: 'Setting nightly' - - - script: | - export PATH=$HOME/.cargo/bin:$PATH - rustup component add rustfmt-preview - rustup component add clippy-preview - displayName: 'installing Cargo components' - - - script: | - export PATH=$HOME/.cargo/bin:$PATH - cargo fmt --all -- --check - displayName: 'Cargo fmt' - - - script: | - export PATH=$HOME/.cargo/bin:$PATH - cargo clippy --all -- -D clippy::pedantic -A clippy::non-ascii-literal - displayName: 'Cargo clippy' - - - script: | - export PATH=$HOME/.cargo/bin:$PATH - cargo build --release - displayName: 'Build' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: microserver' - inputs: - PathtoPublish: '$(System.DefaultWorkingDirectory)/target/release/microserver' - ArtifactName: microserver-linux - - - job: macOS - displayName: OSX build - continueOnError: true - pool: - vmImage: 'macOS-10.13' - steps: - - script: curl https://sh.rustup.rs -sSf | sh -s -- -y - displayName: 'Installing rust' - -# - script: | -# export PATH=$HOME/.cargo/bin:$PATH -# rustup install nightly -# rustup default nightly -# displayName: 'Setting nightly' - - - script: | - export PATH=$HOME/.cargo/bin:$PATH - rustup component add rustfmt-preview - rustup component add clippy-preview - displayName: 'installing Cargo components' - - - script: | - export PATH=$HOME/.cargo/bin:$PATH - cargo fmt --all -- --check - displayName: 'Cargo fmt' - - - script: | - export PATH=$HOME/.cargo/bin:$PATH - cargo clippy --all -- -D clippy::pedantic -A clippy::non-ascii-literal - displayName: 'Cargo clippy' - - - script: | - export PATH=$HOME/.cargo/bin:$PATH - cargo build --release - displayName: 'Build' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: microserver' - inputs: - PathtoPublish: '$(System.DefaultWorkingDirectory)/target/release/microserver' - ArtifactName: microserver-osx - - - job: Windows - displayName: Windows build - pool: - vmImage: 'vs2017-win2016' - steps: - - powershell: | - Invoke-WebRequest -Uri https://win.rustup.rs/ -Outfile rustup-init.exe - .\rustup-init.exe -y - displayName: 'Installing rust' - -# - script: | -# SET PATH=%PATH%;%USERPROFILE%\.cargo\bin; -# rustup install nightly -# rustup default nightly -# displayName: 'Setting nightly' - - - script: | - SET PATH=%PATH%;%USERPROFILE%\.cargo\bin; - rustup component add rustfmt-preview - rustup component add clippy-preview - displayName: 'installing Cargo components' - - - script: | - SET PATH=%PATH%;%USERPROFILE%\.cargo\bin; - cargo fmt --all -- --check - displayName: 'Cargo fmt' - - - script: | - SET PATH=%PATH%;%USERPROFILE%\.cargo\bin; - cargo clippy --all -- -D clippy::pedantic -A clippy::non-ascii-literal - displayName: 'Cargo clippy' - - - script: | - SET PATH=%PATH%;%USERPROFILE%\.cargo\bin; - cargo build --release - displayName: 'Build' - - - task: PublishBuildArtifacts@1 - displayName: 'Publish Artifact: microserver' - inputs: - PathtoPublish: '$(System.DefaultWorkingDirectory)/target/release/microserver.exe' - ArtifactName: microserver-windows diff --git a/run.sh b/run.sh deleted file mode 100644 index 7faae40..0000000 --- a/run.sh +++ /dev/null @@ -1,3 +0,0 @@ -#!/bin/bash -cargo clippy --all -- -D clippy::pedantic -A clippy::non-ascii-literal -cargo fmt diff --git a/rustfmt.toml b/rustfmt.toml deleted file mode 100644 index 32a9786..0000000 --- a/rustfmt.toml +++ /dev/null @@ -1 +0,0 @@ -edition = "2018"