4 posts about #CD/CI

Run your GitHub Actions locally with Act

Act is a tool that will let you run your GitHub Actions locally, very useful when you're debugging something that only happens during CI! Just keep in mind that the tool is still not mature and you'll have to boot up your required services manually.


Docker compose services with health checks

If you need to add extra checks for services to be up and running before starting another one, you can use healtcheck property:

    image: pg/pg-12
      - 5432:5432
      test: [ "CMD-SHELL", "pg_isready -U postgres" ]
      interval: 5s
      timeout: 5s
      retries: 5
    image: redis:5.0.4-alpine
      - 6380:6379
      test: [ "CMD", "redis-cli", "ping" ]
      interval: 5s
      timeout: 5s
      retries: 5
    image: railsapp
        condition: service_healthy
        condition: service_healthy
    ports: ['3000:3000']
    command: |
      bash -c "bundle exec rails s"

How to use my local browser and get access to the server on Circle CI with port-forwarding

This helped me to debug a failing test, that was only happening on the CircleCI Server.

How to do it?

  1. Go to Details Job Page on the Circle CI app and re-run the job as Rerun Job with SSH. image

  2. You should be able to find an additional step called Enable SSH, just expand it to see a command similar to this ssh -p 64625 ubuntu@ but with minor differences (the port number and IP address will be different). Copy the command into your terminal.

  3. Paste it and append this -L 3000:localhost:4000. With this, every request happening on the port 4000 (CircleCI server) will be forwarded to my local computer in the port 3000, so my local browser can reach the CircleCI server directly.

    $ ssh -p 64625 ubuntu@ -L 3000:localhost:4000

  4. Lastly, change of directory, go to your application folder and serve your app in port 4000.

    $ cd my-app-directory && <command to serve your app>

    In this example, I ran yarn run dev which runs a server on the port 4000.

  5. Go to the browser and visit the localhost:3000.

Test your CircleCi build locally

The CircleCI CLI allows you to locally validate your config.yml and run some or all non-parallelized jobs locally:
To Validate the config:
$ circleci config validate
To Run a job:
$ circleci local execute --job JOB_NAME
To Run the workflow:
circleci local execute
To know more visit the CircleCi Docs