update gh workflow actions (#1809)

This commit is contained in:
Vitalij Dovhanyc 2024-03-13 13:43:06 +01:00 committed by GitHub
parent 1d3eae8861
commit ef26f58085
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
11 changed files with 100 additions and 94 deletions

View file

@ -16,31 +16,29 @@ jobs:
build: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
permissions: write-all permissions: write-all
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
fetch-depth: 2 fetch-depth: 2
- name: Get changed files - name: Get changed files
id: changed-files id: changed-files
uses: tj-actions/changed-files@v34 uses: dorny/paths-filter@v3
with: with:
files: | filters: |
*.nix files:
go.* - '*.nix'
**/*.go - 'go.*'
integration_test/ - '**/*.go'
config-example.yaml - 'integration_test/'
- 'config-example.yaml'
- uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/nix-installer-action@main
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.files == 'true'
- uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/magic-nix-cache-action@main
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.files == 'true'
- name: Run build - name: Run build
id: build id: build
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.files == 'true'
run: | run: |
nix build |& tee build-result nix build |& tee build-result
BUILD_STATUS="${PIPESTATUS[0]}" BUILD_STATUS="${PIPESTATUS[0]}"
@ -66,8 +64,8 @@ jobs:
body: 'Nix build failed with wrong gosum, please update "vendorSha256" (${{ steps.build.outputs.OLD_HASH }}) for the "headscale" package in flake.nix with the new SHA: ${{ steps.build.outputs.NEW_HASH }}' body: 'Nix build failed with wrong gosum, please update "vendorSha256" (${{ steps.build.outputs.OLD_HASH }}) for the "headscale" package in flake.nix with the new SHA: ${{ steps.build.outputs.NEW_HASH }}'
}) })
- uses: actions/upload-artifact@v3 - uses: actions/upload-artifact@v4
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.files == 'true'
with: with:
name: headscale-linux name: headscale-linux
path: result/bin/headscale path: result/bin/headscale

View file

@ -15,22 +15,22 @@ jobs:
fetch-depth: 2 fetch-depth: 2
- name: Get changed files - name: Get changed files
id: changed-files id: changed-files
uses: tj-actions/changed-files@v34 uses: dorny/paths-filter@v3
with: with:
files: | filters: |
*.nix files:
go.* - '*.nix'
**/*.go - 'go.*'
integration_test/ - '**/*.go'
config-example.yaml - 'integration_test/'
- 'config-example.yaml'
- uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/nix-installer-action@main
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.files == 'true'
- uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/magic-nix-cache-action@main
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.files == 'true'
- name: Generate and check integration tests - name: Generate and check integration tests
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.files == 'true'
run: | run: |
nix develop --command bash -c "cd cmd/gh-action-integration-generator/ && go generate" nix develop --command bash -c "cd cmd/gh-action-integration-generator/ && go generate"
git diff --exit-code .github/workflows/test-integration.yaml git diff --exit-code .github/workflows/test-integration.yaml

View file

@ -5,11 +5,12 @@ on:
branches: branches:
- main - main
workflow_dispatch: workflow_dispatch:
jobs: jobs:
add-contributors: add-contributors:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
- name: Delete upstream contributor branch - name: Delete upstream contributor branch
# Allow continue on failure to account for when the # Allow continue on failure to account for when the
# upstream branch is deleted or does not exist. # upstream branch is deleted or does not exist.

View file

@ -1,4 +1,5 @@
name: Build documentation name: Build documentation
on: on:
push: push:
branches: branches:
@ -15,7 +16,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Install python - name: Install python
uses: actions/setup-python@v4 uses: actions/setup-python@v4
with: with:
@ -33,6 +34,7 @@ jobs:
uses: actions/upload-pages-artifact@v1 uses: actions/upload-pages-artifact@v1
with: with:
path: ./site path: ./site
deploy: deploy:
environment: environment:
name: github-pages name: github-pages
@ -42,4 +44,4 @@ jobs:
steps: steps:
- name: Deploy to GitHub Pages - name: Deploy to GitHub Pages
id: deployment id: deployment
uses: actions/deploy-pages@v1 uses: actions/deploy-pages@v4

View file

