diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..b5145a2 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,34 @@ +name: build test lint + +on: [push] + +jobs: + build: + runs-on: ubuntu-latest + + strategy: + matrix: + include: + - rust: stable + - rust: nightly + + steps: + - uses: actions/checkout@v2 + - uses: actions-rs/toolchain@v1 + with: + toolchain: ${{ matrix.rust }} + + - name: build + uses: actions-rs/cargo@v1 + with: + command: build + + - name: test + uses: actions-rs/cargo@v1 + with: + command: test + + - name: lint + uses: actions-rs/clippy-check@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..2baa847 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,39 @@ +name: Make a release + +on: + repository_dispatch: + types: [tag-created] + +jobs: + release: + name: Build and Release + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + artifact_name: http-server + asset_name: http-server-$tag-linux-amd64.zip + - os: macos-latest + artifact_name: http-server + asset_name: http-server-$tag-macos-amd64.zip + - os: windows-latest + artifact_name: http-server.exe + asset_name: http-server-$tag-windows.zip + steps: + - uses: actions/checkout@v2 + + - name: Build project + run: cargo build --release --locked + + - name: Pre-release + run: | + strip target/release/${{ matrix.artifact_name }} + zip ${{ matrix.asset_name }} -j target/release/${{ matrix.artifact_name }} + + - name: Upload binary to release + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ matrix.asset_name }} + tag: ${{ github.event.client_payload.new_version }} diff --git a/.travis.yml b/.travis.yml deleted file mode 100644 index caadeac..0000000 --- a/.travis.yml +++ /dev/null @@ -1,39 +0,0 @@ -language: rust -rust: stable -cache: cargo -sudo: false - -env: - global: - - PROJECT_NAME=http-server - -matrix: - include: - - os: osx - env: TARGET=x86_64-apple-darwin - - os: linux - env: TARGET=x86_64-unknown-linux-gnu - - os: windows - env: TARGET=x86_64-pc-windows-msvc SUFFIX=.exe - -script: - - cargo build ${TRAVIS_TAG:+--release} --target $TARGET - - size target/$TARGET/*/${PROJECT_NAME}${SUFFIX} - -before_deploy: - - if [ "$TRAVIS_OS_NAME" = "windows" ]; then choco install zip ; fi - - strip "target/$TARGET/release/${PROJECT_NAME}${SUFFIX}" - - zip ${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.zip -j "target/$TARGET/release/${PROJECT_NAME}${SUFFIX}" - -deploy: - provider: releases - api_key: $GIT_TOKEN - file: ${PROJECT_NAME}-${TRAVIS_TAG}-${TARGET}.zip - # don't delete the artifacts from previous phases - skip_cleanup: true - overwrite: true - # deploy when a new tag is pushed - on: - # channel to use to produce the release artifacts - condition: $TRAVIS_RUST_VERSION = stable - tags: true