From 1ebb1db091f4283775e280766b3258c76455978a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Szymon=20Giba=C5=82a?= Date: Sat, 20 Jun 2020 15:07:48 +0200 Subject: [PATCH] Add GitHub actions for PRs and release (#1) * Add GitHub actions for PRs and release --- .github/workflows/release.yaml | 37 +++++++++++++++++++++++++++++++ .github/workflows/rust-build.yaml | 18 +++++++++++++++ 2 files changed, 55 insertions(+) create mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/rust-build.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..a46575c --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,37 @@ +name: Create Release Artifacts +on: + release: + types: + - created +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest] + include: + - os: macos-latest + TARGET: x86_64-apple-darwin + - os: ubuntu-latest + TARGET: x86_64-unknown-linux-gnu + steps: + - uses: actions/checkout@v1 + - run: echo ${{matrix.TARGET}} + - name: Build Artifacts + run: cargo build --verbose --release --target ${{matrix.TARGET}} + - name: Rename Artifacts + run: mv ./target/${{matrix.TARGET}}/release/bookmark bookmark-${{matrix.TARGET}} + - name: Get Upload URL + run: | + UPLOAD_URL=$(jq --raw-output '.release.upload_url' "$GITHUB_EVENT_PATH") + echo ::set-env name=UPLOAD_URL::$UPLOAD_URL + - name: Upload Release Asset + id: upload-release-asset + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ env.UPLOAD_URL }} + asset_path: bookmark-${{matrix.TARGET}} + asset_name: bookmark-${{matrix.TARGET}} + asset_content_type: application/octet-stream diff --git a/.github/workflows/rust-build.yaml b/.github/workflows/rust-build.yaml new file mode 100644 index 0000000..32bc440 --- /dev/null +++ b/.github/workflows/rust-build.yaml @@ -0,0 +1,18 @@ +name: Build And Test +on: + push: + branches: [ master ] + pull_request: + branches: [ master ] +jobs: + build: + runs-on: ${{ matrix.os }} + strategy: + matrix: + os: [macos-latest, ubuntu-latest] + steps: + - uses: actions/checkout@v1 + - name: Run Tests + run: cargo test --verbose + - name: Build + run: cargo build --verbose --release