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

Add GitHub workflow #1

Merged
merged 3 commits into from
Sep 6, 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
34 changes: 34 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
@@ -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
24 changes: 24 additions & 0 deletions .github/workflows/test.yaml
Original file line number Diff line number Diff line change
@@ -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
7 changes: 7 additions & 0 deletions oicompare.cc
Original file line number Diff line number Diff line change
Expand Up @@ -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]);
Expand Down
3 changes: 3 additions & 0 deletions oicompare.hh
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

namespace oicompare
{

const std::string VERSION = "1.0.0";

namespace detail
{
constexpr bool
Expand Down