diff --git a/.github/actions/restore_cache_checkout/action.yml b/.github/actions/restore_cache_checkout/action.yml new file mode 100644 index 00000000000..5c5d366815e --- /dev/null +++ b/.github/actions/restore_cache_checkout/action.yml @@ -0,0 +1,9 @@ +name: restore_cache_checkout +runs: + using: composite + steps: + - name: restore_cache + uses: actions/cache@v3.3.2 + with: + key: v1-repo-{{ .Environment.${{ github.sha }} }} + path: UPDATE_ME diff --git a/.github/actions/run_yarn/action.yml b/.github/actions/run_yarn/action.yml new file mode 100644 index 00000000000..0af36ad4228 --- /dev/null +++ b/.github/actions/run_yarn/action.yml @@ -0,0 +1,21 @@ +name: run_yarn +runs: + using: composite + steps: + - name: restore_cache + uses: actions/cache@v3.3.2 + with: + key: v1-yarn-{{ .Branch }} + path: UPDATE_ME + restore-keys: v1-yarn-{{ .Branch }} + - name: Yarn Install + run: yarn install --frozen-lockfile --no-progress --non-interactive --cache-folder ~/.cache/yarn + working-directory: "~/react-native-website" + shell: bash + - name: save_cache + uses: actions/cache@v3.3.2 + with: + path: |- + node_modules + ~/.cache/yarn + key: v1-yarn-{{ .Branch }} diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml new file mode 100644 index 00000000000..bbf98719dee --- /dev/null +++ b/.github/workflows/tests.yml @@ -0,0 +1,49 @@ +name: facebook/react-native-website/tests +on: + push: + branches: + - main +jobs: + setup: + defaults: + run: + working-directory: "~/react-native-website" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.0 + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + - name: save_cache + uses: actions/cache@v3.3.2 + with: + path: "~/react-native-website" + key: v1-repo-{{ .Environment.${{ github.sha }} }} + lint: + defaults: + run: + working-directory: "~/react-native-website/website" + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4.1.0 + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + - uses: "./.github/actions/restore_cache_checkout" + - uses: "./.github/actions/run_yarn" + - run: yarn ci:lint + build: + defaults: + run: + working-directory: "~/react-native-website/website" + runs-on: ubuntu-latest + env: + NODE_OPTIONS: "--max_old_space_size=4096" + steps: + - uses: actions/checkout@v4.1.0 + - uses: actions/setup-node@v4 + with: + node-version: 'lts/*' + - uses: "./.github/actions/restore_cache_checkout" + - uses: "./.github/actions/run_yarn" + - run: yarn build