75 lines
2.3 KiB
YAML
75 lines
2.3 KiB
YAML
name: "Build and test"
|
|
on:
|
|
workflow_dispatch:
|
|
pull_request:
|
|
push:
|
|
jobs:
|
|
build:
|
|
runs-on: debian-latest
|
|
steps:
|
|
- uses: actions/checkout@v6
|
|
|
|
- name: Install sudo
|
|
run: apt-get update && apt-get -y install sudo
|
|
|
|
- name: Install nix
|
|
uses: https://github.com/cachix/install-nix-action@v31
|
|
with:
|
|
extra_nix_config: |
|
|
experimental-features = nix-command flakes
|
|
show-trace = true
|
|
max-jobs = auto
|
|
trusted-users = root
|
|
experimental-features = nix-command flakes
|
|
build-users-group =
|
|
|
|
- name: Update database inputs
|
|
run: |
|
|
nix flake update jmdict-src
|
|
nix flake update jmdict-with-examples-src
|
|
nix flake update radkfile-src
|
|
nix flake update kanjidic2-src
|
|
|
|
- name: Build database
|
|
run: nix build .#database -L
|
|
|
|
- name: Upload database as artifact
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: jadb-${{ gitea.sha }}.zip
|
|
path: result/jadb.sqlite
|
|
if-no-files-found: error
|
|
retention-days: 15
|
|
# Already compressed
|
|
compression: 0
|
|
|
|
- name: Print database statistics
|
|
run: nix develop .# --command sqlite3_analyzer result/jadb.sqlite
|
|
|
|
# TODO: Defer failure of tests until after the coverage report is generated and uploaded.
|
|
- name: Run tests
|
|
run: nix develop .# --command dart run test --concurrency=1 --coverage-path=coverage/lcov.info
|
|
|
|
- name: Generate coverage report
|
|
run: |
|
|
GENHTML_ARGS=(
|
|
--current-date="$(date)"
|
|
--dark-mode
|
|
--output-directory coverage/report
|
|
)
|
|
|
|
nix develop .# --command genhtml "${GENHTML_ARGS[@]}" coverage/lcov.info
|
|
|
|
- name: Upload coverage report
|
|
uses: https://git.pvv.ntnu.no/Projects/rsync-action@v2
|
|
with:
|
|
source: ./coverage
|
|
target: jadb/${{ gitea.ref_name }}/
|
|
username: oysteikt
|
|
ssh-key: ${{ secrets.OYSTEIKT_GITEA_WEBDOCS_SSH_KEY }}
|
|
host: microbel.pvv.ntnu.no
|
|
known-hosts: "microbel.pvv.ntnu.no ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBEq0yasKP0mH6PI6ypmuzPzMnbHELo9k+YB5yW534aKudKZS65YsHJKQ9vapOtmegrn5MQbCCgrshf+/XwZcjbM="
|
|
|
|
- name: Run benchmarks
|
|
run: nix develop .# --command dart run benchmark_harness:bench --flavor jit
|