Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We鈥檒l occasionally send you account related emails.

Already on GitHub? Sign in to your account

build: use nix in CI #616

Merged
merged 8 commits into from Jun 1, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
22 changes: 17 additions & 5 deletions .github/actions/yarn/action.yml
@@ -1,22 +1,34 @@
name: Yarn
description: Sets up the Yarn, the Yarn Cache, and installs

inputs:
cachix-auth-token:
required: true
description: "Your Cachix auth token."

runs:
using: composite
steps:
- uses: actions/setup-node@v2
# Install Cachix
- uses: cachix/install-nix-action@v17
- name: Setup Cachix
uses: cachix/cachix-action@v10
with:
node-version: "14"
name: saber
authToken: ${{ inputs.cachix-auth-token }}

# Install Node
- uses: actions/setup-node@v3
- name: Get yarn cache directory path
id: yarn-cache-dir-path
run: echo "::set-output name=dir::$(yarn config get cacheFolder)"
shell: bash
shell: nix shell .#ci --command bash {0}
- name: Yarn Cache
uses: actions/cache@v2
uses: actions/cache@v3
with:
path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
key: ${{ runner.os }}-modules-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-modules-
- run: yarn install
shell: bash
shell: nix shell .#ci --command bash {0}
14 changes: 14 additions & 0 deletions .github/workflows/main.yml
Expand Up @@ -6,12 +6,18 @@ on:
pull_request:
branches: [master]

defaults:
run:
shell: nix shell .#ci --command bash {0}

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/yarn
with:
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- run: yarn build
- run: yarn size

Expand All @@ -20,6 +26,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/yarn
with:
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- run: yarn build
- run: yarn typecheck

Expand All @@ -28,6 +36,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/yarn
with:
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- run: yarn build
- run: yarn test

Expand All @@ -36,6 +46,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/yarn
with:
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
- run: yarn build
- run: yarn lint:ci

Expand All @@ -44,6 +56,8 @@ jobs:
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/yarn
with:
cachix-auth-token: ${{ secrets.CACHIX_AUTH_TOKEN }}
# workaround b/c it's broken
- run: yarn plugin remove @yarnpkg/plugin-version
- run: yarn doctor packages/
2 changes: 1 addition & 1 deletion flake.nix
Expand Up @@ -14,7 +14,7 @@
rec {
packages.ci = pkgs.buildEnv {
name = "ci";
paths = with pkgs; [ nodejs yarn nixpkgs-fmt ];
paths = with pkgs; [ nodejs yarn nixpkgs-fmt bash ];
};
devShell = pkgs.mkShell { buildInputs = [ packages.ci ]; };
});
Expand Down
4 changes: 2 additions & 2 deletions package.json
Expand Up @@ -8,8 +8,8 @@
],
"lint-staged": {
"*.nix": "nixpkgs-fmt",
"*.{ts,tsx}": "eslint --cache --fix",
"*.{md,js,json,yml,yaml,css,md}": "prettier --write"
"*.{ts,tsx,mts,cts}": "eslint --cache --fix",
"*.{md,js,jsx,json,yml,yaml,css,md}": "prettier --write"
},
"devDependencies": {
"@babel/core": "^7.18.2",
Expand Down
2 changes: 1 addition & 1 deletion yarn.lock
Expand Up @@ -3238,7 +3238,7 @@ __metadata:
languageName: node
linkType: hard

"@types/react@npm:^18.0.10":
"@types/react@npm:^18.0.10, @types/react@npm:^18.0.9":
version: 18.0.10
resolution: "@types/react@npm:18.0.10"
dependencies:
Expand Down