diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..41680fc --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,34 @@ +on: + release: + types: [published] +permissions: + contents: write +jobs: + upload: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Pull submodules + run: git submodule update --init --recursive + - name: Set up Meson and Ninja + run: | + sudo apt-get update + sudo apt-get install -y meson ninja-build build-essential + - name: Build + run: | + meson build + ninja -C build + - name: Build sioworkers box + run: | + mkdir -p oicompare-sandbox/bin + cp build/oicompare oicompare-sandbox/bin + tar -czvf oicompare-sandbox-${{ github.event.release.tag_name }}.tar.gz oicompare-sandbox + - name: Upload to release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + cd build + tar -czvf ../oicompare-${{ github.event.release.tag_name }}.tar.gz oicompare + cd .. + gh release upload ${{ github.event.release.tag_name }} oicompare-${{ github.event.release.tag_name }}.tar.gz + gh release upload ${{ github.event.release.tag_name }} oicompare-sandbox-${{ github.event.release.tag_name }}.tar.gz \ No newline at end of file diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml new file mode 100644 index 0000000..ec64fe9 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,24 @@ +name: test +run-name: Run tests +on: + push: + branches: ['main'] + pull_request: +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - name: Pull submodules + run: git submodule update --init --recursive + - name: Set up Meson and Ninja + run: | + sudo apt-get update + sudo apt-get install -y meson ninja-build build-essential + - name: Build + run: | + meson build + ninja -C build + - name: Test + run: | + ninja -C build test diff --git a/oicompare.cc b/oicompare.cc index 6b7ff72..47b248f 100644 --- a/oicompare.cc +++ b/oicompare.cc @@ -76,6 +76,13 @@ parse_translation (std::string_view name) int main (int argc, char **argv) { + if (argc == 2 + && (std::string_view{argv[1]} == "--version"sv + || std::string_view{argv[1]} == "-v"sv)) + { + fmt::println ("oicompare version {}", oicompare::VERSION); + return EXIT_SUCCESS; + } if (argc < 3 || argc > 4) [[unlikely]] { fmt::println (stderr, "Usage: {} FILE1 FILE2 [TRANSLATION]", argv[0]); diff --git a/oicompare.hh b/oicompare.hh index 60a5426..b00968e 100644 --- a/oicompare.hh +++ b/oicompare.hh @@ -11,6 +11,9 @@ namespace oicompare { + +const std::string VERSION = "1.0.0"; + namespace detail { constexpr bool