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’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Specs Overhaul + build system via Earthly #815

Merged
merged 36 commits into from
Dec 21, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
36 commits
Select commit Hold shift + click to select a range
c4251a4
feat: shard file generator specs
mdwagner Sep 21, 2023
46bb6aa
fix: app_sec_tester_template
mdwagner Dec 14, 2023
6d24701
fix: shard_file_template
mdwagner Dec 14, 2023
f858f1e
fix: app_sec_tester_template
mdwagner Dec 14, 2023
ff53c85
fix: browser_src_template
mdwagner Dec 14, 2023
813829f
fix: src_template
mdwagner Dec 14, 2023
758339a
feat(wip): skipping lucky spec...
mdwagner Dec 14, 2023
65a5900
fix: lucky spec
mdwagner Dec 14, 2023
69486d8
chore: ci with earthly
mdwagner Dec 14, 2023
b7aa028
fix: typo
mdwagner Dec 14, 2023
1331317
chore(wip): reusable workflow testing
mdwagner Dec 15, 2023
78a1c20
chore(wip): added missing secrets
mdwagner Dec 15, 2023
3443784
chore(wip): windows/mac ci
mdwagner Dec 15, 2023
1659802
chore(wip): forgot to install shards
mdwagner Dec 15, 2023
f001a43
fix: shardfile main path posix
mdwagner Dec 15, 2023
d826bd4
feat(wip): sec tester earthly
mdwagner Dec 15, 2023
c002303
chore(fix): yaml syntax
mdwagner Dec 15, 2023
f755be6
chore(wip): drop to node 14
mdwagner Dec 15, 2023
a235d57
chore(wip): removed nexploit package
mdwagner Dec 15, 2023
088145b
fix(wip): formatting and missing test
mdwagner Dec 15, 2023
498f2fc
chore(wip): reusable-earthly args
mdwagner Dec 15, 2023
f7ae64d
chore(wip): deps
mdwagner Dec 15, 2023
844eff6
chore(wip): trying out max 2 parallel
mdwagner Dec 16, 2023
5f80562
chore(wip): remove parallel max
mdwagner Dec 16, 2023
463b5f8
chore(wip): fix missing chrome
mdwagner Dec 16, 2023
d3d98d9
fix(wip): integration specs
mdwagner Dec 17, 2023
2542267
fix(wip): check patch
mdwagner Dec 17, 2023
2940c08
chore: rename
mdwagner Dec 18, 2023
4eecc1f
chore: rename to platform, missing needs
mdwagner Dec 18, 2023
8e4b4ab
chore(wip): dependabot + weekly
mdwagner Dec 18, 2023
1bf6a1b
fix: remove patch
mdwagner Dec 18, 2023
fc586ac
feat: overhaul specs
mdwagner Dec 19, 2023
e3707eb
fix: not nil
mdwagner Dec 19, 2023
01e752d
feat: sec tester xss + ci improvements
mdwagner Dec 19, 2023
178a94f
feat: better naming for specs
mdwagner Dec 19, 2023
e5442c1
chore: docs + readme
mdwagner Dec 21, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ updates:
- stephendolan

- package-ecosystem: npm
directory: "/src/browser-app-skeleton"
directory: "/fixtures/browser_src_template/expected"
schedule:
interval: daily
target-branch: main
versioning-strategy: increase
reviewers:
- stephendolan
- stephendolan
113 changes: 43 additions & 70 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,79 +7,52 @@ on:
branches: "*"

jobs:
check_format:
strategy:
fail-fast: false
runs-on: ubuntu-latest
continue-on-error: false
steps:
- uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: latest
- name: Install shards
run: shards install
- name: Format
run: crystal tool format --check
- name: Lint
run: ./bin/ameba

specs:
uses: ./.github/workflows/reusable-earthly.yml
with:
earthly-cmd: +gh-action-essential

platform-specs:
needs: specs
strategy:
fail-fast: false
matrix:
os: [ubuntu-latest]
crystal_version: [latest]
include:
- os: ubuntu-latest
crystal_version: 1.6.2
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
- {os: macos-latest}
- {os: windows-latest}
runs-on: ${{matrix.os}}
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal_version }}
- name: Cache node modules
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install CLI Dependencies
run: shards install --skip-postinstall --skip-executables
- name: Install Lucky CLI
run: |
crystal build src/lucky.cr
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path
# TL;DR => $GITHUB_PATH == PATH
pwd >> $GITHUB_PATH
- name: Run tests
run: |
export SHARDS_OVERRIDE="$(pwd)/${{ matrix.shard_override_file }}"
crystal spec
env:
LUCKY_ENV: test
RUN_SEC_TESTER_SPECS: 0
RUN_HEROKU_SPECS: 0
- uses: actions/checkout@v3
- uses: crystal-lang/install-crystal@v1
- name: Install shards
run: shards install
- name: Run specs
run: crystal spec --tag "~integration"