@ -1,6 +1,5 @@
name: GitHub Actions Version Updater name: GitHub Actions Version Updater
# Controls when the action will run.
on: on:
schedule: schedule:
# Automatically run on every Sunday # Automatically run on every Sunday
@ -11,13 +10,13 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
with: with:
# [Required] Access token with `workflow` scope. # [Required] Access token with `workflow` scope.
token: ${{ secrets.WORKFLOW_SECRET }} token: ${{ secrets.WORKFLOW_SECRET }}
- name: Run GitHub Actions Version Updater - name: Run GitHub Actions Version Updater
uses: saadmk11/github-actions-version-updater@v0.7.1 uses: saadmk11/github-actions-version-updater@v0.8.1
with: with:
# [Required] Access token with `workflow` scope. # [Required] Access token with `workflow` scope.
token: ${{ secrets.WORKFLOW_SECRET }} token: ${{ secrets.WORKFLOW_SECRET }}

View file

@ -1,7 +1,6 @@
---
name: Lint name: Lint
on: [push, pull_request] on: [pull_request]
concurrency: concurrency:
group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }} group: ${{ github.workflow }}-$${{ github.head_ref || github.run_id }}
@ -11,63 +10,64 @@ jobs:
golangci-lint: golangci-lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
fetch-depth: 2 fetch-depth: 2
- name: Get changed files - name: Get changed files
id: changed-files id: changed-files
uses: tj-actions/changed-files@v34 uses: dorny/paths-filter@v3
with: with:
files: | filters: |
*.nix files:
go.* - '*.nix'
**/*.go - 'go.*'
integration_test/ - '**/*.go'
config-example.yaml - 'integration_test/'
- 'config-example.yaml'
- uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/nix-installer-action@main
if: steps.changed-files.outputs.files == 'true'
- uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/magic-nix-cache-action@main
if: steps.changed-files.outputs.files == 'true'
- name: golangci-lint - name: golangci-lint
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.files == 'true'
run: nix develop --command -- golangci-lint run --new-from-rev=${{github.event.pull_request.base.sha}} --out-format=github-actions . run: nix develop --command -- golangci-lint run --new-from-rev=${{github.event.pull_request.base.sha}} --out-format=github-actions .
prettier-lint: prettier-lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
with: with:
fetch-depth: 2 fetch-depth: 2
- name: Get changed files - name: Get changed files
id: changed-files id: changed-files
uses: tj-actions/changed-files@v14.1 uses: dorny/paths-filter@v3
with: with:
files: | filters: |
*.nix files:
**/*.md - '*.nix'
**/*.yml - '**/*.md'
**/*.yaml - '**/*.yml'
**/*.ts - '**/*.yaml'
**/*.js - '**/*.ts'
**/*.sass - '**/*.js'
**/*.css - '**/*.sass'
**/*.scss - '**/*.css'
**/*.html - '**/*.scss'
- '**/*.html'
- uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/nix-installer-action@main
if: steps.changed-files.outputs.files == 'true'
- uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/magic-nix-cache-action@main
if: steps.changed-files.outputs.files == 'true'
- name: Prettify code - name: Prettify code
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.files == 'true'
run: nix develop --command -- prettier --no-error-on-unmatched-pattern --ignore-unknown --check **/*.{ts,js,md,yaml,yml,sass,css,scss,html} run: nix develop --command -- prettier --no-error-on-unmatched-pattern --ignore-unknown --check **/*.{ts,js,md,yaml,yml,sass,css,scss,html}
proto-lint: proto-lint:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v4
- uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/magic-nix-cache-action@main

View file

@ -12,18 +12,18 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout - name: Checkout
uses: actions/checkout@v3 uses: actions/checkout@v4
with: with:
fetch-depth: 0 fetch-depth: 0
- name: Login to DockerHub - name: Login to DockerHub
uses: docker/login-action@v1 uses: docker/login-action@v3
with: with:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR - name: Login to GHCR
uses: docker/login-action@v1 uses: docker/login-action@v3
with: with:
registry: ghcr.io registry: ghcr.io
username: ${{ github.repository_owner }} username: ${{ github.repository_owner }}

View file

