From 986e44abbe3a3b43a580a0e49ae60992f7986c51 Mon Sep 17 00:00:00 2001 From: Efim Poberezkin Date: Mon, 11 Jan 2021 22:21:35 +0400 Subject: [PATCH 1/9] GitHub workflow for tests (#7) * ci: add github workflow for tests * ci: break test * ci: fix folder name * ci: fix test * ci: break test * fix test Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> --- workflows/ci.yml | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) create mode 100644 workflows/ci.yml diff --git a/workflows/ci.yml b/workflows/ci.yml new file mode 100644 index 0000000000..860b3b8c07 --- /dev/null +++ b/workflows/ci.yml @@ -0,0 +1,25 @@ +# Base: https://github.com/haskell/actions/tree/main/setup#usage + +name: CI + +on: + push: + branches: + - master + pull_request: + +jobs: + test: + + name: Tests + runs-on: ubuntu-latest # TODO matrix testing + + steps: + - uses: actions/checkout@v2 + - uses: haskell/actions/setup@v1 + with: + ghc-version: '8.8.3' # Exact version of ghc to use + # cabal-version: 'latest'. Omitted, but defalts to 'latest' + enable-stack: true + stack-version: 'latest' + - run: stack test From 8be832689a335f2e352d07a291b9ecfa13ed74fd Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Mon, 11 Jan 2021 19:23:36 +0000 Subject: [PATCH 2/9] rename workflow, build/version badges --- workflows/{ci.yml => build.yml} | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) rename workflows/{ci.yml => build.yml} (84%) diff --git a/workflows/ci.yml b/workflows/build.yml similarity index 84% rename from workflows/ci.yml rename to workflows/build.yml index 860b3b8c07..11ba564e1e 100644 --- a/workflows/ci.yml +++ b/workflows/build.yml @@ -1,6 +1,6 @@ # Base: https://github.com/haskell/actions/tree/main/setup#usage -name: CI +name: build on: push: @@ -19,7 +19,7 @@ jobs: - uses: haskell/actions/setup@v1 with: ghc-version: '8.8.3' # Exact version of ghc to use - # cabal-version: 'latest'. Omitted, but defalts to 'latest' + # cabal-version: 'latest'. Omitted, but defaults to 'latest' enable-stack: true stack-version: 'latest' - run: stack test From 8e52d78cf2005b5fbac4ae72320e405804f1ba9f Mon Sep 17 00:00:00 2001 From: Efim Poberezkin Date: Tue, 12 Jan 2021 21:55:15 +0400 Subject: [PATCH 3/9] ci: cache dependencies (#11) --- workflows/build.yml | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/workflows/build.yml b/workflows/build.yml index 11ba564e1e..d756219d43 100644 --- a/workflows/build.yml +++ b/workflows/build.yml @@ -10,16 +10,25 @@ on: jobs: test: - name: Tests runs-on: ubuntu-latest # TODO matrix testing - steps: - - uses: actions/checkout@v2 - - uses: haskell/actions/setup@v1 + - name: Clone project + uses: actions/checkout@v2 + + - name: Setup Stack + uses: haskell/actions/setup@v1 with: ghc-version: '8.8.3' # Exact version of ghc to use # cabal-version: 'latest'. Omitted, but defaults to 'latest' enable-stack: true stack-version: 'latest' - - run: stack test + + - name: Cache dependencies + uses: actions/cache@v2 + with: + path: ~/.stack + key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }} + + - name: Build and run tests + run: stack build --test From aedba41e16a82c52b1025c7fd227e99ef3dc3fca Mon Sep 17 00:00:00 2001 From: Efim Poberezkin Date: Thu, 4 Feb 2021 20:33:08 +0400 Subject: [PATCH 4/9] fix ghc version in build (#36) --- workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/workflows/build.yml b/workflows/build.yml index d756219d43..01b06da82d 100644 --- a/workflows/build.yml +++ b/workflows/build.yml @@ -9,8 +9,8 @@ on: pull_request: jobs: - test: - name: Tests + build: + name: build runs-on: ubuntu-latest # TODO matrix testing steps: - name: Clone project @@ -19,7 +19,7 @@ jobs: - name: Setup Stack uses: haskell/actions/setup@v1 with: - ghc-version: '8.8.3' # Exact version of ghc to use + ghc-version: '8.8.4' # cabal-version: 'latest'. Omitted, but defaults to 'latest' enable-stack: true stack-version: 'latest' From 0bce6e81738980bea4d26c553769fbbc36a7a006 Mon Sep 17 00:00:00 2001 From: Efim Poberezkin Date: Tue, 2 Mar 2021 22:30:59 +0400 Subject: [PATCH 5/9] check that sqlite library is compiled with threadsafe code (#63) --- workflows/build.yml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/workflows/build.yml b/workflows/build.yml index 01b06da82d..9fe1ba7ad0 100644 --- a/workflows/build.yml +++ b/workflows/build.yml @@ -30,5 +30,10 @@ jobs: path: ~/.stack key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }} + - name: Log SQLite default threading mode + run: | + sqlite3 test.db "pragma COMPILE_OPTIONS;" | grep THREADSAFE + rm test.db + - name: Build and run tests run: stack build --test From 4f20c2320135201c6a66cfcac44e8002a035c42a Mon Sep 17 00:00:00 2001 From: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com> Date: Sat, 3 Apr 2021 23:17:51 +0400 Subject: [PATCH 6/9] automate releases (#76) --- workflows/build.yml | 73 +++++++++++++++++++++++++++++++++++++-------- 1 file changed, 61 insertions(+), 12 deletions(-) diff --git a/workflows/build.yml b/workflows/build.yml index 9fe1ba7ad0..a28fb376ed 100644 --- a/workflows/build.yml +++ b/workflows/build.yml @@ -1,17 +1,60 @@ -# Base: https://github.com/haskell/actions/tree/main/setup#usage - name: build on: push: branches: - master + tags: + - "v*" pull_request: jobs: + prepare-release: + if: startsWith(github.ref, 'refs/tags/v') + runs-on: ubuntu-latest + steps: + - name: Clone project + uses: actions/checkout@v2 + + - name: Create release + uses: softprops/action-gh-release@v1 + with: + fail_on_unmatched_files: true + files: | + LICENSE + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + build: - name: build - runs-on: ubuntu-latest # TODO matrix testing + name: build-${{ matrix.os }} + if: always() + needs: prepare-release + runs-on: ${{ matrix.os }} + strategy: + fail-fast: false + matrix: + include: + - os: ubuntu-20.04 + cache_path: ~/.stack + stack_args: "--test" + artifact_rel_path: /bin/dog-food + asset_name: dog-food-ubuntu-20_04-x86-64 + - os: ubuntu-18.04 + cache_path: ~/.stack + stack_args: "--test" + artifact_rel_path: /bin/dog-food + asset_name: dog-food-ubuntu-18_04-x86-64 + # TODO re-enable tests for mac and windows when they consistently pass (remove stack_args altogether) + - os: macos-latest + cache_path: ~/.stack + stack_args: "" + artifact_rel_path: /bin/dog-food + asset_name: dog-food-macos-x86-64 + - os: windows-latest + cache_path: C:/sr + stack_args: "" + artifact_rel_path: /bin/dog-food.exe + asset_name: dog-food-windows-x86-64 steps: - name: Clone project uses: actions/checkout@v2 @@ -20,20 +63,26 @@ jobs: uses: haskell/actions/setup@v1 with: ghc-version: '8.8.4' - # cabal-version: 'latest'. Omitted, but defaults to 'latest' enable-stack: true stack-version: 'latest' - name: Cache dependencies uses: actions/cache@v2 with: - path: ~/.stack - key: ${{ runner.os }}-${{ hashFiles('stack.yaml') }} + path: ${{ matrix.cache_path }} + key: ${{ matrix.os }}-${{ hashFiles('stack.yaml') }} - - name: Log SQLite default threading mode + - name: Build & test + id: build_test run: | - sqlite3 test.db "pragma COMPILE_OPTIONS;" | grep THREADSAFE - rm test.db + stack build ${{ matrix.stack_args }} + echo "::set-output name=LOCAL_INSTALL_ROOT::$(stack path --local-install-root)" - - name: Build and run tests - run: stack build --test + - name: Upload binaries to release + if: startsWith(github.ref, 'refs/tags/v') + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: ${{ steps.build_test.outputs.LOCAL_INSTALL_ROOT }}${{ matrix.artifact_rel_path }} + asset_name: ${{ matrix.asset_name }} + tag: ${{ github.ref }} From ef944226b2db9fa7b0183545a9bf317e92295cd9 Mon Sep 17 00:00:00 2001 From: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com> Date: Fri, 9 Apr 2021 18:20:09 +0400 Subject: [PATCH 7/9] automate changelogs (#84) --- changelog_conf.json | 4 ++++ workflows/build.yml | 14 +++++++++++++- 2 files changed, 17 insertions(+), 1 deletion(-) create mode 100644 changelog_conf.json diff --git a/changelog_conf.json b/changelog_conf.json new file mode 100644 index 0000000000..e4c7eab9b1 --- /dev/null +++ b/changelog_conf.json @@ -0,0 +1,4 @@ +{ + "template": "${{UNCATEGORIZED}}", + "pr_template": "- ${{TITLE}}\n" +} diff --git a/workflows/build.yml b/workflows/build.yml index a28fb376ed..3ea55e0459 100644 --- a/workflows/build.yml +++ b/workflows/build.yml @@ -16,12 +16,24 @@ jobs: - name: Clone project uses: actions/checkout@v2 + - name: Build changelog + id: build_changelog + uses: mikepenz/release-changelog-builder-action@v1 + with: + configuration: .github/changelog_conf.json + failOnError: true + ignorePreReleases: true + commitMode: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + - name: Create release uses: softprops/action-gh-release@v1 with: - fail_on_unmatched_files: true + body: ${{ steps.build_changelog.outputs.changelog }} files: | LICENSE + fail_on_unmatched_files: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} From 7503ee9a3a5be6159be14de62e9d6ee53894a5dd Mon Sep 17 00:00:00 2001 From: Efim Poberezkin <8711996+efim-poberezkin@users.noreply.github.com> Date: Wed, 14 Apr 2021 02:25:57 +0400 Subject: [PATCH 8/9] tests: block on tcp server creation (#99) Co-authored-by: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> --- workflows/build.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/workflows/build.yml b/workflows/build.yml index 3ea55e0459..dd30dbb1db 100644 --- a/workflows/build.yml +++ b/workflows/build.yml @@ -56,12 +56,12 @@ jobs: stack_args: "--test" artifact_rel_path: /bin/dog-food asset_name: dog-food-ubuntu-18_04-x86-64 - # TODO re-enable tests for mac and windows when they consistently pass (remove stack_args altogether) - os: macos-latest cache_path: ~/.stack - stack_args: "" + stack_args: "--test" artifact_rel_path: /bin/dog-food asset_name: dog-food-macos-x86-64 + # TODO enable tests for windows once fixed (remove stack_args altogether) - os: windows-latest cache_path: C:/sr stack_args: "" From 8938a71ac6d8cb972949bc14c56458f11c3c17c9 Mon Sep 17 00:00:00 2001 From: Evgeny Poberezkin <2769109+epoberezkin@users.noreply.github.com> Date: Sun, 2 May 2021 21:33:45 +0100 Subject: [PATCH 9/9] move workflows --- changelog_conf.json => .github/changelog_conf.json | 0 {workflows => .github/workflows}/build.yml | 0 2 files changed, 0 insertions(+), 0 deletions(-) rename changelog_conf.json => .github/changelog_conf.json (100%) rename {workflows => .github/workflows}/build.yml (100%) diff --git a/changelog_conf.json b/.github/changelog_conf.json similarity index 100% rename from changelog_conf.json rename to .github/changelog_conf.json diff --git a/workflows/build.yml b/.github/workflows/build.yml similarity index 100% rename from workflows/build.yml rename to .github/workflows/build.yml