• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1name: 'Bazel build'
2description: 'Builds artifacts and creates the Dagger local snapshots.'
3
4runs:
5  using: "composite"
6  steps:
7    - name: 'Install Java ${{ env.USE_JAVA_VERSION }}'
8      uses: actions/setup-java@v4
9      with:
10        distribution: '${{ env.USE_JAVA_DISTRIBUTION }}'
11        java-version: '${{ env.USE_JAVA_VERSION }}'
12    - name: 'Check out repository'
13      uses: actions/checkout@v4
14    - name: 'Cache Bazel files'
15      uses: actions/cache@v4
16      with:
17        path: ~/.cache/bazel
18        key: ${{ runner.os }}-bazel-build-${{ github.sha }}
19        restore-keys: |
20          ${{ runner.os }}-bazel-build-
21    - name: 'Java build'
22      run: bazel build //java/...
23      shell: bash
24    - name: 'Install maven version'
25      run: ./util/install-maven.sh ${{ env.USE_MAVEN_VERSION }}
26      shell: bash
27    - name: 'Install local snapshot'
28      run: ./util/install-local-snapshot.sh
29      shell: bash
30    - name: 'Upload local snapshot for tests'
31      uses: actions/upload-artifact@v4
32      with:
33        name: local-snapshot
34        path: ~/.m2/repository/com/google/dagger
35    - name: 'Clean bazel cache'
36      # According to the documentation, we should be able to exclude these via
37      # the actions/cache path, e.g. "!~/.cache/bazel/*/*/external/" but that
38      # doesn't seem to work.
39      run: |
40        rm -rf $(bazel info repository_cache)
41        rm -rf ~/.cache/bazel/*/*/external/
42      shell: bash
43