Skip to content

Commit

Permalink
chore: Setup CI and tests
Browse files Browse the repository at this point in the history
Create ci.yml

chore: add wasi-test-suite as a submodule

chore: remove legacy configuration files and scripts

chore: remove outdated redirection notice

chore: add git attributes to ensure text files use unix line endings

chore: format

test(http): copy tls testdata from denoland/deno
  • Loading branch information
caspervonb authored and bartlomieju committed Feb 1, 2021
1 parent bfe3281 commit d5bad95
Show file tree
Hide file tree
Showing 30 changed files with 428 additions and 355 deletions.
32 changes: 0 additions & 32 deletions .ci/check_source_file_changes.ts

This file was deleted.

8 changes: 0 additions & 8 deletions .ci/template.common.yml

This file was deleted.

5 changes: 0 additions & 5 deletions .ci/template.linux.yml

This file was deleted.

8 changes: 0 additions & 8 deletions .ci/template.mac.yml

This file was deleted.

3 changes: 0 additions & 3 deletions .ci/template.unix.yml

This file was deleted.

8 changes: 0 additions & 8 deletions .ci/template.windows.yml

This file was deleted.

4 changes: 0 additions & 4 deletions .eslintignore

This file was deleted.

39 changes: 0 additions & 39 deletions .eslintrc.json

This file was deleted.

2 changes: 2 additions & 0 deletions .gitattributes
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# Use Unix line endings in all text files.
* text=auto eol=lf
52 changes: 52 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
name: ci

on:
push:
branches: [ main ]
pull_request:
branches: [ main ]

jobs:
test:
runs-on: ${{ matrix.os }}
timeout-minutes: 30
strategy:
fail-fast: false
matrix:
deno-version: [nightly]
os: [macOS-latest, ubuntu-latest, windows-2019]

steps:
- name: Clone repository
uses: actions/checkout@v2
with:
submodules: true
persist-credentials: false

- name: Install Deno
uses: denolib/setup-deno@master
with:
deno-version: ${{ matrix.deno-version }}

- name: Test
run: deno test --unstable --allow-all

lint:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v2
with:
submodules: false
persist-credentials: false

- name: Install Deno
uses: denolib/setup-deno@master
with:
deno-version: nightly

- name: Format
run: deno fmt --check --ignore=node/tests/node_modules,hash/_wasm

- name: Lint
run: deno lint --unstable --ignore=node/tests/node_modules,hash/_wasm
4 changes: 4 additions & 0 deletions .gitmodules
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
[submodule "std/wasi/testdata"]
path = wasi/testdata
url = https://github.com/khronosproject/wasi-test-suite.git
shallow = true
9 changes: 0 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,3 @@
# NOTICE: The deno_std repository has been moved to the main Deno repo

https://github.com/denoland/deno/tree/master/std

All PRs and issues should be directed to denoland/deno, not here.

We are in a transitional phase now as we update various references to this
repository. Eventually this repo will be archived.

# Deno Standard Modules

These modules do not have external dependencies and they are reviewed by the
Expand Down
25 changes: 0 additions & 25 deletions azure-pipelines.yml

This file was deleted.

