From fe0aafabd17033cade215bdfeffa43aa04994551 Mon Sep 17 00:00:00 2001 From: maciektr Date: Thu, 20 Apr 2023 17:58:02 +0200 Subject: [PATCH] Add github actions example to docs Co-authored-by: Marek Kaput Signed-off-by: maciektr --- website/pages/docs/guides/_meta.json | 4 +- .../pages/docs/guides/using-scarb-in-ci.mdx | 56 +++++++++++++++++++ 2 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 website/pages/docs/guides/using-scarb-in-ci.mdx diff --git a/website/pages/docs/guides/_meta.json b/website/pages/docs/guides/_meta.json index df06ffdf0..f1a42e492 100644 --- a/website/pages/docs/guides/_meta.json +++ b/website/pages/docs/guides/_meta.json @@ -3,5 +3,7 @@ "working-on-an-existing-package": "", "dependencies": "", "formatting": "", - "defining-custom-scripts": "" + "defining-custom-profiles": "", + "defining-custom-scripts": "", + "using-scarb-in-ci": "" } diff --git a/website/pages/docs/guides/using-scarb-in-ci.mdx b/website/pages/docs/guides/using-scarb-in-ci.mdx new file mode 100644 index 000000000..a93c47d30 --- /dev/null +++ b/website/pages/docs/guides/using-scarb-in-ci.mdx @@ -0,0 +1,56 @@ +# Using Scarb in CI + +## Github Actions + +To use Scarb in your GitHub Actions workflow, you need to download the Scarb binary, unpack the archive, and add the +directory containing Scarb binary to your PATH variable. +You can find examples of the Scarb setup in the following `.github/workflows/build.yml` file, for Linux, macOS, and Windows. + +```yaml copy +name: Build Scarb project + +on: + workflow_dispatch: + +env: + SCARB_VERSION: v0.1.0 + +jobs: + build: + name: test ${{ matrix.name }} + runs-on: ${{ matrix.os }} + strategy: + matrix: + include: + - name: linux x86-64 + os: ubuntu-latest + - name: macos x86-64 + os: macos-latest + - name: windows x86-64 + os: windows-latest + steps: + - uses: actions/checkout@v3 + + - name: Setup Scarb for Linux + if: matrix.os == 'ubuntu-latest' + run: | + wget https://github.com/software-mansion/scarb/releases/download/${{ env.SCARB_VERSION }}/scarb-${{ env.SCARB_VERSION }}-x86_64-unknown-linux-gnu.tar.gz + tar -xvzf scarb-${{ env.SCARB_VERSION }}-x86_64-unknown-linux-gnu.tar.gz + echo "$GITHUB_WORKSPACE/scarb-${{ env.SCARB_VERSION }}-x86_64-unknown-linux-gnu/bin" >> $GITHUB_PATH + + - name: Setup Scarb for OSX + if: matrix.os == 'macos-latest' + run: | + wget https://github.com/software-mansion/scarb/releases/download/${{ env.SCARB_VERSION }}/scarb-${{ env.SCARB_VERSION }}-x86_64-apple-darwin.tar.gz + tar -xvzf scarb-${{ env.SCARB_VERSION }}-x86_64-apple-darwin.tar.gz + echo "$GITHUB_WORKSPACE/scarb-${{ env.SCARB_VERSION }}-x86_64-apple-darwin/bin" >> $GITHUB_PATH + + - name: Setup Scarb for Windows + if: matrix.os == 'windows-latest' + run: | + C:\msys64\usr\bin\wget.exe https://github.com/software-mansion/scarb/releases/download/${{ env.SCARB_VERSION }}/scarb-${{ env.SCARB_VERSION }}-x86_64-pc-windows-msvc.zip + 7z x scarb-${{ env.SCARB_VERSION }}-x86_64-pc-windows-msvc.zip + Add-Content $env:GITHUB_PATH "$env:GITHUB_WORKSPACE/scarb-${{ env.SCARB_VERSION }}-x86_64-pc-windows-msvc/bin" + + - run: scarb build +```