Skip to content

Commit

Permalink
Add github actions example to docs
Browse files Browse the repository at this point in the history
Co-authored-by: Marek Kaput <[email protected]>
Signed-off-by: maciektr <[email protected]>
  • Loading branch information
maciektr and mkaput committed Apr 20, 2023
1 parent 8e4e125 commit fe0aafa
Show file tree
Hide file tree
Showing 2 changed files with 59 additions and 1 deletion.
4 changes: 3 additions & 1 deletion website/pages/docs/guides/_meta.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,7 @@
"working-on-an-existing-package": "",
"dependencies": "",
"formatting": "",
"defining-custom-scripts": ""
"defining-custom-profiles": "",
"defining-custom-scripts": "",
"using-scarb-in-ci": ""
}
56 changes: 56 additions & 0 deletions website/pages/docs/guides/using-scarb-in-ci.mdx
Original file line number Diff line number Diff line change
@@ -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
```

0 comments on commit fe0aafa

Please sign in to comment.