@ -1,4 +1,5 @@
name: Close inactive issues name: Close inactive issues
on: on:
schedule: schedule:
- cron: "30 1 * * *" - cron: "30 1 * * *"
@ -10,7 +11,7 @@ jobs:
issues: write issues: write
pull-requests: write pull-requests: write
steps: steps:
- uses: actions/stale@v5 - uses: actions/stale@v9
with: with:
days-before-issue-stale: 90 days-before-issue-stale: 90
days-before-issue-close: 7 days-before-issue-close: 7

View file

@ -61,23 +61,27 @@ jobs:
- uses: actions/checkout@v4 - uses: actions/checkout@v4
with: with:
fetch-depth: 2 fetch-depth: 2
- uses: DeterminateSystems/nix-installer-action@main
- uses: DeterminateSystems/magic-nix-cache-action@main
- uses: satackey/action-docker-layer-caching@main
continue-on-error: true
- name: Get changed files - name: Get changed files
id: changed-files id: changed-files
uses: tj-actions/changed-files@v34 uses: dorny/paths-filter@v3
with: with:
files: | filters: |
*.nix files:
go.* - '*.nix'
**/*.go - 'go.*'
integration_test/ - '**/*.go'
config-example.yaml - 'integration_test/'
- 'config-example.yaml'
- uses: DeterminateSystems/nix-installer-action@main
if: steps.changed-files.outputs.files == 'true'
- uses: DeterminateSystems/magic-nix-cache-action@main
if: steps.changed-files.outputs.files == 'true'
- uses: satackey/action-docker-layer-caching@main
if: steps.changed-files.outputs.files == 'true'
continue-on-error: true
- name: Run Integration Test - name: Run Integration Test
uses: Wandalen/wretry.action@master uses: Wandalen/wretry.action@master
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.files == 'true'
env: env:
USE_POSTGRES: ${{ matrix.database == 'postgres' && '1' || '0' }} USE_POSTGRES: ${{ matrix.database == 'postgres' && '1' || '0' }}
with: with:
@ -98,12 +102,12 @@ jobs:
-parallel 1 \ -parallel 1 \
-run "^${{ matrix.test }}$" -run "^${{ matrix.test }}$"
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: always() && steps.changed-files.outputs.any_changed == 'true' if: always() && steps.changed-files.outputs.files == 'true'
with: with:
name: ${{ matrix.test }}-${{matrix.database}}-logs name: ${{ matrix.test }}-${{matrix.database}}-logs
path: "control_logs/*.log" path: "control_logs/*.log"
- uses: actions/upload-artifact@v4 - uses: actions/upload-artifact@v4
if: always() && steps.changed-files.outputs.any_changed == 'true' if: always() && steps.changed-files.outputs.files == 'true'
with: with:
name: ${{ matrix.test }}-${{matrix.database}}-pprof name: ${{ matrix.test }}-${{matrix.database}}-pprof
path: "control_logs/*.pprof.tar" path: "control_logs/*.pprof.tar"

View file

@ -11,26 +11,27 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v3 - uses: actions/checkout@v4
with: with:
fetch-depth: 2 fetch-depth: 2
- name: Get changed files - name: Get changed files
id: changed-files id: changed-files
uses: tj-actions/changed-files@v34 uses: dorny/paths-filter@v3
with: with:
files: | filters: |
*.nix files:
go.* - '*.nix'
**/*.go - 'go.*'
integration_test/ - '**/*.go'
config-example.yaml - 'integration_test/'
- 'config-example.yaml'
- uses: DeterminateSystems/nix-installer-action@main - uses: DeterminateSystems/nix-installer-action@main
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.files == 'true'
- uses: DeterminateSystems/magic-nix-cache-action@main - uses: DeterminateSystems/magic-nix-cache-action@main
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.files == 'true'
- name: Run tests - name: Run tests
if: steps.changed-files.outputs.any_changed == 'true' if: steps.changed-files.outputs.files == 'true'
run: nix develop --check run: nix develop --check

View file

@ -9,7 +9,7 @@ jobs:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
uses: actions/checkout@v3 uses: actions/checkout@v4
- name: Install Nix - name: Install Nix
uses: DeterminateSystems/nix-installer-action@main uses: DeterminateSystems/nix-installer-action@main
- name: Update flake.lock - name: Update flake.lock