diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..9d5d8fc --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,59 @@ +name: Publish + +on: + push: + tags: + - '*' + +jobs: + publish: + name: ${{ matrix.target }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + + - os: windows-latest + target: x86_64-pc-windows-msvc + + - os: macos-latest + target: x86_64-apple-darwin + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Set the version + id: version + run: echo ::set-output name=VERSION::${GITHUB_REF#refs/tags/} + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + target: ${{ matrix.target }} + + + - name: Build + run: cargo build --release --locked + + - name: Strip binary + if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest' + run: strip target/release/sd + + - name: Upload binaries to release + uses: svenstaro/upload-release-action@v1-release + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: target/release/sd + asset_name: sd-${{ steps.version.outputs.VERSION }}-${{ matrix.target }} + tag: ${{ github.ref }} diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml new file mode 100644 index 0000000..0fe9a2f --- /dev/null +++ b/.github/workflows/test.yml @@ -0,0 +1,39 @@ +name: Test + +on: [pull_request] + +jobs: + test: + name: ${{ matrix.target }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - os: ubuntu-latest + target: x86_64-unknown-linux-gnu + + - os: ubuntu-latest + target: x86_64-unknown-linux-musl + + - os: windows-latest + target: x86_64-pc-windows-msvc + + - os: macos-latest + target: x86_64-apple-darwin + + steps: + - name: Checkout repository + uses: actions/checkout@v2 + with: + fetch-depth: 1 + + - name: Install Rust + uses: actions-rs/toolchain@v1 + with: + toolchain: stable + profile: minimal + override: true + target: ${{ matrix.target }} + + - name: Test + run: cargo test diff --git a/azure-pipelines.yml b/azure-pipelines.yml deleted file mode 100644 index d51b8c7..0000000 --- a/azure-pipelines.yml +++ /dev/null @@ -1,37 +0,0 @@ -trigger: - branches: - include: ['*'] - tags: - include: ['*'] - -resources: - repositories: - - repository: rust_pipelines - type: github - name: xoac/rust-azure-pipelines - ref: refs/heads/master - endpoint: githubConnection -stages: -- stage: test - displayName: "Test" - jobs: - - template: ci/jobs/cargo-test.yaml@rust_pipelines - - #condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) -- stage: build - displayName: "Build" - jobs: - - template: ci/scenarios/builds.yml@rust_pipelines - dependsOn: - - test - -# Deploy binaries to github only if tags start with `v` for example `v0.1.5` -- stage: deploy - displayName: "Deploy" - dependsOn: - - build - jobs: - - template: ci/scenarios/github/release.yml@rust_pipelines - parameters: - job_condition: and(succeeded(), startsWith(variables['Build.SourceBranch'], 'refs/tags/v')) - gitHubConnection: githubConnection