From e603d88049c45e5d553deaa9268e66b18cb180f4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Sebasti=C3=A1n=20Estrella?= <2049686+sestrella@users.noreply.github.com> Date: Thu, 30 Nov 2023 10:55:19 -0500 Subject: [PATCH] CI improvements (#11) --- .github/workflows/build.yml | 35 +++++++++++++++++++++++ .github/workflows/ci.yml | 54 ----------------------------------- .github/workflows/release.yml | 22 ++++++++++++++ README.md | 3 +- 4 files changed, 59 insertions(+), 55 deletions(-) create mode 100644 .github/workflows/build.yml delete mode 100644 .github/workflows/ci.yml create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..31673f6 --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,35 @@ +--- +name: build + +on: push + +concurrency: + group: build-${{ github.ref }} + cancel-in-progress: true + +jobs: + test: + strategy: + matrix: + os: + - macos-latest + - ubuntu-latest + fail-fast: true + runs-on: ${{ matrix.os }} + steps: + - name: Checkout code + uses: actions/checkout@v4 + with: + submodules: true + - name: Remove GHCup + run: ghcup nuke + - name: Check GHCup is not present + run: "! command -v ghcup" + shell: bash + - name: Run unit tests + run: ./test/bats/bin/bats -T test + - name: Run integration tests + uses: asdf-vm/actions/plugin-test@v3 + with: + plugin: ghc + command: ghc --version diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml deleted file mode 100644 index 94c89aa..0000000 --- a/.github/workflows/ci.yml +++ /dev/null @@ -1,54 +0,0 @@ ---- -name: CI - -on: push - -concurrency: - group: ci-${{ github.ref }} - cancel-in-progress: true - -jobs: - bats: - strategy: - matrix: - runner: - - macos-latest - - ubuntu-latest - - runs-on: ${{ matrix.runner }} - steps: - - uses: actions/checkout@v3 - with: - submodules: true - - run: ghcup nuke - - run: ./test/bats/bin/bats -T test - - plugin_test: - strategy: - matrix: - runner: - - macos-latest - - ubuntu-latest - - runs-on: ${{ matrix.runner }} - steps: - - uses: asdf-vm/actions/plugin-test@v2 - with: - plugin: ghc - command: ghc --version - - release: - runs-on: ubuntu-latest - needs: - - bats - - plugin_test - steps: - - uses: actions/checkout@v3 - - uses: actions/setup-node@v3 - with: - node-version: lts/* - cache: npm - - run: npm install - - run: npx semantic-release - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..af5ae10 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,22 @@ +name: release + +on: + workflow_run: + workflows: [build] + types: [completed] + branches: [main] + +jobs: + release: + if: ${{ github.event.workflow_run.conclusion == 'success' }} + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + - uses: actions/setup-node@v4 + with: + node-version: lts/* + cache: npm + - run: npm ci + - run: npx semantic-release + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/README.md b/README.md index e16e725..1e71804 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,7 @@ # asdf-ghcup -[![CI](https://github.com/sestrella/asdf-ghcup/actions/workflows/ci.yml/badge.svg)](https://github.com/sestrella/asdf-ghcup/actions/workflows/ci.yml) +[![build](https://github.com/sestrella/asdf-ghcup/actions/workflows/build.yml/badge.svg)](https://github.com/sestrella/asdf-ghcup/actions/workflows/build.yml) +[![release](https://github.com/sestrella/asdf-ghcup/actions/workflows/release.yml/badge.svg)](https://github.com/sestrella/asdf-ghcup/actions/workflows/release.yml) An asdf plugin wrapping [GHCup](https://www.haskell.org/ghcup).