-
Notifications
You must be signed in to change notification settings - Fork 13
chore(ci): Migrate from Travis to GH actions #367
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,95 @@ | ||
| name: CI | ||
|
|
||
| on: | ||
| push: | ||
| branches: [master] | ||
| pull_request: | ||
|
|
||
| jobs: | ||
| test: | ||
| runs-on: ubuntu-22.04 | ||
|
|
||
| services: | ||
| postgres: | ||
| image: postgres:14 | ||
| env: | ||
| POSTGRES_USER: travis | ||
| POSTGRES_HOST_AUTH_METHOD: trust | ||
| options: >- | ||
| --health-cmd pg_isready | ||
| --health-interval 10s | ||
| --health-timeout 5s | ||
| --health-retries 5 | ||
| ports: | ||
| - 5432:5432 | ||
|
|
||
| strategy: | ||
| fail-fast: false | ||
| matrix: | ||
| ruby: ['3.0', '3.1', '3.2', '3.3'] | ||
|
|
||
| env: | ||
| PGPORT: 5432 | ||
| PGUSER: travis | ||
| PGHOST: localhost | ||
|
|
||
| steps: | ||
| - uses: actions/checkout@v4 | ||
|
|
||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: ${{ matrix.ruby }} | ||
| bundler-cache: true | ||
|
|
||
| - name: Install yarn dependencies | ||
| run: yarn install | ||
|
|
||
| - name: Run tests | ||
| run: bundle exec rake test | ||
|
|
||
| release: | ||
| needs: test | ||
| runs-on: ubuntu-22.04 | ||
| if: github.ref == 'refs/heads/master' | ||
|
|
||
| permissions: | ||
| contents: write | ||
| id-token: write # required for RubyGems trusted publishing | ||
|
|
||
| steps: | ||
| - name: Generate GitHub App token | ||
| id: app-token | ||
| uses: actions/create-github-app-token@v1 | ||
| with: | ||
| app-id: ${{ secrets.RELEASE_BOT_APP_ID }} | ||
| private-key: ${{ secrets.RELEASE_BOT_PRIVATE_KEY }} | ||
|
|
||
| - uses: actions/checkout@v4 | ||
| with: | ||
| fetch-depth: 0 | ||
| token: ${{ steps.app-token.outputs.token }} | ||
|
|
||
| - uses: ruby/setup-ruby@v1 | ||
| with: | ||
| ruby-version: '3.0' | ||
| bundler-cache: true | ||
|
|
||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: lts/* | ||
|
|
||
| - name: Install semantic-release | ||
| run: | | ||
| npm i -g \ | ||
| semantic-release \ | ||
| @semantic-release/git \ | ||
| @semantic-release/changelog \ | ||
| semantic-release-rubygem | ||
|
|
||
| - name: Configure RubyGems credentials | ||
| uses: rubygems/configure-rubygems-credentials@v1 | ||
|
|
||
| - name: Release | ||
| env: | ||
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | ||
| run: ./release.sh | ||
This file was deleted.
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,17 +1,17 @@ | ||||||
| # Configuration variables: | ||||||
|
|
||||||
| * `GH_TOKEN`: used by `semantic-release` to push changes to Github and manage releases | ||||||
| * `GEM_HOST_API_KEY`: rubygems API key | ||||||
| * `GEM_ALTERNATIVE_NAME` (optional): used for testing of CI flows, | ||||||
| * `RELEASE_BOT_APP_ID`, `RELEASE_BOT_PRIVATE_KEY`: GitHub App credentials used to generate a token for `semantic-release` to push changes to GitHub and manage releases | ||||||
| * RubyGems publishing uses OIDC trusted publishing — no API key required | ||||||
| * `GEM_ALTERNATIVE_NAME` (optional): used for testing of CI flows, | ||||||
| to avoid publication of test releases under official package name | ||||||
|
|
||||||
| # Release command | ||||||
|
|
||||||
| `./release.sh` | ||||||
| `./release.sh` | ||||||
|
|
||||||
| Bash wrapper script is used merely as a launcher of `semantic-release` | ||||||
| with extra logic to explicitly determine git url from `TRAVIS_REPO_SLUG` \ | ||||||
| variable if its defined (otherwise git url is taken from `package.json`, | ||||||
| Bash wrapper script is used merely as a launcher of `semantic-release` | ||||||
| with extra logic to explicitly determine git url from `GITHUB_REPOSITORY` \ | ||||||
| variable if its defined (otherwise git url is taken from `package.json`, | ||||||
|
||||||
| variable if its defined (otherwise git url is taken from `package.json`, | |
| variable if it’s defined (otherwise git url is taken from `package.json`, |
| Original file line number | Diff line number | Diff line change | ||||||||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -2,9 +2,9 @@ | |||||||||||||||||||||
| # using bash wrapper as Rake blows up in `require/extentiontask` (line 10) | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| RELEASE_FLAGS="" | ||||||||||||||||||||||
| if [ ! -z "$TRAVIS_REPO_SLUG" ]; then | ||||||||||||||||||||||
| RELEASE_FLAGS="-r git+https://github.com/${TRAVIS_REPO_SLUG}.git" | ||||||||||||||||||||||
| fi | ||||||||||||||||||||||
| if [ ! -z "$GITHUB_REPOSITORY" ]; then | ||||||||||||||||||||||
| RELEASE_FLAGS="-r git+https://github.com/${GITHUB_REPOSITORY}.git" | ||||||||||||||||||||||
| fi | ||||||||||||||||||||||
|
|
||||||||||||||||||||||
| if [ ! -z "$GEM_ALTERNATIVE_NAME" ]; then | ||||||||||||||||||||||
|
Comment on lines
+5
to
9
|
||||||||||||||||||||||
| if [ ! -z "$GITHUB_REPOSITORY" ]; then | |
| RELEASE_FLAGS="-r git+https://github.com/${GITHUB_REPOSITORY}.git" | |
| fi | |
| if [ ! -z "$GEM_ALTERNATIVE_NAME" ]; then | |
| if [ -n "${GITHUB_REPOSITORY:-}" ]; then | |
| RELEASE_FLAGS="-r git+https://github.com/${GITHUB_REPOSITORY}.git" | |
| fi | |
| if [ -n "${GEM_ALTERNATIVE_NAME:-}" ]; then |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The Rails fixture apps'
config/database.ymldoesn't specify ahost, so libpq will default to a local Unix socket whenDATABASE_URLis unset. In GitHub Actions the Postgres service runs in a container, so connections must go over TCP; please setPGHOST=localhost(or setDATABASE_URLto includelocalhostand the mapped port) so tests can actually reach the service container.