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

ci: set config explicitly #73

Merged
merged 6 commits into from
Jun 12, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 4 additions & 1 deletion typos.toml → .github/typos.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,8 @@
extend-exclude = [
"*.snap",
"*.sum",
"*.mod"
"*.mod",
"*.csv",
"testdata.json"
]

40 changes: 9 additions & 31 deletions .github/workflows/build-explorer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,13 @@ permissions:
contents: read

jobs:
build-wasm:
name: Build WASM
uses: ./.github/workflows/build-wasm.yml

build_explorer:
runs-on: ubuntu-latest
needs: build-wasm
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
Expand Down Expand Up @@ -42,43 +47,16 @@ jobs:
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Setup Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: "go.mod"
cache: true
check-latest: true

- name: Setup Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.12.3'
check-latest: true
cache: 'pip'
cache-dependency-path: 'scripts/requirements.txt'

- name: Install node dependencies
working-directory: ./ui
run: |
pnpm install

- name: Setup Binaryen
# fixme: use acifani/setup-tinygo after pr acceptance
uses: Zxilly/setup-tinygo@da87f9a9d5f7f1fcd8b6fcbd0af84d8789742c34 # main
- name: Download WASM
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
install-tinygo: false
binaryen-version: '117'

- name: Add python dependencies
run: |
pip install -r scripts/requirements.txt

- name: Download deps
run: go mod download

- name: Build wasm
run: |
python scripts/wasm.py
name: wasm
path: ui/

- name: Build
working-directory: ./ui
Expand Down
4 changes: 1 addition & 3 deletions .github/workflows/build-gsa.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,9 +41,7 @@ jobs:
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: ui

- name: Move UI file
run: mv index.html internal/webui/index.html
path: internal/webui

- name: Setup Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
Expand Down
55 changes: 55 additions & 0 deletions .github/workflows/build-wasm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
name: Build WASM

on:
workflow_call:

permissions:
contents: read

jobs:
build_wasm:
name: Build Wasm
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0

- name: Setup Go
uses: actions/setup-go@cdcb36043654635271a94b9a6d1392de5bb323a7 # v5.0.1
with:
go-version-file: "go.mod"
cache: true
check-latest: true

- name: Setup Python
uses: actions/setup-python@82c7e631bb3cdc910f68e0081d67478d79c6982d # v5.1.0
with:
python-version: '3.12.3'
check-latest: true
cache: 'pip'
cache-dependency-path: 'scripts/requirements.txt'

- name: Setup Binaryen
# fixme: use acifani/setup-tinygo after pr acceptance
uses: Zxilly/setup-tinygo@da87f9a9d5f7f1fcd8b6fcbd0af84d8789742c34 # main
with:
install-tinygo: false
binaryen-version: '117'

- name: Add python dependencies
run: |
pip install -r scripts/requirements.txt

- name: Download deps
run: go mod download

- name: Build wasm
run: |
python scripts/wasm.py

- name: Upload wasm artifact
uses: actions/upload-artifact@65462800fd760344b1a7b4382951275a0abb4808 # v4.3.3
with:
path: 'ui/gsa.wasm'
name: wasm
86 changes: 86 additions & 0 deletions .github/workflows/tests-ui.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Tests UI

on:
push:
branches:
- master
pull_request:

permissions: read-all

jobs:
build-wasm:
name: Build WASM
uses: ./.github/workflows/build-wasm.yml

tests_ui:
name: Tests on UI
runs-on: ubuntu-latest
needs: build-wasm
permissions:
contents: write
checks: write
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '22'

- name: Set up pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
standalone: true
package_json_file: 'ui/package.json'
version: latest

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
working-directory: ./ui
run: pnpm install

- name: Download WASM
uses: actions/download-artifact@65a9edc5881444af0b9093a5e628f2fe47ea3b2e # v4.1.7
with:
name: wasm
path: ui/

- name: Run tests
working-directory: ./ui
run: pnpm test

- name: Upload coverage
if: ${{ !cancelled() }}
uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ui
name: Web UI tests
directory: ./ui
verbose: true

- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@1b5b448b98e58ba90d1a1a1d9fcb72ca2263be46 # v1.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: Web UI tests
flags: ui
file: ./ui/test-results.xml
verbose: true
65 changes: 0 additions & 65 deletions .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,71 +17,6 @@ jobs:
secrets:
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }}

tests_ui:
name: Tests on UI
runs-on: ubuntu-latest
permissions:
contents: write
checks: write
steps:
- name: Checkout
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6
with:
fetch-depth: 0

- name: Set up Node.js
uses: actions/setup-node@60edb5dd545a775178f52524783378180af0d1f8 # v4.0.2
with:
node-version: '21'

- name: Set up pnpm
uses: pnpm/action-setup@fe02b34f77f8bc703788d5817da081398fad5dd2 # v4.0.0
with:
standalone: true
package_json_file: 'ui/package.json'
version: latest

- name: Get pnpm store directory
shell: bash
run: |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV

- uses: actions/cache@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2
name: Setup pnpm cache
with:
path: ${{ env.STORE_PATH }}
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }}
restore-keys: |
${{ runner.os }}-pnpm-store-

- name: Install dependencies
working-directory: ./ui
run: pnpm install

- name: Run tests
working-directory: ./ui
run: pnpm test

- name: Upload coverage
if: ${{ !cancelled() }}
uses: codecov/codecov-action@125fc84a9a348dbcf27191600683ec096ec9021c # v4.4.1
with:
token: ${{ secrets.CODECOV_TOKEN }}
flags: ui
name: Web UI tests
directory: ./ui
verbose: true

- name: Upload test results to Codecov
if: ${{ !cancelled() }}
uses: codecov/test-results-action@1b5b448b98e58ba90d1a1a1d9fcb72ca2263be46 # v1.0.0
with:
token: ${{ secrets.CODECOV_TOKEN }}
name: Web UI tests
flags: ui
file: ./ui/test-results.xml
verbose: true

tests:
name: Tests
needs: build-ui
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/typo.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,6 @@ jobs:
uses: actions/checkout@a5ac7e51b41094c92402da3b24376905380afc29 # v4.1.6

- name: typos-action
uses: crate-ci/typos@acbff432fb0e7c8cbb9f032311d8f13927dbaaf3 # v1.22.4
uses: crate-ci/typos@acbff432fb0e7c8cbb9f032311d8f13927dbaaf3 # v1.22.4
with:
config: .github/typos.toml
Loading