Skip to content

add ci

add ci #23

Workflow file for this run

name: 🔄 CI
on:
pull_request:
push:
branches: [main]
workflow_dispatch:
# Cancel in-progress runs of this workflow.
# See https://docs.github.com/en/actions/using-workflows/workflow-syntax-for-github-actions#example-only-cancel-in-progress-jobs-or-runs-for-the-current-workflow
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
env:
RW_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
jobs:
go:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: ./cli/go.sum
- run: make smoke-test
git:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: ./cli/go.sum
- run: make build
- uses: actions/setup-node@v4
with:
node-version: 20
- run: corepack enable
- run: mv /usr/local/bin/yarn /usr/local/bin/yarn-moved
- name: Doesn't require git config
run: ./rw create ${{ runner.temp }}/rw-test-no-git-config
- name: Works with git config
run: |
git config --global user.email "test@example.com"
git config --global user.name "test"
./rw create ${{ runner.temp }}/rw-test-git-config
- uses: actions/upload-artifact@v4
if: always()
with:
name: git-logs
path: ~/.rw/debug.json
node:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make build
- uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: ./cli/go.sum
- name: Errors if the node version is too low
run: |
# Disable immediate exit on error
set +e
./rw create ${{ runner.temp }}/rw-test-node-version-unmet
result=$?
set -e
if [ $result -eq 0 ]; then
echo "Command succeeded when it was expected to fail."
exit 1
else
echo "Command failed as expected."
exit 0
fi
- uses: actions/setup-node@v4
with:
node-version: 21
- run: corepack enable
- name: Allows node versions >= 20
run: |
./rw create ${{ runner.temp }}/rw-test-node-version-met
- uses: actions/upload-artifact@v4
if: always()
with:
name: node-logs
path: ~/.rw/debug.json
yarn:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- run: make build
- uses: actions/setup-go@v5
with:
go-version: '1.21'
cache-dependency-path: ./cli/go.sum
- uses: actions/setup-node@v4
with:
node-version: 20
- name: Errors if yarn is not used via corepack
run: |
TARGET_DIR="${{ runner.temp }}/rw-test"
./rw create $TARGET_DIR
- name: Errors if not all yarns are via corepack
run: |
corepack enable
TARGET_DIR="${{ runner.temp }}/rw-test"
./rw create $TARGET_DIR
- uses: actions/upload-artifact@v4
if: always()
with:
name: yarn-logs
path: ~/.rw/debug.json