Skip to content

Commit

Permalink
Revert utilization of Nix in CI pipelines (#1741)
Browse files Browse the repository at this point in the history
  • Loading branch information
IMax153 authored Dec 5, 2023
1 parent d78be5b commit bd3432c
Show file tree
Hide file tree
Showing 7 changed files with 38 additions and 47 deletions.
27 changes: 12 additions & 15 deletions .github/actions/setup/action.yml
Original file line number Diff line number Diff line change
@@ -1,24 +1,21 @@
name: Setup
description: Perform standard setup and install dependencies using pnpm.
inputs:
node-version:
description: The version of Node.js to install
required: true
default: 20.9.0

runs:
using: composite
steps:
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- name: Get pnpm store directory
id: pnpm-cache
shell: bash
run: |
echo "STORE_PATH=$(nix develop --command -- pnpm store path --silent)" >> $GITHUB_ENV
- uses: actions/cache@v3
name: Cache pnpm
- name: Install pnpm
uses: pnpm/action-setup@v2
- name: Install node
uses: actions/setup-node@v3
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-
cache: pnpm
node-version: ${{ inputs.node-version }}
- name: Install dependencies
shell: bash
run: nix develop --command -- pnpm install --ignore-scripts
run: pnpm install --ignore-scripts
11 changes: 5 additions & 6 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,18 +22,17 @@ jobs:
fetch-depth: 0
- name: Install dependencies
uses: ./.github/actions/setup
- run: nix develop --command -- pnpm build
- run: pnpm build
- name: Check source state
run: nix develop --command -- git add src && git diff-index --cached HEAD --exit-code src
- run: nix develop --command -- pnpm circular
- run: nix develop --command -- pnpm docgen
run: git add src && git diff-index --cached HEAD --exit-code src
- run: pnpm circular
- name: Create Release Pull Request or Publish
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
id: changesets
uses: changesets/action@v1
with:
version: nix develop --command -- pnpm update-version
publish: nix develop --command -- pnpm changeset publish
version: pnpm update-version
publish: pnpm changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
6 changes: 3 additions & 3 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,6 @@ jobs:
- uses: actions/checkout@v3
- name: Install dependencies
uses: ./.github/actions/setup
- run: nix develop --command -- pnpm check
- run: nix develop --command -- pnpm lint
- run: nix develop --command -- pnpm dtslint
- run: pnpm check
- run: pnpm lint
- run: pnpm dtslint
4 changes: 1 addition & 3 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,9 +21,7 @@ jobs:
fetch-depth: 0
- name: Install dependencies
uses: ./.github/actions/setup
with:
cachixAuthToken: ${{ secrets.CACHIX_AUTH_TOKEN }}
- run: nix develop --command -- pnpm docgen
- run: pnpm docgen
- name: Build pages Jekyll
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
uses: actions/jekyll-build-pages@v1
Expand Down
16 changes: 8 additions & 8 deletions .github/workflows/snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -55,35 +55,35 @@ jobs:

- name: Get current branch name
id: branch
run: echo "branch=$(nix develop --command -- git branch --show-current)" >> $GITHUB_OUTPUT
run: echo "branch=$(git branch --show-current)" >> $GITHUB_OUTPUT

- name: Retrieve changeset entries
if: ${{ steps.branch.outputs.branch == 'changeset-release/main' }}
run: nix develop --command -- git checkout origin/main
run: git checkout origin/main

- name: Install dependencies
uses: ./.github/actions/setup

- name: Exit pre-release mode
if: ${{ hashFiles('.changeset/pre.json') != '' }}
run: nix develop --command -- pnpm changeset pre exit
run: pnpm changeset pre exit

- name: Version snapshot
run: nix develop --command -- pnpm changeset version --snapshot ${{ steps.command.outputs.snapshot }} | grep -q "All files have been updated"
run: pnpm changeset version --snapshot ${{ steps.command.outputs.snapshot }} | grep -q "All files have been updated"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Build snapshot
run: nix develop --command -- pnpm build
run: pnpm build

- name: Set registry config
run: nix develop --command -- pnpm config set --location project "//registry.npmjs.org/:_authToken" "${{ secrets.NPM_TOKEN }}"
run: pnpm config set --location project "//registry.npmjs.org/:_authToken" "${{ secrets.NPM_TOKEN }}"

- name: Publish snapshot
id: snapshot
run: |
# Publish and extract published tags from stdout.
output=$(nix develop --command -- pnpm changeset publish --tag ${{ steps.command.outputs.snapshot }} --no-git-tag)
output=$(pnpm changeset publish --tag ${{ steps.command.outputs.snapshot }} --no-git-tag)
output=$(echo "$output" | awk '/packages published successfully:/{flag=1; next} flag')
output=$(echo "$output" | grep -o '@[^ ]*' | awk '{print "\"" $0 "\""}' | paste -sd ',')
echo "tags=[$output]" >> $GITHUB_OUTPUT
Expand All @@ -94,7 +94,7 @@ jobs:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
script: |
const commands = ${{ steps.snapshot.outputs.tags }}.map(tag => '```sh\n' + `nix develop --command -- pnpm add ${tag}` + '\n```')
const commands = ${{ steps.snapshot.outputs.tags }}.map(tag => '```sh\n' + `pnpm add ${tag}` + '\n```')
const header = `**Good news @${{ github.actor }}, your snapshot has been published!**`
const footer = `You can review the build log [here](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}).`
Expand Down
14 changes: 9 additions & 5 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- uses: actions/checkout@v3
- name: Install dependencies
uses: ./.github/actions/setup
- run: nix develop --command -- pnpm vitest
- run: pnpm vitest

edge:
name: Edge
Expand All @@ -29,7 +29,7 @@ jobs:
- uses: actions/checkout@v3
- name: Install dependencies
uses: ./.github/actions/setup
- run: nix develop --command -- pnpm vitest --environment edge-runtime
- run: pnpm vitest --environment edge-runtime

browser:
name: Browser ${{ matrix.shard }} (${{ matrix.browser }})
Expand All @@ -43,7 +43,8 @@ jobs:
- uses: actions/checkout@v3
- name: Install dependencies
uses: ./.github/actions/setup
- run: nix develop --command pnpm vitest --browser ${{ matrix.browser }} --shard ${{ matrix.shard }}
- run: pnpm playwright install --with-deps ${{ matrix.browser }}
- run: pnpm vitest --browser ${{ matrix.browser }} --shard ${{ matrix.shard }}

bun:
name: Bun
Expand All @@ -54,7 +55,7 @@ jobs:
uses: ./.github/actions/setup
- name: Install bun
uses: oven-sh/setup-bun@v1
- run: nix develop --command -- bun vitest
- run: bun vitest

deno:
name: Deno
Expand All @@ -63,4 +64,7 @@ jobs:
- uses: actions/checkout@v3
- name: Install dependencies
uses: ./.github/actions/setup
- run: nix develop --command -- deno task test
- uses: denoland/setup-deno@v1
with:
deno-version: v1.x
- run: deno task test
7 changes: 0 additions & 7 deletions flake.nix
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@
deno
nodejs_20
];

nativeBuildInputs = lib.optionals (!stdenvNoCC.isDarwin) [
playwright-driver.browsers
];

PLAYWRIGHT_BROWSERS_PATH = lib.optionalString (!stdenvNoCC.isDarwin) "${playwright-driver.browsers}";
PLAYWRIGHT_SKIP_VALIDATE_HOST_REQUIREMENTS = lib.optionalString (!stdenvNoCC.isDarwin) "true";
};
};
});
Expand Down

0 comments on commit bd3432c

Please sign in to comment.