From abab645a120ef191550e2c789d6fe8814c6b746a Mon Sep 17 00:00:00 2001 From: Mateusz Masiarz Date: Fri, 6 Sep 2024 15:21:50 +0200 Subject: [PATCH 1/3] Add test and release workflow --- .github/workflows/release.yaml | 32 ++++++++++++++++++++++++++++++++ .github/workflows/test.yaml | 22 ++++++++++++++++++++++ 2 files changed, 54 insertions(+) create mode 100644 .github/workflows/release.yaml create mode 100644 .github/workflows/test.yaml diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..3f2380c --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,32 @@ +on: + release: + types: [published] +permissions: + contents: write +jobs: + upload: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - 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..18290c7 --- /dev/null +++ b/.github/workflows/test.yaml @@ -0,0 +1,22 @@ +name: test +run-name: Run tests +on: + push: + branches: ['main'] + pull_request: +jobs: + test: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - 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 From e59da70b0bde7fa31fb5661f0d6d8157cb308eeb Mon Sep 17 00:00:00 2001 From: Mateusz Masiarz Date: Fri, 6 Sep 2024 15:29:09 +0200 Subject: [PATCH 2/3] Add versioning --- oicompare.cc | 7 +++++++ oicompare.hh | 3 +++ 2 files changed, 10 insertions(+) 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 From c6dc3e110dabb3018d3324a2bbd4ca9cf2581ebb Mon Sep 17 00:00:00 2001 From: Mateusz Masiarz Date: Fri, 6 Sep 2024 15:34:20 +0200 Subject: [PATCH 3/3] Pull submodules --- .github/workflows/release.yaml | 2 ++ .github/workflows/test.yaml | 2 ++ 2 files changed, 4 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 3f2380c..41680fc 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -8,6 +8,8 @@ jobs: 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 diff --git a/.github/workflows/test.yaml b/.github/workflows/test.yaml index 18290c7..ec64fe9 100644 --- a/.github/workflows/test.yaml +++ b/.github/workflows/test.yaml @@ -9,6 +9,8 @@ jobs: 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