Skip to content

Commit

Permalink
Testing
Browse files Browse the repository at this point in the history
  • Loading branch information
MonicaOlejniczak committed Jul 30, 2024
1 parent 73548a2 commit 2d44f09
Show file tree
Hide file tree
Showing 5 changed files with 14 additions and 153 deletions.
155 changes: 3 additions & 152 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,65 +6,18 @@ on:
push:
branches:
- v2
- molejniczak/asset-graph-request-tests

permissions:
contents: read

jobs:
lint:
name: Lint
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: yarn
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
components: rustfmt
# use `--frozen-lockfile` to fail immediately if the committed yarn.lock needs updates
# https://yarnpkg.com/lang/en/docs/cli/install/#toc-yarn-install-frozen-lockfile
- run: yarn --frozen-lockfile
- run: yarn lint

flow:
name: Flow
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: yarn
- run: yarn --frozen-lockfile
- run: yarn flow check

ts-types:
name: TypeScript types
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: yarn
- run: yarn --frozen-lockfile
- run: yarn build-ts

benchmarks:
name: Benchmarks
runs-on: ubuntu-latest
steps:
- name: PR Benchmarks
uses: parcel-bundler/parcel-benchmark-action@master
env:
PARCEL_BENCHMARK_APIKEY: ${{ secrets.PARCEL_BENCHMARK_APIKEY }}

unit_tests:
name: Unit tests (${{ matrix.os }}, Node ${{ matrix.node }})
strategy:
matrix:
node: [18, 20]
os: [ubuntu-latest, macos-latest, windows-latest]
node: [20]
os: [ubuntu-latest, windows-latest]
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
Expand Down Expand Up @@ -93,105 +46,3 @@ jobs:
packages/core/rust/index.d.ts
packages/core/rust/index.js
packages/core/rust/*.node
integration_tests:
name: Integration tests (${{ matrix.os }}, Node ${{ matrix.node }})
strategy:
matrix:
node: [18, 20]
os: [ubuntu-latest, macos-latest, windows-latest]
# These tend to be quite flakey, so one failed instance shouldn't stop
# others from potentially succeeding
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: yarn
node-version: ${{ matrix.node }}
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
- uses: Swatinem/rust-cache@v2
with:
shared-key: ${{ matrix.os }}
- name: Bump max inotify watches (Linux only)
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p;
if: ${{ runner.os == 'Linux' }}
- run: yarn --frozen-lockfile
- run: yarn build-native-release
- run: yarn build
- run: yarn test:integration-ci

# Deployment steps taken from https://github.com/colinwilson/static-site-to-vercel/blob/master/.github/workflows/deploy-preview.yml
repl_build:
name: Build REPL
if: ${{ github.event_name == 'pull_request' }}
runs-on: ubuntu-latest
permissions:
deployments: write
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
cache: yarn
node-version: 20
- uses: dtolnay/rust-toolchain@master
with:
toolchain: stable
targets: wasm32-unknown-unknown
- name: Install wasm-opt
run: |
curl -L -O https://github.com/WebAssembly/binaryen/releases/download/version_116/binaryen-version_116-x86_64-linux.tar.gz
tar -xf binaryen-version_116-x86_64-linux.tar.gz
echo "$PWD/binaryen-version_116/bin" >> $GITHUB_PATH
- uses: Swatinem/rust-cache@v2
with:
key: wasm
- name: Bump max inotify watches
run: echo fs.inotify.max_user_watches=524288 | sudo tee -a /etc/sysctl.conf && sudo sysctl -p;
- run: yarn --frozen-lockfile
- name: Build native packages
run: yarn build-native-release
- run: yarn build
- run: yarn build-native-wasm
- run: yarn workspace @parcel/repl build
# - name: Upload REPL
# uses: actions/upload-artifact@v3
# with:
# name: REPL
# path: 'packages/dev/repl/dist'
- name: Start Deployment
uses: bobheadxi/deployments@v1
id: deployment
with:
step: start
token: ${{ secrets.GITHUB_TOKEN }}
ref: ${{ github.head_ref }}
env: Preview
override: false
- name: Deploy to Vercel
uses: amondnet/vercel-action@v25
id: vercel-action
with:
vercel-token: ${{ secrets.REPL_VERCEL_TOKEN }}
vercel-org-id: ${{ secrets.REPL_VERCEL_ORG_ID }}
vercel-project-id: ${{ secrets.REPL_VERCEL_PROJECT_ID }}
github-comment: false
working-directory: packages/dev/repl
# vercel-args: '--prod'
scope: parcel
alias-domains: |
pr-{{PR_NUMBER}}.repl.parceljs.org
- name: Update Deployment Status
uses: bobheadxi/deployments@v1
if: always()
with:
step: finish
token: ${{ secrets.GITHUB_TOKEN }}
env: Preview
override: false
status: ${{ job.status }}
deployment_id: ${{ steps.deployment.outputs.deployment_id }}
env_url: ${{ steps.vercel-action.outputs.preview-url }}
3 changes: 3 additions & 0 deletions crates/parcel_plugin_resolver/src/resolver.rs
Original file line number Diff line number Diff line change
Expand Up @@ -301,6 +301,9 @@ impl ResolverPlugin for ParcelResolver {
.map(|p| Cow::Borrowed(p.as_path()))
.unwrap_or_else(|| Cow::Owned(self.options.project_root.join("index")));

println!("resolve_from: {}", resolve_from.display());
println!("ctx.specifier: {}", ctx.specifier);

let mut res = resolver.resolve_with_options(
&ctx.specifier,
&resolve_from,
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
"check": "flow check",
"lint": "eslint . && prettier \"./packages/*/*/{src,bin,test}/**/*.{js,json,md}\" --list-different && cargo fmt --all -- --check",
"prepublishOnly": "yarn adjust-versions && yarn build && yarn build-ts",
"test:unit": "cross-env NODE_ENV=test mocha --timeout 5000 && cargo test",
"test:unit": "cross-env && cargo test --package parcel --lib -- requests::asset_graph_request::test::test_asset_graph_request_with_a_couple_of_entries --exact --show-output",
"test:integration": "yarn workspace @parcel/integration-tests test",
"test:integration-ci": "yarn workspace @parcel/integration-tests test-ci",
"test": "yarn test:unit && yarn test:integration",
Expand Down
6 changes: 6 additions & 0 deletions packages/utils/node-resolver-rs/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,12 @@ impl<'a> ResolveRequest<'a> {
}

fn resolve(&self) -> Result<Resolution, ResolverError> {
println!(
"resolving {:?}, from {}",
self.specifier,
self.from.display()
);

match &self.specifier {
Specifier::Relative(specifier) => {
// Relative path
Expand Down
1 change: 1 addition & 0 deletions packages/utils/node-resolver-rs/src/path.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,5 +54,6 @@ pub fn resolve_path<A: AsRef<Path>, B: AsRef<Path>>(base: A, subpath: B) -> Path
}
}

println!("ret {}", ret.display());
ret
}

0 comments on commit 2d44f09

Please sign in to comment.