Skip to content

Commit

Permalink
Merge branch 'main' into opendata.swiss
Browse files Browse the repository at this point in the history
# Conflicts:
#	.github/workflows/test.yaml
#	package-lock.json
#	package.json
  • Loading branch information
tpluscode committed Dec 14, 2023
2 parents 3b48c38 + 2b69ad5 commit c648045
Show file tree
Hide file tree
Showing 44 changed files with 11,972 additions and 6,726 deletions.
14 changes: 11 additions & 3 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ jobs:
docker:
runs-on: ubuntu-latest

env:
DOCKER_IMAGE: ghcr.io/zazuko/cube-link

steps:
- name: Checkout
uses: actions/checkout@v4
Expand All @@ -32,11 +35,16 @@ jobs:
password: ${{ secrets.GITHUB_TOKEN }}

- name: Docker meta
uses: zazuko/action-docker-meta@main
id: docker_meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/zazuko/cube-link
include-pipeline-id: true
images: "${{ env.DOCKER_IMAGE }}"
tags: |
type=ref,event=branch
type=semver,prefix=v,pattern={{version}}
type=semver,prefix=v,pattern={{major}}.{{minor}}
type=semver,prefix=v,pattern={{major}}
type=sha
- name: Build and push Docker images
id: docker_build
Expand Down
14 changes: 13 additions & 1 deletion .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,20 @@ jobs:
name: Release
runs-on: ubuntu-latest
steps:
# This allow GitHub Actions to trigger the jobs for tags if needed
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v2
with:
app_id: ${{ secrets.GH_APP_ID }}
private_key: ${{ secrets.GH_PRIVATE_KEY }}

- name: Checkout Repo
uses: actions/checkout@v4
with:
# This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}

- name: Setup Node.js
uses: actions/setup-node@v3
Expand All @@ -29,5 +41,5 @@ jobs:
# This expects you to have a script called release which does a build for your packages and calls changeset publish
publish: yarn release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
58 changes: 51 additions & 7 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -1,14 +1,58 @@
name: Test
name: Test validation

on: [push, pull_request]

jobs:
test:
check-constraint:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Run tests
run: sh ./test/check-observations.sh

- name: Upload test results
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
name: test-observations
path: test

check-cube:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
profile:
- basic-cube-constraint
- standalone-constraint-constraint
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: Install dependencies
run: npm ci

- name: Run tests
run: ./test/check-metadata.sh --profile=${{ matrix.profile }}

- name: Upload test results
uses: actions/upload-artifact@v3
if: ${{ failure() }}
with:
node-version: 20
- run: npm ci
- run: bash ./test/profiles.sh
name: test-${{ matrix.profile }}
path: test
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1,4 @@
dist
node_modules
*.received.*
*.log
19 changes: 19 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,24 @@
# cube-link

## 0.1.3

### Patch Changes

- 86a40d7: In the CI, make sure to pull the Git repository with the token, to make sure it is able to trigger tags GitHub Actions workflows
- 7777e94: Generate Docker tags and labels using docker/metadata-action

## 0.1.2

### Patch Changes

- 6b78238: Bumping version only to trigger CI

## 0.1.1

### Patch Changes

- 09e2f3d: Forward profiles directly from GitHub

## 0.1.0

### Minor Changes
Expand Down
35 changes: 35 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,3 +20,38 @@ Otherwise, to get the latest version, fetch https://cube.link/latest/shape/stand
## How to Contribute

Please open [Issues](https://github.com/zazuko/cube-link/issues) on this repository or provide PRs for contributions.

## Testing

Automatic tests exist to validate cube constraints against maintained profiles, as well as tests
checking the observation against given cube constraints.

### Profile tests

```bash
./test/check-metadata.sh --profile=$PROFILE
```

`$PROFILE` must be the name of one of the profiles in the `validation` directory (without extension).

Test cases are turtle file under `test/$PROFILE` directory.

It is also possible to run only a subset of tests by providing a `--filter` argument. This argument
is a regular expression that is matched against the file name. For example, to run only `basic-cube-constraint`
tests which include the word "undefined":

```bash
./test/check-metadata.sh --profile=basic-cube-constraint --filter=undefined
```

### Observation tests

```bash
./test/check-observations.sh
```

Test cases are turtle file under `test/observations` directory.

This script also supports a `--filter` argument.

Both scripts allow a `--approved` flag to force-approve the current output as valid in case of differences.
Loading

0 comments on commit c648045

Please sign in to comment.