11 changes: 5 additions & 6 deletions encoding/base64.ts
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,11 @@ const base64abc = ["A", "B", "C", "D", "E", "F", "G", "H", "I", "J", "K", "L",
* @param data
*/
export function encode(data: ArrayBuffer | string): string {
const uint8 =
typeof data === "string"
? new TextEncoder().encode(data)
: data instanceof Uint8Array
? data
: new Uint8Array(data);
const uint8 = typeof data === "string"
? new TextEncoder().encode(data)
: data instanceof Uint8Array
? data
: new Uint8Array(data);
let result = "",
i;
const l = uint8.length;
Expand Down
32 changes: 0 additions & 32 deletions format.ts

This file was deleted.

8 changes: 4 additions & 4 deletions fs/testdata/empty_dir_sync.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
import { emptyDirSync } from "../empty_dir.ts";

try {
emptyDirSync(Deno.args[0])
Deno.stdout.write(new TextEncoder().encode("success"))
emptyDirSync(Deno.args[0]);
Deno.stdout.write(new TextEncoder().encode("success"));
} catch (err) {
Deno.stdout.write(new TextEncoder().encode(err.message))
}
Deno.stdout.write(new TextEncoder().encode(err.message));
}
11 changes: 6 additions & 5 deletions fs/testdata/exists.ts
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
import { exists } from "../exists.ts";

exists(Deno.args[0])
.then(isExist => {
Deno.stdout.write(new TextEncoder().encode(isExist ? 'exist' :'not exist'))
.then((isExist) => {
Deno.stdout.write(
new TextEncoder().encode(isExist ? "exist" : "not exist"),
);
})
.catch((err) => {
Deno.stdout.write(new TextEncoder().encode(err.message))
})

Deno.stdout.write(new TextEncoder().encode(err.message));
});
3 changes: 1 addition & 2 deletions hash/_wasm/build.ts
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@ async function encodeWasm(wasmPath: string): Promise<string> {
// 3. generate script
async function generate(wasm: string, output: string): Promise<void> {
const initScript = await Deno.readTextFile(`${output}/deno_hash.js`);
const denoHashScript =
"// deno-lint-ignore-file\n" +
const denoHashScript = "// deno-lint-ignore-file\n" +
"//deno-fmt-ignore-file\n" +
"//deno-lint-ignore-file\n" +
`import * as base64 from "../../encoding/base64.ts";` +
Expand Down
6 changes: 3 additions & 3 deletions hash/_wasm/hash.ts
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
// Copyright 2018-2021 the Deno authors. All rights reserved. MIT license.

import init, {
source,
create_hash as createHash,
update_hash as updateHash,
digest_hash as digestHash,
DenoHash,
digest_hash as digestHash,
source,
update_hash as updateHash,
} from "./wasm.js";

import * as hex from "../../encoding/hex.ts";
Expand Down
323 changes: 170 additions & 153 deletions hash/_wasm/wasm.js

Large diffs are not rendered by default.

1 change: 0 additions & 1 deletion http/testdata/tls

This file was deleted.

47 changes: 47 additions & 0 deletions http/testdata/tls/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
The certificates in this dir expire on Sept, 27th, 2118

Certificates generated using original instructions from this gist:
https://gist.github.com/cecilemuller/9492b848eb8fe46d462abeb26656c4f8

## Certificate authority (CA)

Generate RootCA.pem, RootCA.key, RootCA.crt:

```shell
openssl req -x509 -nodes -new -sha256 -days 36135 -newkey rsa:2048 -keyout RootCA.key -out RootCA.pem -subj "/C=US/CN=Example-Root-CA"
openssl x509 -outform pem -in RootCA.pem -out RootCA.crt
```

Note that Example-Root-CA is an example, you can customize the name.

## Domain name certificate

First, create a file domains.txt that lists all your local domains (here we only
list localhost):

```shell
authorityKeyIdentifier=keyid,issuer
basicConstraints=CA:FALSE
keyUsage = digitalSignature, nonRepudiation, keyEncipherment, dataEncipherment
subjectAltName = @alt_names
[alt_names]
DNS.1 = localhost
```

Generate localhost.key, localhost.csr, and localhost.crt:

```shell
openssl req -new -nodes -newkey rsa:2048 -keyout localhost.key -out localhost.csr -subj "/C=US/ST=YourState/L=YourCity/O=Example-Certificates/CN=localhost.local"
openssl x509 -req -sha256 -days 36135 -in localhost.csr -CA RootCA.pem -CAkey RootCA.key -CAcreateserial -extfile domains.txt -out localhost.crt
```

Note that the country / state / city / name in the first command can be
customized.

For testing purposes we need following files:

- `RootCA.crt`
- `RootCA.key`
- `RootCA.pem`
- `localhost.crt`
- `localhost.key`
19 changes: 19 additions & 0 deletions http/testdata/tls/RootCA.crt
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
-----BEGIN CERTIFICATE-----
MIIDIzCCAgugAwIBAgIJAMKPPW4tsOymMA0GCSqGSIb3DQEBCwUAMCcxCzAJBgNV
BAYTAlVTMRgwFgYDVQQDDA9FeGFtcGxlLVJvb3QtQ0EwIBcNMTkxMDIxMTYyODIy
WhgPMjExODA5MjcxNjI4MjJaMCcxCzAJBgNVBAYTAlVTMRgwFgYDVQQDDA9FeGFt
cGxlLVJvb3QtQ0EwggEiMA0GCSqGSIb3DQEBAQUAA4IBDwAwggEKAoIBAQDMH/IO
2qtHfyBKwANNPB4K0q5JVSg8XxZdRpTTlz0CwU0oRO3uHrI52raCCfVeiQutyZop
eFZTDWeXGudGAFA2B5m3orWt0s+touPi8MzjsG2TQ+WSI66QgbXTNDitDDBtTVcV
5G3Ic+3SppQAYiHSekLISnYWgXLl+k5CnEfTowg6cjqjVr0KjL03cTN3H7b+6+0S
ws4rYbW1j4ExR7K6BFNH6572yq5qR20E6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