Skip to content

Commit

Permalink
Swap To GitHub Actions Running Tests (#273)
Browse files Browse the repository at this point in the history
* switch tests to Github Actions

* fix async rules as our website has changed

* use covector release branch

* build before test

* grab cert through mkcert

* use mkcert permalink

* rename directly

* debug

* use local bin

* trailing slash

* home env var

* /usr/local/bin with /Users/jacobbolda

* runner.home

* try env.HOME

* env in command, hardcoded for workdir

* composite action

* bash that shell

* skip ldap

* back to doctype?

* urls return differently
  • Loading branch information
jbolda authored May 24, 2024
1 parent 422b7ad commit e288625
Show file tree
Hide file tree
Showing 10 changed files with 161 additions and 150 deletions.
44 changes: 0 additions & 44 deletions .circleci/config.yml

This file was deleted.

18 changes: 18 additions & 0 deletions .github/actions/install-cert/action.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
name: "Install SSL Certificate"
description: "Greet someone"
runs:
using: "composite"
steps:
- run: wget https://dl.filippo.io/mkcert/latest?for=linux/amd64 -O mkcert
shell: bash
- run: chmod +x mkcert
shell: bash
- run: cp mkcert /usr/local/bin
shell: bash
- run: mkdir -p $HOME/.simulacrum/certs
shell: bash
- run: export NODE_EXTRA_CA_CERTS="$(mkcert -CAROOT)/rootCA.pem"
shell: bash
- run: mkcert -install && mkcert localhost
working-directory: /home/runner/.simulacrum/certs
shell: bash
4 changes: 2 additions & 2 deletions .github/workflows/covector-status.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,15 +6,15 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required for use of git history
- uses: volta-cli/action@v4
# this is required when running the ./.scripts/checkIfPublished.mjs
- name: Install Node.js dependencies
run: npm ci
- name: covector status
uses: jbolda/covector/packages/action@covector-v0.9
uses: jbolda/covector/packages/action@release
id: covector
with:
token: ${{ secrets.FRONTSIDEJACK_GITHUB_TOKEN }}
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/covector-version-or-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,10 @@ jobs:
successfulPublish: ${{ steps.covector.outputs.successfulPublish }}

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
fetch-depth: 0 # required for use of git history
- uses: actions/setup-node@v2
- uses: actions/setup-node@v4
with:
registry-url: "https://registry.npmjs.org"
- uses: volta-cli/action@v4
Expand All @@ -29,7 +29,7 @@ jobs:
git config --global user.name "${{ github.event.pusher.name }}"
git config --global user.email "${{ github.event.pusher.email }}"
- name: covector version or publish (publish when no change files present)
uses: jbolda/covector/packages/action@covector-v0.9
uses: jbolda/covector/packages/action@covector-v0
id: covector
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
Expand All @@ -46,7 +46,7 @@ jobs:

- name: Create Pull Request With Versions Bumped
id: cpr
uses: peter-evans/create-pull-request@v3
uses: peter-evans/create-pull-request@v6
if: steps.covector.outputs.commandRan == 'version'
with:
token: ${{ secrets.FRONTSIDEJACK_GITHUB_TOKEN }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
- name: Install Node.js dependencies
run: npm ci
Expand Down
20 changes: 20 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
name: Test

on: push

jobs:
run-tests:
name: Test
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
- uses: volta-cli/action@v4
- name: Install TLS Certificate
uses: ./.github/actions/install-cert

- name: Install Node.js dependencies
run: npm ci

- run: npm run build
- run: npm test
6 changes: 3 additions & 3 deletions packages/auth0/test/fixtures/rules-async-only/async-rule.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ fake async rule
// eslint-disable-next-line @typescript-eslint/no-unused-vars
async function asyncRule(user, context, callback) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
let fetch = require('node-fetch');
let fetch = require("node-fetch");

let fetcher = async (url) => {
let response = await fetch(url);
Expand All @@ -18,15 +18,15 @@ async function asyncRule(user, context, callback) {
// these is a contrived rule, but entirely possible
// that someone would run a fetch and attach output
// to the user as part of the token
let checkURLOne = 'https://www.frontside.com';
let checkURLOne = "https://frontside.com";
user.checkURLOne = checkURLOne;
let checkOne = await fetcher(checkURLOne);
user.checkURLOneStatus = checkOne.checkURLStatus;
user.checkURLOneText = checkOne.checkURLText.toLowerCase();

// this is a sub-site with various redirects to it should
// take some time to revolve
let checkURLTwo = 'https://www.frontside.com/effection';
let checkURLTwo = "https://frontside.com/effection";
user.checkURLTwo = checkURLTwo;
let checkTwo = await fetcher(checkURLTwo);
user.checkURLTwoStatus = checkTwo.checkURLStatus;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,17 @@ fake async rule
// eslint-disable-next-line @typescript-eslint/no-unused-vars
function syncWrapper(user, context, callback) {
// eslint-disable-next-line @typescript-eslint/no-var-requires
let fetch = require('node-fetch');
let fetch = require("node-fetch");

// these is a contrived rule, but entirely possible
// that someone would run a fetch and attach output
// to the user as part of the token
let checkURLOne = 'https://www.frontside.com';
let checkURLOne = "https://frontside.com";
user.checkURLOne = checkURLOne;

// this is a sub-site with various redirects to it should
// take some time to revolve
let checkURLTwo = 'https://www.frontside.com/effection';
let checkURLTwo = "https://frontside.com/effection";
user.checkURLTwo = checkURLTwo;

let fetcher = async (url) => {
Expand Down
Loading

0 comments on commit e288625

Please sign in to comment.