From b2ada0f775183091ecc7421193dd44f285e3bcab Mon Sep 17 00:00:00 2001 From: Richard Liang Date: Thu, 21 Nov 2024 14:29:38 -0800 Subject: [PATCH] Forgot to re-add the files that were renamed. --- .github/workflows/build_and_publish_gem.yml | 39 +++++++++++++++++++++ .github/workflows/unit_tests.yml | 37 +++++++++++++++++++ 2 files changed, 76 insertions(+) create mode 100644 .github/workflows/build_and_publish_gem.yml create mode 100644 .github/workflows/unit_tests.yml diff --git a/.github/workflows/build_and_publish_gem.yml b/.github/workflows/build_and_publish_gem.yml new file mode 100644 index 0000000..7e61d9d --- /dev/null +++ b/.github/workflows/build_and_publish_gem.yml @@ -0,0 +1,39 @@ +name: Build and publish the Ruby package + +on: + release: + types: [published] + +jobs: + build_gem: + runs-on: ubuntu-latest + steps: + - name: Checkout code from repo + uses: actions/checkout@v3 + + - name: Log into GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build devcontainer and build the package + uses: devcontainers/ci@v0.3 + with: + imageName: ghcr.io/cfe-lab/gotoh_devcontainer + cacheFrom: ghcr.io/cfe-lab/gotoh_devcontainer + runCmd: cd /workspaces/gotoh/ruby && bash build_gem.bash + env: | + CFE_GOTOH_VERSION=${{ github.ref_name }} + + - name: Publish gem to Github Packages + run: | + mkdir -p $HOME/.gem + touch $HOME/.gem/credentials + chmod 0600 $HOME/.gem/credentials + printf -- "---\n:github: Bearer ${GEM_HOST_API_KEY}\n" > $HOME/.gem/credentials + gem push --KEY github --host https://rubygems.pkg.github.com/${OWNER} *.gem + env: + GEM_HOST_API_KEY: ${{ secrets.GITHUB_TOKEN }} + OWNER: ${{ github.repository_owner }} diff --git a/.github/workflows/unit_tests.yml b/.github/workflows/unit_tests.yml new file mode 100644 index 0000000..56c955a --- /dev/null +++ b/.github/workflows/unit_tests.yml @@ -0,0 +1,37 @@ +name: Automated Tests + +on: ["push"] + +jobs: + test: + runs-on: ubuntu-latest + steps: + - name: Checkout code from repo + uses: actions/checkout@v3 + + - name: Log into GitHub Container Registry + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Build devcontainer and run tests + uses: devcontainers/ci@v0.3 + with: + imageName: ghcr.io/cfe-lab/gotoh_devcontainer + cacheFrom: ghcr.io/cfe-lab/gotoh_devcontainer + runCmd: cd /workspaces/gotoh/ruby && rake test + env: | + CI_COMMIT_REF=${{ github.ref_name }} + CI_COMMIT_SHA=${{ github.sha }} + CI_PIPELINE_ID=${{ github.run_id }} + CI_COMMIT_BRANCH=${{ github.ref_name }} + CI_PROJECT=${{ github.repository }} + + - name: Upload coverage reports to Codecov with GitHub Action + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} + root_dir: ${{ github.workspace }} + files: ${{ github.workspace }}/ruby/coverage/coverage.xml