Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions .github/workflows/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2019

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
41 changes: 41 additions & 0 deletions .github/workflows/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
![act-logo](https://raw.githubusercontent.com/wiki/nektos/act/img/logo-150.png)

# Overview [![push](https://github.com/nektos/act/workflows/push/badge.svg?branch=master&event=push)](https://github.com/nektos/act/actions) [![Join the chat at https://gitter.im/nektos/act](https://badges.gitter.im/nektos/act.svg)](https://gitter.im/nektos/act?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge) [![Go Report Card](https://goreportcard.com/badge/github.com/nektos/act)](https://goreportcard.com/report/github.com/nektos/act) [![awesome-runners](https://img.shields.io/badge/listed%20on-awesome--runners-blue.svg)](https://github.com/jonico/awesome-runners)

> "Think globally, `act` locally"

Run your [GitHub Actions](https://developer.github.com/actions/) locally! Why would you want to do this? Two reasons:

- **Fast Feedback** - Rather than having to commit/push every time you want to test out the changes you are making to your `.github/workflows/` files (or for any changes to embedded GitHub actions), you can use `act` to run the actions locally. The [environment variables](https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables) and [filesystem](https://help.github.com/en/actions/reference/virtual-environments-for-github-hosted-runners#filesystems-on-github-hosted-runners) are all configured to match what GitHub provides.
- **Local Task Runner** - I love [make](<https://en.wikipedia.org/wiki/Make_(software)>). However, I also hate repeating myself. With `act`, you can use the GitHub Actions defined in your `.github/workflows/` to replace your `Makefile`!

> [!TIP]
> **Now Manage and Run Act Directly From VS Code!**<br/>
> Check out the [GitHub Local Actions](https://sanjulaganepola.github.io/github-local-actions-docs/) Visual Studio Code extension which allows you to leverage the power of `act` to run and test workflows locally without leaving your editor.

# How Does It Work?

When you run `act` it reads in your GitHub Actions from `.github/workflows/` and determines the set of actions that need to be run. It uses the Docker API to either pull or build the necessary images, as defined in your workflow files and finally determines the execution path based on the dependencies that were defined. Once it has the execution path, it then uses the Docker API to run containers for each action based on the images prepared earlier. The [environment variables](https://help.github.com/en/actions/configuring-and-managing-workflows/using-environment-variables#default-environment-variables) and [filesystem](https://docs.github.com/en/actions/using-github-hosted-runners/about-github-hosted-runners#file-systems) are all configured to match what GitHub provides.

Let's see it in action with a [sample repo](https://github.com/cplee/github-actions-demo)!

![Demo](https://raw.githubusercontent.com/wiki/nektos/act/quickstart/act-quickstart-2.gif)

# Act User Guide

Please look at the [act user guide](https://nektosact.com) for more documentation.

# Support

Need help? Ask on [Gitter](https://gitter.im/nektos/act)!

# Contributing

Want to contribute to act? Awesome! Check out the [contributing guidelines](CONTRIBUTING.md) to get involved.

## Manually building from source

- Install Go tools 1.20+ - (<https://golang.org/doc/install>)
- Clone this repo `git clone git@github.com:nektos/act.git`
- Run unit tests with `make test`
- Build and install: `make install`
Binary file added .github/workflows/act_Linux_x86_64.tar.gz
Binary file not shown.
Binary file added .github/workflows/act_Linux_x86_64.tar.gz.1
Binary file not shown.
61 changes: 23 additions & 38 deletions .github/workflows/ci-build-proto.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: "build protobufs"
name: "Build Protobufs"

on:
push:
Expand All @@ -14,24 +14,18 @@ on:

jobs:
build:

strategy:
matrix:
# We only test on the oldest version we want to support and latest.
# We trust that things also work for versions in the middle.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removing these comments seems like the wrong thing to do, unless you know that they are obsolete or wrong. If they are correct, they were written by someone who wanted to remember the reason that the lines of code were added, and why they were written in this way. That is valuable information, and should not be discarded.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok I will add them back

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are many more such comments removed elsewhere in your PR. My comment applies to all of those changes, not only the ones that I directly commented on.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please, please look at the diffs of your PR on the Github web site to see if it is what you think it should be. Without doing that, you might be proposing changes in the PR that you forgot you made, or never even intended to make.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ok I will add back all those changes in comments

os: [ubuntu-22.04, ubuntu-latest]
# See Bazelisk README for legal values.
bazel_version: [7.x, latest]
# Don't abort other runs when one of them fails, to ease debugging.
fail-fast: false

runs-on: ${{ matrix.os }}

env:
# This tells Bazelisk (installed as `bazel`) to use specified version.
# https://github.com/bazelbuild/bazelisk?tab=readme-ov-file#how-does-bazelisk-know-which-bazel-version-to-run
USE_BAZEL_VERSION: ${{ matrix.bazel_version }}
CACHE_KEY: ${{ matrix.os }}_bazel-${{ matrix.bazel_version }}
BAZEL_DISK_CACHE: ~/.cache/bazel-disk

steps:
- uses: actions/checkout@v4
Expand All @@ -41,10 +35,9 @@ jobs:
- name: Mount bazel cache
uses: actions/cache/restore@v4
with:
# See https://docs.bazel.build/versions/master/output_directories.html
path: "~/.cache/bazel"
# Create a new cache entry whenever Bazel files change.
# See https://docs.github.com/en/actions/guides/caching-dependencies-to-speed-up-workflows
path: |
~/.cache/bazel
~/.cache/bazel-disk
key: ${{ env.CACHE_KEY }}-${{ hashFiles('**/*.bazel*', '**/*.bzl') }}
restore-keys: |
${{ env.CACHE_KEY }}
Expand All @@ -53,53 +46,45 @@ jobs:
uses: josStorer/get-current-time@v2
id: start-time
with:
# Unix timestamp -- seconds since 1970.
format: X

- name: Build proto/
run: cd proto && bazel build //... && bazel test //...
- name: Build Protos
run: |
cd proto
bazel build //... --disk_cache=${{ env.BAZEL_DISK_CACHE }} --jobs=$(nproc)
bazel test //... --test_output=errors --jobs=$(nproc)

- name: Build bazel/example/using-bzlmod/
run: cd bazel/example/using-bzlmod && bazel build //...
- name: Build Bzlmod Example
run: |
cd bazel/example/using-bzlmod
bazel build //... --disk_cache=${{ env.BAZEL_DISK_CACHE }} --jobs=$(nproc)

- name: Build bazel/example/using-workspace/
run: cd bazel/example/using-workspace && bazel build //...
# This is a legacy example that doesn't work beyond Bazel 7.x.
- name: Build Workspace Example (Only for Bazel 7.x)
if: ${{ env.USE_BAZEL_VERSION == '7.x' }}
run: |
cd bazel/example/using-workspace
bazel build //... --disk_cache=${{ env.BAZEL_DISK_CACHE }} --jobs=$(nproc)

- name: Save end time
# Always save the end time so we can calculate the build duration.
if: always()
uses: josStorer/get-current-time@v2
id: end-time
with:
# Unix timestamp -- seconds since 1970.
format: X

- name: Calculate build duration
# Always calculate the build duration so we can update the cache if needed.
- name: Calculate Build Duration
if: always()
run: |
START=${{ steps.start-time.outputs.formattedTime }}
END=${{ steps.end-time.outputs.formattedTime }}
DURATION=$(( $END - $START ))
DURATION=$(( END - START ))
echo "duration=$DURATION" | tee "$GITHUB_ENV"

- name: Compress cache
# Always compress the cache so we can update the cache if needed.
if: always()
run: rm -rf $(bazel info repository_cache)

- name: Save bazel cache
uses: actions/cache/save@v4
# Only create a new cache entry if we're on the main branch or the build takes >3mins.
#
# NOTE: Even though `always()` evaluates to true, and `true && x == x`,
# the `always() &&` prefix is not redundant! The call to `always()` has a
# side effect, which is to override the default behavior of automagically
# canceling this step if a previous step failed.
# (Don't blame me, blame GitHub Actions!)
if: always() && (github.ref_name == 'main' || env.duration > 180)
with:
path: "~/.cache/bazel"
path: |
~/.cache/bazel
~/.cache/bazel-disk
key: ${{ env.CACHE_KEY }}-${{ hashFiles('**/*.bazel*', '**/*.bzl') }}-${{ github.run_id }}