integration-specs:
needs: specs
uses: ./.github/workflows/reusable-earthly.yml
with:
earthly-cmd: +gh-action-integration

e2e-specs:
needs: integration-specs
uses: ./.github/workflows/reusable-earthly.yml
with:
earthly-cmd: +gh-action-e2e

e2e-security-specs:
needs: integration-specs
if: github.event_name == 'pull_request'
uses: ./.github/workflows/reusable-earthly.yml
with:
earthly-cmd: >-
--secret BRIGHT_TOKEN
--secret BRIGHT_PROJECT_ID
+gh-action-e2e-security
--github_ref=${{github.ref}}
--github_sha=${{github.sha}}
--github_run_id=${{github.run_id}}
secrets:
BRIGHT_TOKEN: ${{ secrets.BRIGHT_API_KEY }}
BRIGHT_PROJECT_ID: ${{ secrets.BRIGHT_PROJECT_ID }}
41 changes: 41 additions & 0 deletions .github/workflows/reusable-earthly.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Reusable Earthly workflow

on:
workflow_call:
inputs:
earthly-cmd:
required: true
type: string
secrets:
BRIGHT_TOKEN:
required: false
BRIGHT_PROJECT_ID:
required: false

jobs:
earthly:
runs-on: ubuntu-latest
env:
FORCE_COLOR: 1
steps:
- uses: earthly/actions-setup@v1
with:
version: v0.7.8
- uses: actions/checkout@v3
- name: Put back the git branch into git (Earthly uses it for tagging)
run: |
branch=""
if [ -n "$GITHUB_HEAD_REF" ]; then
branch="$GITHUB_HEAD_REF"
else
branch="${GITHUB_REF##*/}"
fi
git checkout -b "$branch" || true
- name: Earthly version
run: earthly --version
- name: Run build
run: |
earthly --ci --allow-privileged ${{ inputs.earthly-cmd }}
env:
BRIGHT_TOKEN: ${{ secrets.BRIGHT_TOKEN }}
BRIGHT_PROJECT_ID: ${{ secrets.BRIGHT_PROJECT_ID }}
65 changes: 0 additions & 65 deletions .github/workflows/security.yml

This file was deleted.

54 changes: 4 additions & 50 deletions .github/workflows/weekly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,53 +6,7 @@ on:
workflow_dispatch:

jobs:
specs:
strategy:
fail-fast: false
matrix:
include:
# NOTE: To catch potential issues on newer versions of packages
- os: ubuntu-latest
crystal_version: latest
shard_override_file: shard.edge.yml
# NOTE: To have more insight into upcoming Crystal versions
- os: ubuntu-latest
crystal_version: nightly
shard_override_file: shard.override.yml
runs-on: ${{ matrix.os }}
services:
postgres:
image: postgres:13
env:
POSTGRES_USER: postgres
POSTGRES_PASSWORD: postgres
ports:
- 5432:5432
# needed because the postgres container does not provide a healthcheck
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
steps:
- name: Checkout source
uses: actions/checkout@v4
- name: Install Crystal
uses: crystal-lang/install-crystal@v1
with:
crystal: ${{ matrix.crystal_version }}
- name: Run setup script
run: ./script/setup
- name: Install Lucky CLI
run: |
crystal build src/lucky.cr
# https://docs.github.com/en/actions/using-workflows/workflow-commands-for-github-actions#adding-a-system-path
# TL;DR => $GITHUB_PATH == PATH
pwd >> $GITHUB_PATH
- name: Run tests
run: |
export SHARDS_OVERRIDE="$(pwd)/${{ matrix.shard_override_file }}"
crystal spec
env:
LUCKY_ENV: test
RUN_SEC_TESTER_SPECS: 0
integration-specs:
uses: ./.github/workflows/reusable-earthly.yml
with:
earthly-cmd: +gh-action-weekly
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ lucky
/test-project/
node_modules
/tmp/
!/fixtures/*/expected/**/*

# Libraries don't need dependency lock
# Dependencies will be locked in application that uses them
Expand Down
Loading